mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
fix/refac: use ollama /api/chat endpoint for tasks
This commit is contained in:
14
backend/open_webui/utils/response.py
Normal file
14
backend/open_webui/utils/response.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from open_webui.utils.task import prompt_template
|
||||
from open_webui.utils.misc import (
|
||||
openai_chat_completion_message_template,
|
||||
)
|
||||
|
||||
from typing import Callable, Optional
|
||||
|
||||
|
||||
def convert_response_ollama_to_openai(ollama_response: dict) -> dict:
|
||||
model = ollama_response.get("model", "ollama")
|
||||
message_content = ollama_response.get("message", {}).get("content", "")
|
||||
|
||||
response = openai_chat_completion_message_template(model, message_content)
|
||||
return response
|
||||
Reference in New Issue
Block a user