feat(ai): Day 5 — ChatResponse display_hints + Web RichMessage 渲染

- ChatResponse 增加 display_hints 字段,Orchestrator 收集 Tool 产生的 DisplayHint
- DisplayHint 实现 utoipa::ToSchema
- Web ChatResponse 类型同步,DisplayHint 8 种联合类型
- RichMessage 组件:InsightCard/RiskAlert/LabReportCard/TrendChart/PatientProfile/VitalCard
- AiSidebar 消息中渲染 display_hints 富消息
- 小程序 AiChatResponse 类型同步
This commit is contained in:
iven
2026-05-19 11:10:07 +08:00
parent 8064db3475
commit bcff978ea0
7 changed files with 266 additions and 8 deletions

View File

@@ -10,8 +10,19 @@ export interface AiChatMessage {
export interface AiChatResponse {
reply: string;
message_id: string;
display_hints?: DisplayHint[];
}
export type DisplayHint =
| { type: 'vital_card'; indicator_type: string; values: [string, number][]; unit: string }
| { type: 'lab_report_card'; report_date: string; abnormal_count: number }
| { type: 'action_confirm'; action_type: string; summary: string; confirm_payload: unknown }
| { type: 'risk_alert'; level: string; message: string }
| { type: 'trend_chart'; metrics: string[]; period: string; summary: string }
| { type: 'insight_card'; title: string; severity: string; items: string[] }
| { type: 'patient_profile'; chronic_conditions: string[]; medication_count: number }
| { type: 'text' };
/** 发送消息给 AI 客服 */
export async function sendAiMessage(
message: string,