feat: Agent 工具日志结构化描述
工具结果与 custom 流事件改用 describeToolResult/describeStreamPayload 输出摘要,替代截断 200 字符的原始内容;thread_id 取 userInfo._id
This commit is contained in:
@@ -7,6 +7,7 @@ import config from '../../../config.js';
|
||||
import logger from '../../../utils/logger.js';
|
||||
import { createRestrictedBackend } from "../../infra/restricted_fs_backend.js";
|
||||
import { appendToolMessage, trimHistory } from "../../infra/history.js";
|
||||
import { describeToolResult, describeStreamPayload } from "../../infra/tool_log.js";
|
||||
import { OutputGuard, OUTPUT_MAX_CHARS } from "../../infra/guard.js";
|
||||
|
||||
// 密钥由 conf.json 统一提供;百度地图 token 由 http_get 按域名在服务端注入
|
||||
@@ -130,7 +131,7 @@ export default class EscortAdminAgent {
|
||||
for (const msg of data_.messages ?? []) {
|
||||
if (msg.type === "tool") {
|
||||
appendToolMessage(session.messages, msg);
|
||||
logger.info(`Tool complete: ${msg.name}, Result: ${String(msg.content).slice(0, 200)}`);
|
||||
logger.info(`Tool complete: ${msg.name}`, describeToolResult(msg.content));
|
||||
}
|
||||
}
|
||||
} else if (nodeName === "model_request") {
|
||||
@@ -165,7 +166,7 @@ export default class EscortAdminAgent {
|
||||
callback(source, "tool", message.text, message.id);
|
||||
}
|
||||
} else if (mode === "custom") {
|
||||
logger.info("custom: ", data);
|
||||
logger.info("custom event", describeStreamPayload(data));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user