fix(agent): 放宽出诊清单输出与历史工具结果保留长度
输出上限支持按端配置并放宽到 escort 3000 / admin 5000;医院与网页类工具结果入历史保留 3000 字,数据库类维持 300 字,避免出诊信息被截断或追问时丢失。
This commit is contained in:
@@ -13,6 +13,11 @@ import {
|
||||
applyBaiduAuthorization,
|
||||
buildRequestUrl,
|
||||
} from "../agent/infra/tools/web/http_get.js";
|
||||
import {
|
||||
appendToolMessage,
|
||||
TOOL_RESULT_MAX_CHARS,
|
||||
LARGE_TOOL_RESULT_MAX_CHARS,
|
||||
} from "../agent/infra/history.js";
|
||||
|
||||
test("订单状态机只允许正向流转", () => {
|
||||
assert.equal(canTransition("pending", "confirmed"), true);
|
||||
@@ -162,3 +167,22 @@ test("状态机表覆盖全部订单状态", () => {
|
||||
["cancelled", "none", "requested"]
|
||||
);
|
||||
});
|
||||
|
||||
test("历史中医院/网页结果保留更长开头,数据库结果维持短截断", () => {
|
||||
// 2000 字:数据库类仍截到 300,医院/网页类完整保留(原上限 300 会丢失出诊清单后半段)
|
||||
const medium = "医".repeat(2000);
|
||||
const dbStored = appendToolMessage([], { name: "escort_record_query", content: medium });
|
||||
assert.equal(dbStored.content.slice(0, TOOL_RESULT_MAX_CHARS), medium.slice(0, TOOL_RESULT_MAX_CHARS));
|
||||
assert.ok(dbStored.content.includes("已截断"));
|
||||
|
||||
for (const name of ["hospital_knowledge_read", "web_fetch"]) {
|
||||
const stored = appendToolMessage([], { name, content: medium });
|
||||
assert.equal(stored.content, medium);
|
||||
}
|
||||
|
||||
// 超长内容:医院/网页类截到 3000,而不是 300
|
||||
const long = "医".repeat(5000);
|
||||
const largeStored = appendToolMessage([], { name: "hospital_knowledge_read", content: long });
|
||||
assert.equal(largeStored.content.slice(0, LARGE_TOOL_RESULT_MAX_CHARS), long.slice(0, LARGE_TOOL_RESULT_MAX_CHARS));
|
||||
assert.ok(largeStored.content.includes("已截断"));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user