From 513b6ac116cb344c486c68b53898a87e471f537c Mon Sep 17 00:00:00 2001 From: chenhang Date: Fri, 12 Jun 2026 15:19:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=BF=94=E5=9B=9E=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E9=97=B4=E6=88=B3=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/schemas/chat/chat_send_response.ts | 3 ++- src/stores/chat/chat-machine.actors.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/data/schemas/chat/chat_send_response.ts b/src/data/schemas/chat/chat_send_response.ts index 74dd4550..d022c9d5 100644 --- a/src/data/schemas/chat/chat_send_response.ts +++ b/src/data/schemas/chat/chat_send_response.ts @@ -15,7 +15,8 @@ export const ChatSendResponseSchema = z.object({ currentMood: z.string().default(""), messageId: z.string(), isGuest: z.boolean().default(false), - timestamp: z.number().default(0), + // 函数式 default —— 每次 parse 时**重新**调 Date.now()(后端不返回 timestamp 时用**当下**时间) + timestamp: z.number().default(() => Date.now()), }); export type ChatSendResponseInput = z.input; diff --git a/src/stores/chat/chat-machine.actors.ts b/src/stores/chat/chat-machine.actors.ts index b09a9bc4..b5d9fb78 100644 --- a/src/stores/chat/chat-machine.actors.ts +++ b/src/stores/chat/chat-machine.actors.ts @@ -68,6 +68,7 @@ export const sendMessageHttpActor = fromPromise< messageId: result.data.messageId, timestamp: result.data.timestamp, }); + const reply = sendResponseToUiMessage(result.data); console.log("[chat-machine] sendMessageHttpActor done", { replyContentLength: reply.content.length,