Skip to content

Commit 008ebe6

Browse files
feat: 分析当前工作流
1 parent 3c50782 commit 008ebe6

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

backend/service/mcp_client.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
FilePath: /comfyui_copilot/backend/service/mcp-client.py
77
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
88
'''
9+
from ..service.workflow_rewrite_tools import get_current_workflow
910
from ..utils.globals import BACKEND_BASE_URL, get_comfyui_copilot_api_key, DISABLE_WORKFLOW_GEN
1011
from .. import core
1112
import asyncio
@@ -202,7 +203,7 @@ def rewrite_handoff_input_filter(data: HandoffInputData) -> HandoffInputData:
202203
# Construct instructions based on DISABLE_WORKFLOW_GEN
203204
if DISABLE_WORKFLOW_GEN:
204205
workflow_creation_instruction = """
205-
**CASE 2: SEARCH WORKFLOW**
206+
**CASE 3: SEARCH WORKFLOW**
206207
IF the user wants to find or generate a NEW workflow.
207208
- Keywords: "create", "generate", "search", "find", "recommend", "生成", "查找", "推荐".
208209
- Action: Use `recall_workflow`.
@@ -212,7 +213,7 @@ def rewrite_handoff_input_filter(data: HandoffInputData) -> HandoffInputData:
212213
"""
213214
else:
214215
workflow_creation_instruction = """
215-
**CASE 2: CREATE NEW / SEARCH WORKFLOW**
216+
**CASE 3: CREATE NEW / SEARCH WORKFLOW**
216217
IF the user wants to find or generate a NEW workflow from scratch.
217218
- Keywords: "create", "generate", "search", "find", "recommend", "生成", "查找", "推荐".
218219
- Action: Use `recall_workflow` AND `gen_workflow`.
@@ -242,6 +243,16 @@ def rewrite_handoff_input_filter(data: HandoffInputData) -> HandoffInputData:
242243
- DO NOT call any other tools (like search_node, gen_workflow).
243244
- DO NOT ask for more details. Just handoff.
244245
246+
**CASE 2: ANALYZE CURRENT WORKFLOW**
247+
IF the user wants to:
248+
- Analyze, explain, or understand the current workflow structure/logic.
249+
- Ask questions about the current workflow (e.g., "how does this work?", "explain the workflow").
250+
- Keywords: "analyze", "explain", "understand", "how it works", "workflow structure", "分析", "解释", "怎么工作的", "解读".
251+
252+
**ACTION:**
253+
- You MUST call `get_current_workflow` to retrieve the workflow details.
254+
- Then, based on the returned workflow data, provide a detailed analysis or explanation to the user.
255+
245256
{workflow_creation_instruction}
246257
247258
### CONSTRAINT CHECKLIST
@@ -280,6 +291,7 @@ def rewrite_handoff_input_filter(data: HandoffInputData) -> HandoffInputData:
280291
""",
281292
mcp_servers=server_list,
282293
handoffs=[handoff_rewrite],
294+
tools=[get_current_workflow],
283295
config=config
284296
)
285297

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "ComfyUI-Copilot"
33
description = "Your Intelligent Assistant for Comfy-UI."
4-
version = "2.0.26"
4+
version = "2.0.27"
55
license = {file = "LICENSE"}
66

77
[project.urls]

0 commit comments

Comments
 (0)