Skip to content

Commit 076e23e

Browse files
committed
refactor: 删除重复的 tools
1 parent 8987cf5 commit 076e23e

File tree

2 files changed

+2
-51
lines changed

2 files changed

+2
-51
lines changed

src/agents/common/tools.py

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@
1111
from src import config, graph_base, knowledge_base
1212
from src.utils import logger
1313

14-
# TODO[修改建议]:前端需要通过interrupt进行交互,点击是或否来批准执行
15-
# 返回中断点:
16-
# is_approved : bool = True 或者 False
17-
# resume_command = Command(resume=is_approved)
18-
# stream = graph.stream(resume_command, config=config, stream_mode="messages")
19-
# graph.invoke(resume_command, config=config)
14+
2015
@tool(name_or_callable="人工审批工具", description="请求人工审批工具,用于在执行重要操作前获得人类确认。")
2116
def get_approved_user_goal(
2217
operation_description: str,
@@ -54,50 +49,6 @@ def get_approved_user_goal(
5449

5550
return result
5651

57-
# TODO[修改建议]:前端需要通过interrupt进行交互,点击是或否来批准执行
58-
# 返回中断点:
59-
# is_approved : bool = True 或者 False
60-
# resume_command = Command(resume=is_approved)
61-
# stream = graph.stream(resume_command, config=config, stream_mode="messages")
62-
# graph.invoke(resume_command, config=config)
63-
@tool(name_or_callable="人工审批工具", description="请求人工审批工具,用于在执行重要操作前获得人类确认。")
64-
def get_approved_user_goal(
65-
operation_description: str,
66-
) -> dict:
67-
"""
68-
请求人工审批,在执行重要操作前获得人类确认。
69-
70-
Args:
71-
operation_description: 需要审批的操作描述,例如 "调用知识库工具"
72-
Returns:
73-
dict: 包含审批结果的字典,格式为 {"approved": bool, "message": str}
74-
"""
75-
# 构建详细的中断信息
76-
interrupt_info = {
77-
"question": "是否批准以下操作?",
78-
"operation": operation_description,
79-
}
80-
81-
# 触发人工审批
82-
is_approved = interrupt(interrupt_info)
83-
84-
# 返回审批结果
85-
if is_approved:
86-
result = {
87-
"approved": True,
88-
"message": f"✅ 操作已批准:{operation_description}",
89-
}
90-
print(f"✅ 人工审批通过: {operation_description}")
91-
else:
92-
result = {
93-
"approved": False,
94-
"message": f"❌ 操作被拒绝:{operation_description}",
95-
}
96-
print(f"❌ 人工审批被拒绝: {operation_description}")
97-
98-
return result
99-
100-
10152
@tool(name_or_callable="查询知识图谱", description="使用这个工具可以查询知识图谱中包含的三元组信息。")
10253
def query_knowledge_graph(query: Annotated[str, "The keyword to query knowledge graph."]) -> Any:
10354
"""Use this to query knowledge graph, which include some food domain knowledge."""

src/agents/reporter/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async def context_based_model(request: ModelRequest, handler) -> ModelResponse:
3939

4040

4141
class SqlReporterAgent(BaseAgent):
42-
name = "SQL 报告助手"
42+
name = "数据库报表助手"
4343
description = "一个能够生成 SQL 查询报告的智能体助手。同时调用 Charts MCP 生成图表。"
4444

4545
def __init__(self, **kwargs):

0 commit comments

Comments
 (0)