From 09935d191f34a35d81cc0fbd58b035e6e5068efc Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 28 Oct 2024 15:19:02 -0700 Subject: [PATCH] refac: feedback base_models --- .../chat/Messages/ResponseMessage.svelte | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte index 10d3b54de..6d987e8d5 100644 --- a/src/lib/components/chat/Messages/ResponseMessage.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage.svelte @@ -362,8 +362,6 @@ const messages = createMessagesList(history, message.id); - const baseModelId = $models.find((m) => m.id === message.model)?.info?.base_model_id ?? null; - let feedbackItem = { type: 'rating', data: { @@ -380,7 +378,6 @@ meta: { arena: message ? message.arena : false, model_id: message.model, - ...(baseModelId ? { base_model_id: baseModelId } : {}), message_id: message.id, message_index: messages.length, chat_id: chatId @@ -390,6 +387,21 @@ } }; + const baseModels = [ + feedbackItem.data.model_id, + ...(feedbackItem.data.sibling_model_ids ?? []) + ].reduce((acc, modelId) => { + const model = $models.find((m) => m.id === modelId); + if (model) { + acc[model.id] = model?.info?.base_model_id ?? null; + } else { + // Log or handle cases where corresponding model is not found + console.warn(`Model with ID ${modelId} not found`); + } + return acc; + }, {}); + feedbackItem.meta.base_models = baseModels; + let feedback = null; if (message?.feedbackId) { feedback = await updateFeedbackById(