refac: feedback base_models
Some checks failed
Release / release (push) Has been cancelled
Deploy to HuggingFace Spaces / check-secret (push) Has been cancelled
Create and publish Docker images with specific build args / build-main-image (linux/amd64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-main-image (linux/arm64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64) (push) Has been cancelled
Python CI / Format Backend (3.11) (push) Has been cancelled
Frontend Build / Format & Build Frontend (push) Has been cancelled
Frontend Build / Frontend Unit Tests (push) Has been cancelled
Integration Test / Run Cypress Integration Tests (push) Has been cancelled
Integration Test / Run Migration Tests (push) Has been cancelled
Release to PyPI / release (push) Has been cancelled
Deploy to HuggingFace Spaces / deploy (push) Has been cancelled
Create and publish Docker images with specific build args / merge-main-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-cuda-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-ollama-images (push) Has been cancelled

This commit is contained in:
Timothy J. Baek 2024-10-28 15:19:02 -07:00
parent e03e22dd1f
commit 09935d191f

View File

@ -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(