集成三个子图到主Agent架构 + 修复前后端字段不匹配问题
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Has been cancelled

主要变更:
1. 创建 subgraph_tools.py - 将三个子图包装为 LangChain 工具
2. 更新 graph_tools.py - 删除旧工具,添加子图工具
3. 更新系统提示词 - 介绍三个子系统 + RAG 能力
4. 简化 backend.py - 删除独立子图 API 端点
5. 修复 service.py 字段名不匹配问题 - content -> token
6. 前端界面优化 - 移动子图测试到侧边栏、删除测试审核按钮
7. 添加 pyjwt 依赖到 requirements.txt
8. 更新 docker-compose.yml - 添加前端代码挂载
This commit is contained in:
2026-04-27 15:23:50 +08:00
parent 26f872f975
commit 048f57a89f
13 changed files with 244 additions and 406 deletions

View File

@@ -17,24 +17,13 @@ from .formatter import (
)
from .intent import (
# 旧版 API保持向后兼容
IntentType,
Intent,
Entity,
IntentParser,
RuleBasedIntentClassifier,
RuleBasedEntityExtractor,
IntentRegistry,
create_default_intent_parser,
# 新版 React 模式 API
# React 模式 API
ReasoningAction,
RetrievalConfig,
ReasoningResult,
BaseIntentReasoner,
RuleBasedReactReasoner,
LLMReactReasoner,
create_react_reasoner,
ReactIntentReasoner,
react_reason,
react_reason_async,
get_route_by_reasoning
)
@@ -60,24 +49,13 @@ __all__ = [
"TemplateManager",
"OutputRenderer",
"PresetTemplates",
# intent - 旧版
"IntentType",
"Intent",
"Entity",
"IntentParser",
"RuleBasedIntentClassifier",
"RuleBasedEntityExtractor",
"IntentRegistry",
"create_default_intent_parser",
# intent - 新版 React 模式
# intent - React 模式
"ReasoningAction",
"RetrievalConfig",
"ReasoningResult",
"BaseIntentReasoner",
"RuleBasedReactReasoner",
"LLMReactReasoner",
"create_react_reasoner",
"ReactIntentReasoner",
"react_reason",
"react_reason_async",
"get_route_by_reasoning",
# human_review
"ReviewStatus",

View File

@@ -9,8 +9,6 @@ import random
# 公共工具
from ..common import (
IntentParser,
RuleBasedIntentClassifier,
MarkdownFormatter
)
@@ -29,18 +27,9 @@ WORD_BOOK_DB: Dict[str, List[Dict]] = {} # user_id -> [word_entries]
def parse_intent(state: DictionaryState) -> DictionaryState:
"""
解析用户意图节点(使用公共工具
解析用户意图节点(使用规则匹配
确定用户想做什么操作
"""
# 使用公共意图解析器
parser = IntentParser()
# 为词典子图添加特定规则
if isinstance(parser.classifier, RuleBasedIntentClassifier):
# 为了复用公共工具,我们在内部继续使用关键词匹配
# 但可以通过扩展 IntentParser 来支持子图特定的意图
pass
# 子图特定的意图解析
query_lower = state.user_query.lower()