修改架构:llm_call后增加观察环节注释
All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 5m56s
All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 5m56s
This commit is contained in:
@@ -92,9 +92,13 @@ def build_react_main_graph(llm=None, tools=None) -> StateGraph:
|
||||
├─ dictionary_subgraph →────────┤
|
||||
├─ news_analysis_subgraph →─────┤
|
||||
├─ handle_error → (重试或结束) ─┤
|
||||
└─ llm_call → END
|
||||
↓
|
||||
END
|
||||
└─ llm_call (大模型调用) ←──────┘
|
||||
↓
|
||||
🔍 观察 (检查 tool_calls)
|
||||
↓
|
||||
[有工具调用?]
|
||||
├─ 是 → 执行工具 → 回到 llm_call
|
||||
└─ 否 → END
|
||||
"""
|
||||
# 创建图
|
||||
graph = StateGraph(MainGraphState)
|
||||
@@ -184,8 +188,9 @@ def build_react_main_graph(llm=None, tools=None) -> StateGraph:
|
||||
graph.add_edge("dictionary_subgraph", "react_reason")
|
||||
graph.add_edge("news_analysis_subgraph", "react_reason")
|
||||
graph.add_edge("handle_error", "react_reason")
|
||||
|
||||
# 5. 最终边:llm_call → END
|
||||
|
||||
# 5. 条件路由:llm_call 后检查是否有工具调用
|
||||
# 注意:这里简化处理,先直接 END,后续再完善工具调用循环
|
||||
if llm_node is not None:
|
||||
graph.add_edge("llm_call", END)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user