mirror of
https://github.com/open-webui/open-webui
synced 2024-11-24 13:07:25 +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()}=")
|
||||
|
||||
payload = {
|
||||
**form_data.model_dump(exclude_none=True, exclude=["metadata"]),
|
||||
}
|
||||
if "metadata" in payload:
|
||||
del payload["metadata"]
|
||||
payload = {**form_data.model_dump(exclude_none=True)}
|
||||
for key in ["metadata", "files", "tool_ids"]:
|
||||
if key in payload:
|
||||
del payload[key]
|
||||
|
||||
model_id = form_data.model
|
||||
model_info = Models.get_model_by_id(model_id)
|
||||
|
@ -453,7 +453,7 @@ async def chat_completion_tools_handler(
|
||||
contexts.append(tool_output)
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
log.exception(f"Error: {e}")
|
||||
content = None
|
||||
|
||||
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"):
|
||||
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":
|
||||
return await generate_ollama_chat_completion(form_data, user=user)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user