feat: 完善联网搜索功能集成到React模式
All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 6m3s
All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 6m3s
This commit is contained in:
@@ -10,6 +10,7 @@ from app.main_graph.state import MainGraphState, CurrentAction
|
||||
from .react_nodes import (
|
||||
init_state_node,
|
||||
react_reason_node,
|
||||
web_search_node, # ⭐ 新增
|
||||
error_handling_node,
|
||||
final_response_node,
|
||||
route_by_reasoning
|
||||
@@ -109,10 +110,13 @@ def build_react_main_graph() -> StateGraph:
|
||||
# 3. RAG 检索节点
|
||||
graph.add_node("rag_retrieve", rag_retrieve_node)
|
||||
|
||||
# 4. 错误处理节点
|
||||
# 4. 联网搜索节点 ⭐ 新增
|
||||
graph.add_node("web_search", web_search_node)
|
||||
|
||||
# 5. 错误处理节点
|
||||
graph.add_node("handle_error", error_handling_node)
|
||||
|
||||
# 5. 最终回答节点
|
||||
# 6. 最终回答节点
|
||||
graph.add_node("final_response", final_response_node)
|
||||
|
||||
# ========== 添加子图节点 ==========
|
||||
@@ -151,6 +155,9 @@ def build_react_main_graph() -> StateGraph:
|
||||
# 检索分支 → 检索后回到推理
|
||||
"rag_retrieve": "rag_retrieve",
|
||||
|
||||
# 联网搜索分支 ⭐ 新增
|
||||
"web_search": "web_search",
|
||||
|
||||
# 子图分支 → 子图后回到推理
|
||||
"contact_subgraph": "contact_subgraph",
|
||||
"dictionary_subgraph": "dictionary_subgraph",
|
||||
@@ -164,8 +171,9 @@ def build_react_main_graph() -> StateGraph:
|
||||
}
|
||||
)
|
||||
|
||||
# 4. 循环边:检索/子图/错误处理 后 → 回到推理
|
||||
# 4. 循环边:检索/搜索/子图/错误处理 后 → 回到推理
|
||||
graph.add_edge("rag_retrieve", "react_reason")
|
||||
graph.add_edge("web_search", "react_reason") # ⭐ 新增
|
||||
graph.add_edge("contact_subgraph", "react_reason")
|
||||
graph.add_edge("dictionary_subgraph", "react_reason")
|
||||
graph.add_edge("news_analysis_subgraph", "react_reason")
|
||||
|
||||
Reference in New Issue
Block a user