后端服务将通过tjwater-cli形式访问
This commit is contained in:
@@ -8,12 +8,12 @@ const initializePromise = toolContextStore.initialize();
|
||||
|
||||
export default tool({
|
||||
description:
|
||||
"回读由 dynamic_http_call 生成的持久化 result_ref。适用于大结果只返回 preview 时,再按需读取完整或截断后的数据。",
|
||||
"回读持久化 result_ref。适用于大结果只返回 preview 时,按需读取完整或截断后的数据。仅用于仍使用 referenced 模式的遗留接口。",
|
||||
args: {
|
||||
reason: tool.schema
|
||||
.string()
|
||||
.describe("Why the stored result needs to be read for the current user request."),
|
||||
result_ref: tool.schema.string().describe("The result_ref returned by dynamic_http_call."),
|
||||
result_ref: tool.schema.string().describe("The result_ref handle."),
|
||||
max_items: tool.schema
|
||||
.number()
|
||||
.int()
|
||||
|
||||
@@ -8,20 +8,20 @@ const initializePromise = toolContextStore.initialize();
|
||||
|
||||
export default tool({
|
||||
description:
|
||||
"通过本地 Agent 桥接调用 TJWater 后端 API。需提供 API 路径、可选的请求方法以及查询参数。",
|
||||
"通过本地 Agent 桥接调用 tjwater-cli 命令访问 TJWater 后端。提供 CLI 子命令和参数。",
|
||||
args: {
|
||||
reason: tool.schema
|
||||
.string()
|
||||
.describe("Why this tool call is required for the current user request."),
|
||||
path: tool.schema.string().describe("Target backend API path, starting with '/'."),
|
||||
method: tool.schema
|
||||
command: tool.schema
|
||||
.string()
|
||||
.describe(
|
||||
"tjwater-cli 子命令,不含二进制路径。示例:'project list'、'data timeseries realtime links --start-time 2025-01-01T00:00:00+08:00 --end-time 2025-01-01T01:00:00+08:00'",
|
||||
),
|
||||
timeout: tool.schema
|
||||
.number()
|
||||
.optional()
|
||||
.describe("HTTP method. Defaults to GET."),
|
||||
arguments: tool.schema
|
||||
.record(tool.schema.string(), tool.schema.unknown())
|
||||
.optional()
|
||||
.describe("Query arguments object."),
|
||||
.describe("超时秒数,默认 120。大结果集建议设 300+。"),
|
||||
},
|
||||
async execute(args, context) {
|
||||
await initializePromise;
|
||||
@@ -29,8 +29,7 @@ export default tool({
|
||||
if (!sessionContext) {
|
||||
throw new Error(`session context not found for ${context.sessionID}`);
|
||||
}
|
||||
// 工具本身不直接持有用户 token;通过 sessionID 回调 Agent 服务,由服务侧补齐用户上下文。
|
||||
const response = await fetch(`${internalBaseUrl}/internal/tools/dynamic-http-call`, {
|
||||
const response = await fetch(`${internalBaseUrl}/internal/tools/tjwater-cli-call`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -39,9 +38,8 @@ export default tool({
|
||||
body: JSON.stringify({
|
||||
sessionScopeKey: sessionContext.sessionScopeKey,
|
||||
reason: args.reason,
|
||||
path: args.path,
|
||||
method: args.method,
|
||||
arguments: args.arguments,
|
||||
command: args.command,
|
||||
timeout: args.timeout,
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user