From 8ba8786d6aaf2dccc10f03a3f6b229f0f958624f Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Thu, 3 Sep 2026 20:57:50 +0200 Subject: [PATCH] fix: pass file.meta through to vector DB chunks on file upload (#29499) Custom metadata attached to a file upload (e.g. via the API's metadata field) was stored on the file row but silently dropped when the file was chunked and embedded for RAG, so it never reached the LLM through retrieved sources. process_file() builds chunk metadata in several branches; three of them already merge the file's meta dict in, but the branch used for a fresh upload processed through a document loader did not. Bring it in line with the others so custom metadata flows through consistently regardless of upload path. Reported in open-webui/open-webui#29486. --- backend/open_webui/routers/retrieval.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/open_webui/routers/retrieval.py b/backend/open_webui/routers/retrieval.py index 6833d491db..a6435371c8 100644 --- a/backend/open_webui/routers/retrieval.py +++ b/backend/open_webui/routers/retrieval.py @@ -1967,6 +1967,7 @@ async def process_file( Document( page_content=doc.page_content, metadata={ + **file.meta, **filter_metadata(doc.metadata), 'name': file.filename, 'created_by': file.user_id,