diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index b46fbb37d..289d887df 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -253,8 +253,8 @@ async def chat_completion_tools_handler( log.debug(f"tool_contexts: {sources}") - if skip_files and "files" in body: - del body["files"] + if skip_files and "files" in body.get("metadata", {}): + del body["metadata"]["files"] return body, {"sources": sources}