fix:返回消息的时间戳错误问题

This commit is contained in:
2026-06-12 15:19:50 +08:00
parent d76b048bb9
commit 513b6ac116
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -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<typeof ChatSendResponseSchema>;
+1
View File
@@ -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,