feat(workflow): add edge-tool routing and realtime runtime

This commit is contained in:
Xin Wang
2026-08-04 22:29:04 +08:00
parent 1902ffc240
commit 59588ba88d
25 changed files with 1952 additions and 107 deletions
+11 -1
View File
@@ -20,6 +20,11 @@ AGENT_STAGE_INSTRUCTION = (
"工作流路由已在用户一轮输入结束时完成。只执行当前阶段任务,"
"不要自行解释、模拟或宣布节点切换。"
)
EDGE_TOOL_STAGE_INSTRUCTION = (
"只执行当前阶段任务。若某个工作流跳转工具的条件已经明确满足,"
"必须只调用一个对应的 goto 工具,不要口头宣布、解释或模拟节点跳转。"
"若没有条件满足,则正常回答用户并停留在当前阶段。"
)
class WorkflowAgentStage:
@@ -43,9 +48,14 @@ class WorkflowAgentStage:
stage = self._engine.agent_stage_config(node_id)
if stage.vision_enabled:
stage_prompt = f"{stage_prompt}\n\n[视觉能力]\n{VISION_SYSTEM_HINT}"
instruction = (
EDGE_TOOL_STAGE_INSTRUCTION
if self._engine.llm_routing_mode() == "edge_tool"
else AGENT_STAGE_INSTRUCTION
)
return (
f"{stage_prompt}\n\n[工作流执行规则]\n"
f"{AGENT_STAGE_INSTRUCTION}"
f"{instruction}"
)
async def refresh_prompt(self, node_id: str) -> None: