Skip to content

Commit 94b62e1

Browse files
bobo yangbobo yang
authored andcommitted
feat: Refactor workflow update logic and improve formatting
- Enhance readability by adjusting indentation and line breaks - Refactor response creation for better code structure - Remove unnecessary blank lines for cleaner code appearance
1 parent cd260be commit 94b62e1

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

devchat/_service/route/workflows.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,18 @@ def get_config():
6060
@router.post("/update", response_model=response.UpdateWorkflows)
6161
def update_workflows():
6262
chat_config_path = Path(CHAT_DIR) / CHAT_CONFIG_FILENAME
63-
63+
6464
if chat_config_path.exists():
6565
with open(chat_config_path, "r", encoding="utf-8") as file:
6666
chat_config = yaml.safe_load(file)
67-
67+
6868
providers = chat_config.get("providers", {})
6969
devchat_api_key = providers.get("devchat", {}).get("api_key", "")
7070
openai_api_key = providers.get("openai", {}).get("api_key", "")
71-
71+
7272
if devchat_api_key or openai_api_key:
7373
update_public_workflow = chat_config.get("update_public_workflow", True)
74-
74+
7575
if update_public_workflow:
7676
base_path = Path(WORKFLOWS_BASE)
7777

@@ -84,11 +84,19 @@ def update_workflows():
8484

8585
return response.UpdateWorkflows(updated=updated, message=message)
8686
else:
87-
return response.UpdateWorkflows(updated=False, message="Workflow update has been ignored due to configuration settings.")
87+
return response.UpdateWorkflows(
88+
updated=False,
89+
message="Workflow update has been ignored due to configuration settings.",
90+
)
8891
else:
89-
return response.UpdateWorkflows(updated=False, message="No valid API key found, workflow update ignored.")
92+
return response.UpdateWorkflows(
93+
updated=False, message="No valid API key found, workflow update ignored."
94+
)
9095
else:
91-
return response.UpdateWorkflows(updated=False, message="Configuration file not found, workflow update ignored.")
96+
return response.UpdateWorkflows(
97+
updated=False, message="Configuration file not found, workflow update ignored."
98+
)
99+
92100

93101
@router.post("/custom_update", response_model=response.UpdateWorkflows)
94102
def update_custom_workflows():

0 commit comments

Comments
 (0)