open-webui/backend/open_webui/utils
Classic298 bfc606a9e3
fix: align file context injection by user-role messages for native FC (#22776)
The add_file_context function used a positional zip() to pair API
payload messages with DB-stored messages. After
process_messages_with_output() expands assistant messages containing
tool calls into multiple OpenAI-format messages (assistant + tool
results), the payload list becomes longer than the stored list. This
caused the zip to misalign, so subsequent user messages never received
their attached_files tags -- the model could see uploaded images via
vision but had no file URL to pass to edit_image.

Fix: filter both lists to user-role messages only before zipping.
User messages maintain the same order in both lists regardless of
assistant message expansion, restoring correct file context injection.

Fixes #21878
2026-03-25 16:56:43 -05:00
..
access_control chore: format 2026-03-24 06:07:20 -05:00
images refac 2026-03-17 17:58:01 -05:00
mcp refac 2026-03-17 17:58:01 -05:00
telemetry refac 2026-03-17 17:58:01 -05:00
actions.py refac 2026-03-17 17:58:01 -05:00
anthropic.py refac 2026-03-17 17:58:01 -05:00
audit.py refac 2026-03-17 17:58:01 -05:00
auth.py refac 2026-03-24 04:49:48 -05:00
channels.py refac 2026-03-17 17:58:01 -05:00
chat.py refac 2026-03-25 02:49:34 -05:00
code_interpreter.py refac 2026-03-17 17:58:01 -05:00
embeddings.py refac 2026-03-17 17:58:01 -05:00
files.py refac 2026-03-23 19:46:24 -05:00
filter.py perf: lookup 2026-03-24 16:24:46 -05:00
groups.py refac 2026-03-17 17:58:01 -05:00
headers.py refac 2026-03-17 17:58:01 -05:00
logger.py refac 2026-03-17 17:58:01 -05:00
middleware.py fix: align file context injection by user-role messages for native FC (#22776) 2026-03-25 16:56:43 -05:00
misc.py refac 2026-03-24 17:46:33 -05:00
models.py perf: lookup 2026-03-24 16:24:46 -05:00
oauth.py refac 2026-03-24 21:32:04 -05:00
payload.py refac 2026-03-24 04:49:48 -05:00
pdf_generator.py refac 2026-03-17 17:58:01 -05:00
plugin.py refac 2026-03-24 04:49:48 -05:00
rate_limit.py refac 2026-03-17 17:58:01 -05:00
redis.py refac 2026-03-24 04:49:48 -05:00
response.py refac 2026-03-24 04:49:48 -05:00
sanitize.py refac 2026-03-17 17:58:01 -05:00
security_headers.py refac 2026-03-17 17:58:01 -05:00
task.py refac 2026-03-24 04:49:48 -05:00
tools.py refac 2026-03-24 19:50:46 -05:00
validate.py refac 2026-03-17 17:58:01 -05:00
webhook.py refac 2026-03-24 04:49:48 -05:00