Skip to content

Commit b31b21a

Browse files
author
ai-business-hql
committed
feat: update_workflow bug
1 parent b5a2ffe commit b31b21a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

backend/service/workflow_rewrite_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def create_workflow_rewrite_agent():
102102
**Tool Usage Guidelines:**
103103
- get_current_workflow(): Get current workflow from checkpoint or session
104104
- remove_node(): Use for incompatible or problematic nodes
105-
- update_workflow(): Use to save your changes (ALWAYS call this after you have made changes)
105+
- update_workflow(): Use to save your changes (ALWAYS call this after you have made changes), you MUST pass argument `workflow_data` containing the FULL workflow JSON (as a JSON object or a JSON string). Never call `update_workflow` without `workflow_data`.
106106
- get_node_info(): Get detailed node information and verify input/output types before connecting
107107
108108

backend/service/workflow_rewrite_tools.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def tool_error_function(ctx: RunContextWrapper[Any], error: Exception) -> str:
126126

127127
# def update_workflow(session_id: str, workflow_data: Union[Dict[str, Any], str]) -> str:
128128
@function_tool
129-
def update_workflow(workflow_data: str) -> str:
129+
def update_workflow(workflow_data: str = "") -> str:
130130
"""
131131
更新当前session的工作流数据
132132
@@ -141,6 +141,12 @@ def update_workflow(workflow_data: str) -> str:
141141
if not session_id:
142142
return json.dumps({"error": "No session_id found in context"})
143143

144+
if not workflow_data or not isinstance(workflow_data, str) or not workflow_data.strip():
145+
return json.dumps({
146+
"error": "Missing required argument: workflow_data",
147+
"hint": "Pass the full workflow JSON as a string."
148+
})
149+
144150
log.info(f"[update_workflow] workflow_data: {workflow_data}")
145151
# 在修改前保存checkpoint
146152
checkpoint_id = save_checkpoint_before_modification(session_id, "workflow update")

0 commit comments

Comments
 (0)