feat(mp): AI 聊天传递 patient_id 支持体征数据查询 Tool Call

- ai-chat service: sendAiMessage 新增 patientId 可选参数
- messages 页面: 从 authStore 获取 currentPatient.id 传入

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
iven
2026-05-18 09:35:18 +08:00
parent 20714661d2
commit 38b0d91407
2 changed files with 9 additions and 3 deletions

View File

@@ -16,11 +16,16 @@ export interface AiChatResponse {
export async function sendAiMessage(
message: string,
history?: AiChatMessage[],
patientId?: string,
): Promise<AiChatResponse> {
const resp = await api.post<AiChatResponse>('/ai/chat', {
const body: Record<string, unknown> = {
message,
history: history?.slice(-10),
});
};
if (patientId) {
body.patient_id = patientId;
}
const resp = await api.post<AiChatResponse>('/ai/chat', body);
return resp;
}