fix lint error
This commit is contained in:
parent
8cbb645fa8
commit
bb3d04d7a9
@ -101,8 +101,8 @@ logger.add(
|
|||||||
from merico.pr.config_util import (
|
from merico.pr.config_util import (
|
||||||
get_gitlab_host,
|
get_gitlab_host,
|
||||||
get_repo_type,
|
get_repo_type,
|
||||||
read_server_access_token_with_input,
|
|
||||||
read_review_inline_config,
|
read_review_inline_config,
|
||||||
|
read_server_access_token_with_input,
|
||||||
)
|
)
|
||||||
from merico.pr.custom_suggestions_config import get_custom_suggestions_system_prompt
|
from merico.pr.custom_suggestions_config import get_custom_suggestions_system_prompt
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import sys
|
|||||||
|
|
||||||
from lib.chatmark import Checkbox
|
from lib.chatmark import Checkbox
|
||||||
|
|
||||||
|
|
||||||
# Configuration items
|
# Configuration items
|
||||||
CONFIG_ITEMS = {
|
CONFIG_ITEMS = {
|
||||||
"pr_review_inline": "PR Review Inline Enabled",
|
"pr_review_inline": "PR Review Inline Enabled",
|
||||||
@ -13,6 +12,7 @@ CONFIG_ITEMS = {
|
|||||||
# Configuration file paths
|
# Configuration file paths
|
||||||
GLOBAL_CONFIG_PATH = os.path.join(os.path.expanduser("~"), ".chat", ".workflow_config.json")
|
GLOBAL_CONFIG_PATH = os.path.join(os.path.expanduser("~"), ".chat", ".workflow_config.json")
|
||||||
|
|
||||||
|
|
||||||
def read_config(config_path, item):
|
def read_config(config_path, item):
|
||||||
if os.path.exists(config_path):
|
if os.path.exists(config_path):
|
||||||
with open(config_path, "r", encoding="utf-8") as f:
|
with open(config_path, "r", encoding="utf-8") as f:
|
||||||
@ -20,6 +20,7 @@ def read_config(config_path, item):
|
|||||||
return config.get(item)
|
return config.get(item)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def save_config(config_path, item, value):
|
def save_config(config_path, item, value):
|
||||||
if os.path.exists(config_path):
|
if os.path.exists(config_path):
|
||||||
with open(config_path, "r", encoding="utf-8") as f:
|
with open(config_path, "r", encoding="utf-8") as f:
|
||||||
@ -49,10 +50,13 @@ def is_pre_review_inline_enabled(current_value=False):
|
|||||||
return None
|
return None
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
print("Starting configuration of workflow settings...", end="\n\n", flush=True)
|
print("Starting configuration of workflow settings...", end="\n\n", flush=True)
|
||||||
print("If you want to change access token or host url, "
|
print(
|
||||||
"please edit the configuration file directly.")
|
"If you want to change access token or host url, "
|
||||||
|
"please edit the configuration file directly."
|
||||||
|
)
|
||||||
print("Configuration file is located at:", GLOBAL_CONFIG_PATH, end="\n\n", flush=True)
|
print("Configuration file is located at:", GLOBAL_CONFIG_PATH, end="\n\n", flush=True)
|
||||||
|
|
||||||
pr_review_inline_enable = read_config(GLOBAL_CONFIG_PATH, "pr_review_inline")
|
pr_review_inline_enable = read_config(GLOBAL_CONFIG_PATH, "pr_review_inline")
|
||||||
@ -63,5 +67,6 @@ def main():
|
|||||||
print("Workflow settings configuration successful.")
|
print("Workflow settings configuration successful.")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -114,6 +114,7 @@ def read_gitlab_host():
|
|||||||
return config_data["gitlab_host"]
|
return config_data["gitlab_host"]
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def read_review_inline_config():
|
def read_review_inline_config():
|
||||||
config_path = os.path.join(os.path.expanduser("~/.chat"), ".workflow_config.json")
|
config_path = os.path.join(os.path.expanduser("~/.chat"), ".workflow_config.json")
|
||||||
if os.path.exists(config_path):
|
if os.path.exists(config_path):
|
||||||
@ -123,6 +124,7 @@ def read_review_inline_config():
|
|||||||
return config_data["pr_review_inline"]
|
return config_data["pr_review_inline"]
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def save_github_token(github_token):
|
def save_github_token(github_token):
|
||||||
config_path = os.path.join(os.path.expanduser("~/.chat"), ".workflow_config.json")
|
config_path = os.path.join(os.path.expanduser("~/.chat"), ".workflow_config.json")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user