mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-08 21:09:41 -05:00
[PR #17744] [MERGED] Fix: Prevent RAG queries when all files are in full context #11328
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/17744
Author: @Classic298
Created: 9/25/2025
Status: ✅ Merged
Merged: 9/25/2025
Merged by: @tjbck
Base:
dev← Head:fix-rag-full-context📝 Commits (1)
4a7e1b9Fix: Prevent RAG queries when all files are in full context📊 Changes
1 file changed (+40 additions, -34 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+40 -34)📄 Description
This commit fixes an issue where Retrieval-Augmented Generation (RAG) queries were still being generated even when all attached files were set to 'full context' mode. This was inefficient as the full content of the files was already available to the model.
The
chat_completion_files_handlerinbackend/open_webui/utils/middleware.pyhas been updated to:context: 'full'property.generate_queriesstep if all files are in full context mode.full_context=Trueflag to theget_sources_from_itemsfunction to ensure it fetches the entire document content instead of performing a vector search.This change ensures that RAG queries are only generated when necessary, improving the efficiency of the system.
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.