mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-14 13:25:20 +00:00
解决: "Unrecognized request arguments supplied: is_user_model, variables",即往 payload 中塞入 API 预料外的参数,导致 openAI API调用报错
This commit is contained in:
parent
f112cd3ced
commit
462c575452
1 changed files with 16 additions and 0 deletions
|
|
@ -1007,6 +1007,22 @@ async def generate_chat_completion(
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug(f"chatting_completion 钩子执行失败: {e}")
|
log.debug(f"chatting_completion 钩子执行失败: {e}")
|
||||||
|
|
||||||
|
|
||||||
|
# 移除上游不识别的内部参数
|
||||||
|
for key in [
|
||||||
|
"is_user_model",
|
||||||
|
"variables",
|
||||||
|
"model_item",
|
||||||
|
"background_tasks",
|
||||||
|
"chat_id",
|
||||||
|
"id",
|
||||||
|
"message_id",
|
||||||
|
"session_id",
|
||||||
|
"filter_ids",
|
||||||
|
"tool_servers",
|
||||||
|
]:
|
||||||
|
payload.pop(key, None)
|
||||||
|
|
||||||
payload = json.dumps(payload) # 序列化为 JSON 字符串
|
payload = json.dumps(payload) # 序列化为 JSON 字符串
|
||||||
|
|
||||||
# === 11. 初始化请求状态变量 ===
|
# === 11. 初始化请求状态变量 ===
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue