fix(agent): 放宽出诊清单输出与历史工具结果保留长度
输出上限支持按端配置并放宽到 escort 3000 / admin 5000;医院与网页类工具结果入历史保留 3000 字,数据库类维持 300 字,避免出诊信息被截断或追问时丢失。
This commit is contained in:
@@ -8,7 +8,7 @@ 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";
|
||||
import { OutputGuard, OUTPUT_MAX_CHARS, resolveOutputMaxChars } from "../../infra/guard.js";
|
||||
|
||||
// 密钥由 conf.json 统一提供;百度地图 token 由 http_get 按域名在服务端注入
|
||||
process.env.TAVILY_API_KEY ??= config.agent.tavily?.apiKey;
|
||||
@@ -37,8 +37,10 @@ export default class EscortAdminAgent {
|
||||
this.temperature = options.temperature ?? 0.0;
|
||||
// 历史消息字符数上限(管理端多步工具调用更易堆积上下文)
|
||||
this.maxHistoryChars = options.maxHistoryChars || config.agent.maxHistoryChars || 40000;
|
||||
// 单条回复字符上限:管理端要列记录,比咨询侧留更大余量
|
||||
this.maxOutputChars = options.maxOutputChars || config.agent.maxOutputChars || OUTPUT_MAX_CHARS.admin;
|
||||
// 单条回复字符上限:管理端要转述记录与医院清单,默认值需能完整输出一次排班列表;
|
||||
// 可在 conf.json agent.maxOutputChars 调整
|
||||
this.maxOutputChars = options.maxOutputChars
|
||||
|| resolveOutputMaxChars(config.agent.maxOutputChars, "admin", OUTPUT_MAX_CHARS.admin);
|
||||
}
|
||||
|
||||
clearMessages(userInfo) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import Prompts from "./prompts.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";
|
||||
import { OutputGuard, OUTPUT_MAX_CHARS, resolveOutputMaxChars } from "../../infra/guard.js";
|
||||
import {
|
||||
webFetchTool, webSearchTool, getCalendarInfoTool, getYearHolidaysTool,
|
||||
httpGetTool, createEscortRecordQueryTool, createHealthProfileQueryTool,
|
||||
@@ -35,8 +35,10 @@ export default class EscortAgent {
|
||||
this.maxHistoryChars = options.maxHistoryChars || config.agent.maxHistoryChars || 40000;
|
||||
// 咨询场景需要一点表达自由度:温度为 0 时共情回复会退化为固定句式
|
||||
this.temperature = options.temperature ?? 0.3;
|
||||
// 单条回复字符上限:提示词要求 1-3 句,超长时由输出护栏兜底截断
|
||||
this.maxOutputChars = options.maxOutputChars || config.agent.maxOutputChars || OUTPUT_MAX_CHARS.escort;
|
||||
// 单条回复字符上限:提示词要求 1-3 句,护栏只兜底异常长文,
|
||||
// 默认值需能完整输出一次出诊/排班清单;可在 conf.json agent.maxOutputChars 调整
|
||||
this.maxOutputChars = options.maxOutputChars
|
||||
|| resolveOutputMaxChars(config.agent.maxOutputChars, "escort", OUTPUT_MAX_CHARS.escort);
|
||||
}
|
||||
|
||||
clearMessages() {
|
||||
|
||||
Reference in New Issue
Block a user