From 309cd645f13de63d36650293f1424195955168d5 Mon Sep 17 00:00:00 2001 From: Michael Poluektov Date: Thu, 8 Aug 2024 12:30:07 +0100 Subject: [PATCH] undo del --- backend/apps/ollama/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/apps/ollama/main.py b/backend/apps/ollama/main.py index 3d86b852a..d5ef82942 100644 --- a/backend/apps/ollama/main.py +++ b/backend/apps/ollama/main.py @@ -726,7 +726,8 @@ async def generate_chat_completion( payload = { **form_data.model_dump(exclude_none=True, exclude=["metadata"]), } - payload.pop("metadata", None) + if "metadata" in payload: + del payload["metadata"] model_id = form_data.model model_info = Models.get_model_by_id(model_id) @@ -785,7 +786,8 @@ async def generate_openai_chat_completion( ): completion_form = OpenAIChatCompletionForm(**form_data) payload = {**completion_form.model_dump(exclude_none=True, exclude=["metadata"])} - payload.pop("metadata", None) + if "metadata" in payload: + del payload["metadata"] model_id = completion_form.model model_info = Models.get_model_by_id(model_id)