mirror of
https://github.com/open-webui/open-webui
synced 2024-11-24 21:13:59 +00:00
delete keys if envvars are set
This commit is contained in:
parent
a4a7d678f9
commit
18965dcdac
@ -732,11 +732,10 @@ async def generate_chat_completion(
|
|||||||
):
|
):
|
||||||
log.debug(f"{form_data.model_dump_json(exclude_none=True).encode()}=")
|
log.debug(f"{form_data.model_dump_json(exclude_none=True).encode()}=")
|
||||||
|
|
||||||
payload = {
|
payload = {**form_data.model_dump(exclude_none=True)}
|
||||||
**form_data.model_dump(exclude_none=True, exclude=["metadata"]),
|
for key in ["metadata", "files", "tool_ids"]:
|
||||||
}
|
if key in payload:
|
||||||
if "metadata" in payload:
|
del payload[key]
|
||||||
del payload["metadata"]
|
|
||||||
|
|
||||||
model_id = form_data.model
|
model_id = form_data.model
|
||||||
model_info = Models.get_model_by_id(model_id)
|
model_info = Models.get_model_by_id(model_id)
|
||||||
|
@ -453,7 +453,7 @@ async def chat_completion_tools_handler(
|
|||||||
contexts.append(tool_output)
|
contexts.append(tool_output)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error: {e}")
|
log.exception(f"Error: {e}")
|
||||||
content = None
|
content = None
|
||||||
|
|
||||||
log.debug(f"tool_contexts: {contexts}")
|
log.debug(f"tool_contexts: {contexts}")
|
||||||
@ -997,6 +997,10 @@ async def generate_chat_completions(form_data: dict, user=Depends(get_verified_u
|
|||||||
|
|
||||||
if model.get("pipe"):
|
if model.get("pipe"):
|
||||||
return await generate_function_chat_completion(form_data, user=user)
|
return await generate_function_chat_completion(form_data, user=user)
|
||||||
|
|
||||||
|
for key in ["tool_ids", "files"]:
|
||||||
|
if key in form_data:
|
||||||
|
del form_data[key]
|
||||||
if model["owned_by"] == "ollama":
|
if model["owned_by"] == "ollama":
|
||||||
return await generate_ollama_chat_completion(form_data, user=user)
|
return await generate_ollama_chat_completion(form_data, user=user)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user