31 lines
941 B
TypeScript
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,
|
|
},
|
|
],
|
|
});
|
|
}
|