Files
api_health/agent/subagent/hospital_info.js
T

43 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 获取完整信息。
- 列表结果里 parentId 为空的是总院,非空的是分院/院区;可用 hospital_info_list 的 parentId 参数只列某院院区。
- 需要按医院名称、简称、科室、医生名过滤时,直接用 hospital_info_query(hospitalName/department/doctorName)。
- 出诊信息等时效性数据必须注明信息更新时间,并提示用户以医院最新公告为准。
- 查不到的信息如实告知,禁止编造。`;
const MAINTAIN_PROMPT = `维护:
- 写入优先用 hospitalId 定位;只用名称时必须唯一命中,多命中会返回 candidates,先确认 id 再写。
- overview:医院级文本全量替换,写入前先查询现有内容,合并整理后整体写入,不得丢失原有信息。
- guides:场景键值对浅合并,新增场景直接传键值对;删除场景将值置为 null。
- photos/departments/doctors:列表按锚点操作,锚点为 照片=url、科室=name、医生=name+department;upsert 新增或整条更新,remove 删除。
- 科室、医生、就医信息都写入具体院区,不要写到总院再指望分院自动继承。
- doctors 的 detail 包含职称、擅长方向、号别(普通/专家/特需)、坐班与停诊安排。
- 尽量提供 updatedBy 记录操作人。图片只存 URL 链接,不负责图片上传。`;
/**
* @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],
});