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:
@@ -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",
|
||||
|
||||
@@ -62,8 +62,8 @@ class EscortAdminPrompts {
|
||||
# 工具对应
|
||||
- 陪诊单查询 escort_record_query(患者名/手机号/状态/陪诊员ID/日期范围,日期用 YYYY-MM-DD);改单 escort_record_set
|
||||
- 患者健康档案:patient-record 子代理(查询与写入)
|
||||
- 医院信息(地址、电话、等级、科室名称、医生与排班、就诊流程等):hospital-info 子代理(查询与记录,优先使用档案中的官方链接)
|
||||
- 用户说「记住」「以后用得上」或明显可复用的医院电话、排班入口、就诊流程:交给 hospital-info 子代理写入本地知识库
|
||||
- 医院信息(地址、电话、等级、科室名称、医生与排班、就诊流程等):先看 hospital-info 技能,用 hospital_knowledge_read 读本地档案;未收录或重名再用 hospital_knowledge_list,优先使用档案中的官方链接
|
||||
- 用户说「记住」「以后用得上」或明显可复用的医院电话、排班入口、就诊流程:用 hospital_knowledge_write 写入本地知识库
|
||||
- 陪诊员档案 employee_query(姓名/工号/角色/状态);评价 employee_review_query
|
||||
- 天气、路线、日期、节假日;网页信息用 web_search / web_fetch
|
||||
|
||||
@@ -105,8 +105,8 @@ ${buildReference(userInfo, "管理员")}`;
|
||||
- 我的订单:escort_record_query(患者名/状态/日期范围 YYYY-MM-DD)
|
||||
- 开始/完成服务、写陪诊备注:escort_record_set
|
||||
- 本人档案:employee_query
|
||||
- 医院基础信息(地址、电话、等级、科室名称、排班入口、就诊流程):hospital-info 子代理(查询与记录,优先使用档案中的官方链接)
|
||||
- 用户提供可复用的医院信息时,交给 hospital-info 子代理写入,不要只在回复里重复
|
||||
- 医院基础信息(地址、电话、等级、科室名称、排班入口、就诊流程):先看 hospital-info 技能,用 hospital_knowledge_read 读本地档案;未收录或重名再用 hospital_knowledge_list
|
||||
- 用户提供可复用的医院信息时,用 hospital_knowledge_write 写入,不要只在回复里重复
|
||||
- 天气、路线、日期、节假日:http_get / get_calendar_info / get_year_holidays;网页信息用 web_search / web_fetch
|
||||
|
||||
# 严谨边界
|
||||
|
||||
Reference in New Issue
Block a user