ai-chatbot/lib/ai/runtime/assistant-message-persistence.ts
Your Name dfc5f704b4
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync latest app updates
2026-04-12 23:45:00 +08:00

31 lines
941 B
TypeScript

import { saveMessages } from "@/lib/db/queries";
export async function saveAssistantTextOnlyMessage(params: {
chatId: string;
messageId: string;
text: string;
videoStorageStatus?: "temporary" | "permanent" | "failed" | null;
temporaryVideoUrl?: string | null;
permanentVideoUrl?: string | null;
archivedAt?: Date | null;
videoMetadata?: Record<string, any> | null;
}) {
await saveMessages({
messages: [
{
id: params.messageId,
chatId: params.chatId,
role: "assistant",
parts: [{ type: "text", text: params.text }],
attachments: [],
createdAt: new Date(),
videoStorageStatus: params.videoStorageStatus ?? null,
temporaryVideoUrl: params.temporaryVideoUrl ?? null,
permanentVideoUrl: params.permanentVideoUrl ?? null,
archivedAt: params.archivedAt ?? null,
videoMetadata: params.videoMetadata ?? null,
},
],
});
}