Files
api_health/agent/subagent/hospital_info.js
T
lik 9ab2a39d08 fix(agent): 医院工具切换至 hospital 集合并补齐支付约束
hospital_info_list/query/set 改为读写 hospital 集合,适配 entityName/nicknames/fudanRank;医院子代理与提示词同步字段口径;health_profile_set 更新启用 schema 校验;escort_record_set 限制线下收款方式,存在未支付流水时禁止改价。
2026-11-06 17:38:28 +08:00

42 lines
2.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import {
hospitalInfoListTool,
hospitalInfoQueryTool,
hospitalInfoSetTool,
} from "../infra/tools/index.js";
// 医院基础信息查询与维护(名称/主体/院区、省市地址、电话、等级、科室名称、复旦榜档位)
const QUERY_PROMPT = `查询:
- 先用 hospital_info_list 拿到医院(名称、id)列表定位医院,再用 hospital_info_query 传 hospitalId 获取完整信息。
- 分院/院区是独立医院记录,与本院共享 entityName;可用 hospital_info_list 的 entityName 参数只列同一主体下的医院。
- 需要按名称、主体名、拼音、昵称或科室名过滤时,直接用 hospital_info_query(hospitalName/department)。
- 资料库只有医院基础信息(省市、地址、电话、等级、科室名称列表、复旦榜档位与昵称),不含医生出诊、挂号流程和就医指南;问到这些要如实说明库中没有,不能编造。
- 电话、地址等可能变动,回答时提示以医院最新公告为准。
- 查不到的信息如实告知,禁止编造。`;
const MAINTAIN_PROMPT = `维护:
- 写入优先用 hospitalId 定位;只用名称时必须唯一命中,多命中会返回 candidates,先确认 id 再写。
- 只维护基础字段:name、entityName、province、city、address、phone、departments(科室名称数组,整体替换)、level。
- 名称是唯一键;改名会自动同步拼音、昵称与复旦榜档位,不要手写 pinyin/nicknames/fudanRank。
- 分院/院区是独立医院记录,名称约定为「主体名称-分院名称」,不要写到总院上。
- 资料库不维护医生出诊、挂号流程与就医指南,不要尝试写入这些内容。`;
/**
* @param {Object} model
* @param {Object} [options]
* @param {boolean} [options.allowWrite] 是否允许维护医院资料。用户端默认只读,避免普通用户改写医院数据。
*/
export const createHospitalInfoSubagent = (model, { allowWrite = false } = {}) => ({
name: "hospital-info-subagent",
description: allowWrite
? "查询和维护医院基础信息:医院名称与院区、省市地址、联系电话、医院等级、科室名称列表、复旦榜档位与常用昵称"
: "查询医院基础信息:医院名称与院区、省市地址、联系电话、医院等级、科室名称列表、复旦榜档位与常用昵称",
systemPrompt: `你负责医院基础信息的查询${allowWrite ? "、维护、更新、核验" : ""}。
${QUERY_PROMPT}${allowWrite ? `\n\n${MAINTAIN_PROMPT}` : ""}`,
model,
tools: allowWrite
? [hospitalInfoListTool, hospitalInfoQueryTool, hospitalInfoSetTool]
: [hospitalInfoListTool, hospitalInfoQueryTool],
});