mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
This commit is contained in:
parent
b7a91b1963
commit
a28bec865b
@ -222,7 +222,7 @@ def openai_chat_chunk_message_template(
|
|||||||
template["choices"][0]["delta"]["content"] = content
|
template["choices"][0]["delta"]["content"] = content
|
||||||
|
|
||||||
if reasoning_content:
|
if reasoning_content:
|
||||||
template["choices"][0]["delta"]["reasonsing_content"] = reasoning_content
|
template["choices"][0]["delta"]["reasoning_content"] = reasoning_content
|
||||||
|
|
||||||
if tool_calls:
|
if tool_calls:
|
||||||
template["choices"][0]["delta"]["tool_calls"] = tool_calls
|
template["choices"][0]["delta"]["tool_calls"] = tool_calls
|
||||||
|
@ -83,6 +83,7 @@ def convert_ollama_usage_to_openai(data: dict) -> dict:
|
|||||||
def convert_response_ollama_to_openai(ollama_response: dict) -> dict:
|
def convert_response_ollama_to_openai(ollama_response: dict) -> dict:
|
||||||
model = ollama_response.get("model", "ollama")
|
model = ollama_response.get("model", "ollama")
|
||||||
message_content = ollama_response.get("message", {}).get("content", "")
|
message_content = ollama_response.get("message", {}).get("content", "")
|
||||||
|
reasoning_content = ollama_response.get("message", {}).get("thinking", None)
|
||||||
tool_calls = ollama_response.get("message", {}).get("tool_calls", None)
|
tool_calls = ollama_response.get("message", {}).get("tool_calls", None)
|
||||||
openai_tool_calls = None
|
openai_tool_calls = None
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ def convert_response_ollama_to_openai(ollama_response: dict) -> dict:
|
|||||||
usage = convert_ollama_usage_to_openai(data)
|
usage = convert_ollama_usage_to_openai(data)
|
||||||
|
|
||||||
response = openai_chat_completion_message_template(
|
response = openai_chat_completion_message_template(
|
||||||
model, message_content, openai_tool_calls, usage
|
model, message_content, reasoning_content, openai_tool_calls, usage
|
||||||
)
|
)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user