mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[GH-ISSUE #21457] issue: File context does not uses when no user message entered, but system prompt exists. #35016
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?
Originally created by @Creearc on GitHub (Feb 16, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21457
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.8.1
Ollama Version (if applicable)
No response
Operating System
Ubuntu 22.04
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
The model should use the attached document as context when a system promp exists and no user message provided.
Actual Behavior
The model fails to use the attached document as context when only a system prompt is provided without an accompanying user message.
Steps to Reproduce
To reproduce that you should create model with system prompt, load file with some information (in my case it was trinscribed audio) and press Enter to send message to model (with no text in message). Model will anwer that it has no files context.
Logs & Screenshots
Model config:

Model answer:

File content:

Additional Information
The problem is with middleware.py it has a couple of checks wich does not add file content to context if no text in last user message provided.
@Steve-Li-1998 commented on GitHub (Feb 16, 2026):
I’m using an external API, but it seems that regardless of whether I provide a prompt, the attachment isn’t being correctly sent to the model based on the token consumption.
@Steve-Li-1998 commented on GitHub (Feb 16, 2026):
@Steve-Li-1998 commented on GitHub (Feb 16, 2026):
And following is the performance of v0.8.1
@Classic298 commented on GitHub (Feb 16, 2026):
This is basically intended.
How should the RAG pipeline be able to generate RAG queries if you didnt provide any text? It can't.
Also many external models like Claude will simply error out if you send an empty message.
You should not send empty messages.
Leaving this open for @tjbck to see/triage.
@Creearc commented on GitHub (Feb 16, 2026):
Sounds reasonable. However, it doesn't work with cases where the model has a system prompt set in the Open WebUI configs that's already enough to handle the attached file without an extra message from the user.
@Creearc commented on GitHub (Feb 16, 2026):
I suggest that fix as a temporal decission: https://github.com/open-webui/open-webui/pull/21450
@Classic298 commented on GitHub (Feb 16, 2026):
No the system prompt is it's own message and it's own role
The user message with the file attached has no text because you sent no text.
Therefore the rag pipeline can't work with no text.
@Creearc commented on GitHub (Feb 16, 2026):
And why should user have to write text if system prompt contains something like: "Inspect attached file and make a summary"?
@Classic298 commented on GitHub (Feb 16, 2026):
because some APIs do not support empty user messages at all (you will get error) and because the system message is not used for RAG query generation - and should not be used for RAG query generation. You have a specific use case, but the general consensus is that using the system prompt for RAG doesnt make sense
"You are an helpful assistant
<30 rules>
..."
using a normal system prompt for RAG makes no sense
@Creearc what you COULD do: is build a filter and inject this message into the empty message text if you want
thats what we do to prevent users from sending empty messages
@Creearc commented on GitHub (Feb 16, 2026):
But in the latest version of Open WebUI, you can send an empty message with a file, and it will go to the LLM with no file context and no message. So I do not understand how it helps to avoid the problem of empty messages for some APIs.
@Classic298 commented on GitHub (Feb 16, 2026):
@Creearc it doesnt. and that's not open webui's job. Some APIs allow empty messages so Open WebUI should not block empty messages per defaultt
@Creearc commented on GitHub (Feb 16, 2026):
Ok) Why does Open WebUI clear the file context if the user message is empty? I’m totally confused...
@Classic298 commented on GitHub (Feb 16, 2026):
it doesnt clear it - it doesnt create it, since no message is there for rag query generation
@Steve-Li-1998 commented on GitHub (Feb 16, 2026):
However, not everyone uses RAG, and it seems that only the Claude models do not support image-only prompts. Most importantly, v0.8.2 appears to be unable to correctly handle attachments: even with text prompts, it fails to properly process images
@Steve-Li-1998 commented on GitHub (Feb 16, 2026):
You can compare my previous screenshots: when the image was successfully transmitted to the API provider (v0.8.1), the
prompt_tokenscount was 1929. However, in v0.8.2, with the exact same prompt, theprompt_tokenscount is only 1117. It looks like only the placeholder for the image was sent to the API provider, which is why the generated content has nothing to do with the image.@Steve-Li-1998 commented on GitHub (Feb 16, 2026):
I believe that for models with native function-calling support, RAG should be encapsulated within the tool invocation process. For models that do not support this, images can be sent directly to the worker model as-is. If the image contains query instructions and the worker model has visual capabilities, it would then generate the corresponding query commands automatically.
@Classic298 commented on GitHub (Feb 16, 2026):
@Steve-Li-1998 there was a bugfix in 0.8.0 where image data was sent twice accidentally, this was fixed
@Classic298 commented on GitHub (Feb 16, 2026):
This is still the case and did not change.
You are conflating issues here.
@Classic298 commented on GitHub (Feb 16, 2026):
This is what the file context toggle is for - if you have your own RAG tools you can use that. Open WebUI does not provide them by default (yet)
@Steve-Li-1998 commented on GitHub (Feb 16, 2026):
@Steve-Li-1998 commented on GitHub (Feb 16, 2026):
above: v0.8.2
below: v0.8.1
@Classic298 commented on GitHub (Feb 16, 2026):
interesting.
will take a look for images. this is not intended.
for files, my reasoning stays as above.
@Steve-Li-1998 commented on GitHub (Feb 16, 2026):
It seems that images should be treated as a special type of file.
@Classic298 commented on GitHub (Feb 16, 2026):
they are sent as base64 to the API. They are not treated as a file, and should not be.
@Classic298 commented on GitHub (Feb 16, 2026):
should be fixed in https://github.com/open-webui/open-webui/pull/21480
testing wanted
@Classic298 commented on GitHub (Feb 16, 2026):
f1053d94c7@systemslocalsplash commented on GitHub (Feb 21, 2026):
This is still happening on v0.8.3 I tried using a json file and it does not work unless I enter a text
is this by design
@systemslocalsplash commented on GitHub (Feb 21, 2026):
@Classic298 This is still happening on v0.8.3 I tried using a json file and it does not work unless I enter a text
is this by design
@Classic298 commented on GitHub (Feb 21, 2026):
@systemslocalsplash read the thread above. This is intended.