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,