Merge pull request #6523 from open-webui/main
Some checks are pending
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Create and publish Docker images with specific build args / build-main-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Python CI / Format Backend (3.11) (push) Waiting to run
Frontend Build / Format & Build Frontend (push) Waiting to run
Frontend Build / Frontend Unit Tests (push) Waiting to run
Integration Test / Run Cypress Integration Tests (push) Waiting to run
Integration Test / Run Migration Tests (push) Waiting to run

refac: feedback base_models
This commit is contained in:
Timothy Jaeryang Baek 2024-10-28 15:21:07 -07:00 committed by GitHub
commit b36a1eef4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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(