refactor(agent): 医院信息子代理改为 hospital-info 技能直挂主 agent

删除 hospital-info 子代理,规则移入 agent/infra/skills/hospital-info/SKILL.md;管理端挂载 list/read/write,就诊人端只挂 list/read,只读仍由工具缺失保证;查询改为 read-first,未收录或重名再 list;同步更新两端提示词与测试。
This commit is contained in:
lik
2026-11-18 21:13:13 +08:00
parent 467d7b7383
commit 8e3fc43e08
7 changed files with 67 additions and 125 deletions
+11 -12
View File
@@ -15,13 +15,13 @@ process.env.TAVILY_API_KEY ??= config.agent.tavily?.apiKey;
process.env.BAIDU_MAP_AUTH_TOKEN ??= config.agent.baiduMap?.authToken;
import EscortAdminPrompts from "./prompts.js";
import { createPatientRecordSubagent } from "../../subagent/patient_record.js";
import { createHospitalInfoSubagent } from "../../subagent/hospital_info.js";
import {
webFetchTool, webSearchTool, getCalendarInfoTool, getYearHolidaysTool,
httpGetTool, escortRecordQueryTool, escortRecordSetTool,
employeeQueryTool, employeeReviewQueryTool,
createAttendantEscortRecordQueryTool, buildAttendantEscortRecordSetTool,
createAttendantEmployeeQueryTool
createAttendantEmployeeQueryTool,
hospitalKnowledgeListTool, hospitalKnowledgeReadTool, hospitalKnowledgeWriteTool
} from "../../infra/tools/index.js";
import { resolveEscortAdminRole } from "../../../utils/permissions.js";
@@ -207,9 +207,13 @@ export default class EscortAdminAgent {
return JSON.stringify([profile.name, profile.mobile, userInfo.app, role]);
}
// 公共安全工具:天气、路线、日期、节假日与网页检索,不涉及业务数据
// 公共工具:天气、路线、日期、节假日、网页检索与医院知识库
_commonTools() {
return [webFetchTool, webSearchTool, httpGetTool, getCalendarInfoTool, getYearHolidaysTool];
return [
webFetchTool, webSearchTool, httpGetTool, getCalendarInfoTool, getYearHolidaysTool,
// 医院知识库:管理员与陪诊员均可读写,查询与记录规则见 hospital-info 技能
hospitalKnowledgeListTool, hospitalKnowledgeReadTool, hospitalKnowledgeWriteTool
];
}
/**
@@ -226,7 +230,7 @@ export default class EscortAdminAgent {
/**
* 陪诊员工具集
* 只给本人订单与本人档案,禁止跨用户查询与财务字段;医院知识库写入走 hospital-info 子代理
* 只给本人订单与本人档案,禁止跨用户查询与财务字段;医院知识库由公共工具提供
*/
_attendantTools(userInfo) {
return [
@@ -249,13 +253,8 @@ export default class EscortAdminAgent {
});
const isAdminRole = role === "admin";
// 管理端与陪诊员均可写入医院知识库(权限收紧时按角色传 allowWrite)
const subagents = isAdminRole
? [
createPatientRecordSubagent(this.flashModel),
createHospitalInfoSubagent(this.flashModel, { allowWrite: true }),
]
: [createHospitalInfoSubagent(this.flashModel, { allowWrite: true })];
// 医院信息由主 agent 直接使用 hospital-info 技能与知识库工具,不再走子代理
const subagents = isAdminRole ? [createPatientRecordSubagent(this.flashModel)] : [];
return createDeepAgent({
name: "deep-agent",