refactor: 将 RAG 节点拆分为独立模块
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Has been cancelled

- 新增 rag_nodes.py: 独立的 RAG 检索节点
- 从 react_nodes.py 移除 RAG 相关代码
- 更新导入和导出
- rag_nodes.py 包含 rag_retrieve_node 和 rag_re_retrieve_node
- 添加 inject_rag_tool_to_state 工具函数
This commit is contained in:
2026-04-26 11:23:12 +08:00
parent e3adb45454
commit aba261df35
4 changed files with 250 additions and 138 deletions

View File

@@ -7,11 +7,16 @@ from .subgraph_builder import build_main_graph, build_react_main_graph
from .react_nodes import (
init_state_node,
react_reason_node,
rag_retrieve_node,
error_handling_node,
final_response_node,
route_by_reasoning
)
from .rag_nodes import (
rag_retrieve_node,
rag_re_retrieve_node,
inject_rag_tool_to_state,
get_rag_tool_from_state
)
from .state import (
MessagesState,
GraphContext,
@@ -44,13 +49,18 @@ __all__ = [
"build_react_main_graph",
"init_state_node",
"react_reason_node",
"rag_retrieve_node",
"error_handling_node",
"final_response_node",
"route_by_reasoning",
"ErrorRecord",
"ErrorSeverity",
# RAG 节点(独立模块)
"rag_retrieve_node",
"rag_re_retrieve_node",
"inject_rag_tool_to_state",
"get_rag_tool_from_state",
# 超时和重试工具
"RetryConfig",
"RetryResult",