open-webui/backend/open_webui
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
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal refac 2026-03-17 17:58:01 -05:00
migrations refac 2026-03-17 17:58:01 -05:00
models refac 2026-03-24 20:48:10 -05:00
retrieval chore: format 2026-03-25 16:43:06 -05:00
routers chore: format 2026-03-25 16:43:06 -05:00
socket refac 2026-03-24 04:49:48 -05:00
static refac 2026-03-23 23:39:52 -05:00
storage refac 2026-03-17 17:58:01 -05:00
test refac 2026-03-17 17:58:01 -05:00
tools chore: format 2026-03-24 06:07:20 -05:00
utils fix: align file context injection by user-role messages for native FC (#22776) 2026-03-25 16:56:43 -05:00
__init__.py refac (#22987) 2026-03-24 15:41:26 -05:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py chore: format 2026-03-25 16:43:06 -05:00
constants.py refac 2026-03-17 17:58:01 -05:00
env.py refac 2026-03-23 20:42:48 -05:00
functions.py refac 2026-03-17 17:58:01 -05:00
main.py feat: oauth 2.1 static mcp 2026-03-24 17:58:21 -05:00
tasks.py refac 2026-03-17 17:58:01 -05:00