feat: expose graph orchestration mode, fix pipeline multi-agent, add Feishu tools (Phase 3)

增强编排 + 飞书深度集成:
- Graph 模式:暴露 orchestrator._graph() 到 run() 方法,workflow_integration 支持 graph nodes/edges
- Pipeline 修复:多 Agent 按步骤轮转分配,不再只用 agents[0]
- 4个飞书操作工具: feishu_create_doc / feishu_create_calendar_event / feishu_search_contacts / feishu_send_approval
- 飞书 @mention→Goal:feishu/ orange WS handler 支持 "目标: xxx" 触发自动创建 Goal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
renjianbo
2026-05-08 20:08:26 +08:00
parent 926ec6c0a1
commit d0b55f2b16
6 changed files with 490 additions and 27 deletions

View File

@@ -192,8 +192,8 @@ async def run_orchestrator_node(
# 2. 解析编排模式
mode = node_data.get("mode", "debate").lower()
if mode not in ("route", "sequential", "debate", "pipeline"):
return {"output": f"错误:不支持的编排模式 '{mode}',可选: route, sequential, debate, pipeline", "status": "error"}
if mode not in ("route", "sequential", "debate", "pipeline", "graph"):
return {"output": f"错误:不支持的编排模式 '{mode}',可选: route, sequential, debate, pipeline, graph", "status": "error"}
# 3. 解析 Agent 列表
agent_ids = node_data.get("agents", [])
@@ -266,33 +266,45 @@ async def run_orchestrator_node(
temperature=0.3,
),
)
# graph 模式需要传递节点和边定义
graph_nodes = node_data.get("graph_nodes") if mode == "graph" else None
graph_edges = node_data.get("graph_edges") if mode == "graph" else None
result = await orchestrator.run(
mode=mode,
question=query,
agents=agent_configs,
on_llm_call=on_llm_invocation,
graph_nodes=graph_nodes,
graph_edges=graph_edges,
)
# 6. 返回结构化结果
meta: Dict[str, Any] = {
"mode": result.mode,
"agent_count": len(agent_configs),
"steps": [
{
"agent_id": s.agent_id,
"agent_name": s.agent_name,
"input": s.input[:200] if s.input else "",
"output": s.output[:500] if s.output else "",
"iterations_used": s.iterations_used,
"tool_calls_made": s.tool_calls_made,
"error": s.error,
}
for s in result.steps
],
}
if mode == "graph":
meta["graph_node_count"] = len(graph_nodes) if graph_nodes else 0
meta["graph_edge_count"] = len(graph_edges) if graph_edges else 0
return {
"output": result.final_answer,
"status": "success",
"orchestrator_meta": {
"mode": result.mode,
"agent_count": len(agent_configs),
"steps": [
{
"agent_id": s.agent_id,
"agent_name": s.agent_name,
"input": s.input[:200] if s.input else "",
"output": s.output[:500] if s.output else "",
"iterations_used": s.iterations_used,
"tool_calls_made": s.tool_calls_made,
"error": s.error,
}
for s in result.steps
],
},
"orchestrator_meta": meta,
}
except Exception as e: