From a9036484a92f674414742d01e9a4a4b723a9f3e7 Mon Sep 17 00:00:00 2001 From: Aric Lasry Date: Thu, 7 Mar 2024 15:01:02 +0100 Subject: [PATCH] Fix batchRenderUserMessages() type --- front/lib/api/assistant/conversation.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/front/lib/api/assistant/conversation.ts b/front/lib/api/assistant/conversation.ts index 78e8da5e186d..7fe83b8f2146 100644 --- a/front/lib/api/assistant/conversation.ts +++ b/front/lib/api/assistant/conversation.ts @@ -189,7 +189,9 @@ export async function deleteConversation( * Conversation Rendering */ -export async function batchRenderUserMessages(messages: Message[]) { +export async function batchRenderUserMessages( + messages: Message[] +): Promise<{ m: UserMessageType; rank: number; version: number }[]> { const userMessages = messages.filter( (m) => m.userMessage !== null && m.userMessage !== undefined ); @@ -241,14 +243,15 @@ export async function batchRenderUserMessages(messages: Message[]) { user: user ? { id: user.id, + createdAt: user.createdAt.getTime(), username: user.username, email: user.email, firstName: user.firstName, lastName: user.lastName, fullName: user.firstName + (user.lastName ? ` ${user.lastName}` : ""), + provider: user.provider, image: user.imageUrl, - workspaces: [], } : null, mentions: messageMentions.map((m) => { @@ -267,7 +270,7 @@ export async function batchRenderUserMessages(messages: Message[]) { email: userMessage.userContextEmail, profilePictureUrl: userMessage.userContextProfilePictureUrl, }, - }; + } satisfies UserMessageType; return { m, rank: message.rank, version: message.version }; }); }