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

@@ -26,6 +26,7 @@ function genId(): string {
export default function Messages() {
const user = useAuthStore((s) => s.user);
const currentPatient = useAuthStore((s) => s.currentPatient);
const modeClass = useElderClass();
const [messages, setMessages] = useState<AiChatMessage[]>([]);
const [inputText, setInputText] = useState('');
@@ -70,7 +71,7 @@ export default function Messages() {
scrollToBottom(next);
try {
const resp = await sendAiMessage(content, next);
const resp = await sendAiMessage(content, next, currentPatient?.id);
const aiMsg: AiChatMessage = {
id: resp.message_id || genId(),
role: 'assistant',