添加注释以说明工具和会话的上下文处理

This commit is contained in:
2026-04-29 11:58:13 +08:00
parent d3e7baca99
commit b857ca543d
11 changed files with 15 additions and 0 deletions
+1
View File
@@ -18,6 +18,7 @@ export default tool({
.describe("Query arguments object."),
},
async execute(args, context) {
// 工具本身不直接持有用户 token;通过 sessionID 回调 Agent 服务,由服务侧补齐用户上下文。
const response = await fetch(`${internalBaseUrl}/internal/tools/dynamic-http-call`, {
method: "POST",
headers: {
+1
View File
@@ -9,6 +9,7 @@ export default tool({
.describe("Type of feature to locate."),
},
async execute() {
// 前端工具只负责生成 tool part,真正的地图动作由 Agent SSE 适配层转发给浏览器执行。
return "已在地图上定位到指定要素。";
},
});
+1
View File
@@ -22,6 +22,7 @@ export default tool({
y_axis_name: tool.schema.string().optional().describe("Y-axis display name."),
},
async execute() {
// 图表数据已经在工具参数里,前端收到 tool_call 后直接渲染,不再二次请求后端。
return "图表将在对话中显示。";
},
});
+1
View File
@@ -13,6 +13,7 @@ export default tool({
end_time: tool.schema.string().optional().describe("Optional ISO8601 end time."),
},
async execute() {
// 返回短确认即可;面板打开动作由前端根据 tool_call 参数完成。
return "已打开计算结果面板。";
},
});
+1
View File
@@ -16,6 +16,7 @@ export default tool({
end_time: tool.schema.string().optional().describe("Optional ISO8601 end time."),
},
async execute() {
// SCADA 面板仍在浏览器侧执行,工具结果不承载实际监测数据。
return "已打开 SCADA 监测面板。";
},
});