mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 05:24:02 +00:00
fix: openai payload issue
This commit is contained in:
parent
19e49e43cb
commit
e35883ca9c
@ -411,7 +411,12 @@ async def generate_chat_completion(
|
|||||||
# Change max_completion_tokens to max_tokens (Backward compatible)
|
# Change max_completion_tokens to max_tokens (Backward compatible)
|
||||||
if "api.openai.com" not in url and not payload["model"].lower().startswith("o1-"):
|
if "api.openai.com" not in url and not payload["model"].lower().startswith("o1-"):
|
||||||
if "max_completion_tokens" in payload:
|
if "max_completion_tokens" in payload:
|
||||||
payload["max_tokens"] = payload.pop("max_completion_tokens")
|
# Remove "max_completion_tokens" from the payload
|
||||||
|
payload["max_tokens"] = payload["max_completion_tokens"]
|
||||||
|
del payload["max_completion_tokens"]
|
||||||
|
else:
|
||||||
|
if "max_tokens" in payload and "max_completion_tokens" in payload:
|
||||||
|
del payload["max_tokens"]
|
||||||
|
|
||||||
# Convert the modified body back to JSON
|
# Convert the modified body back to JSON
|
||||||
payload = json.dumps(payload)
|
payload = json.dumps(payload)
|
||||||
|
Loading…
Reference in New Issue
Block a user