Parcourir la source

Update payload.py

Fixes ollama native tool calling because native tool calling content will be str '', and tool call processing will be completely ignored.
hopeless il y a 2 mois
Parent
commit
7bfa29fa81
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      backend/open_webui/utils/payload.py

+ 1 - 1
backend/open_webui/utils/payload.py

@@ -124,7 +124,7 @@ def convert_messages_openai_to_ollama(messages: list[dict]) -> list[dict]:
         tool_call_id = message.get("tool_call_id", None)
 
         # Check if the content is a string (just a simple message)
-        if isinstance(content, str):
+        if isinstance(content, str) and not tool_calls:
             # If the content is a string, it's pure text
             new_message["content"] = content