feat(ai): Phase 1A 收尾 — 用量记录 + 健康摘要端点 + 小程序组件
- chat_handler 添加 log_usage 精确记录 token 消耗(provider + model) - SSE build_sse_stream 添加估算 token 用量记录(4 字符 ≈ 1 token) - 新增 GET /ai/health-summary 端点聚合患者洞察+分析记录 - 小程序 AiHealthSummaryCard 组件(风险等级+洞察统计+摘要列表) - 小程序 services/ai-analysis 新增 getHealthSummary API
This commit is contained in:
@@ -40,3 +40,29 @@ export async function listPendingSuggestions() {
|
||||
);
|
||||
return resp.data || [];
|
||||
}
|
||||
|
||||
// === 健康摘要 ===
|
||||
|
||||
export interface SummaryItem {
|
||||
category: string;
|
||||
title: string;
|
||||
severity: string | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface HealthSummary {
|
||||
patient_id: string;
|
||||
risk_level: string;
|
||||
active_insights_count: number;
|
||||
recent_analyses_count: number;
|
||||
latest_insight_title: string | null;
|
||||
latest_analysis_type: string | null;
|
||||
summary_items: SummaryItem[];
|
||||
}
|
||||
|
||||
export async function getHealthSummary(patientId: string) {
|
||||
return api.get<HealthSummary>(
|
||||
'/ai/health-summary',
|
||||
{ patient_id: patientId },
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user