feat: add deterministic message interaction stages

This commit is contained in:
Xin Wang
2026-08-03 07:10:41 +08:00
parent 479a516546
commit 9daa46ed4d
26 changed files with 1356 additions and 414 deletions

View File

@@ -190,20 +190,12 @@ class WorkflowEngine:
sections.append(f"[当前阶段任务]\n{prompt}")
return "\n\n".join(sections)
def greeting(self, store: DynamicVariableStore) -> str:
return store.render(str(self.data(self.start_id).get("greeting") or ""))
def routing_prompt(self, node_id: str, store: DynamicVariableStore) -> str:
"""Describe the current node to the small LLM edge router."""
if self.node_type(node_id) == "agent":
return self.prompt_for(node_id, store)
data = self.data(node_id)
details = (
data.get("greeting")
or data.get("message")
or data.get("target")
or ""
)
details = data.get("message") or data.get("target") or ""
rendered = store.render(str(details)).strip()
return f"{self.node_type(node_id) or 'workflow'} 节点:{rendered or self.name(node_id)}"