mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #22330] [CLOSED] fix: preserve image files for display in temporary chat mode #42246
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/22330
Author: @Classic298
Created: 3/6/2026
Status: ❌ Closed
Base:
dev← Head:fix/temp-chat-image-display📝 Commits (1)
1057438fix: preserve image files for display in temporary chat mode📊 Changes
2 files changed (+13 additions, -6 deletions)
View changed files
📝
backend/open_webui/tools/builtin.py(+6 -2)📝
backend/open_webui/utils/middleware.py(+7 -4)📄 Description
fix: Preserve image files for display in temporary chat mode
Description
Fixes image generation not displaying in temporary chat mode when using builtin tools (native function calling).
Problem
When a model is configured with builtinTools image_generation (native function calling), generated images are never shown in temporary chat mode. The image is generated server-side but the frontend never receives the file event.
The root cause is that Chats.add_message_files_by_id_and_message_id() returns None when the chat doesn't exist in the database — which is always the case for temporary chats (chat IDs starting with "local:"). The code was directly overwriting the correctly-built image_files list with this None return value, causing the event emitter to either never fire (because None is falsy) or emit files: null.
This only affects the builtin tool code path (builtinTools.image_generation: true). The older capability-based path (capabilities.image_generation: true) is unaffected because it constructs and emits the file list directly without a DB round-trip.
Fix
Store the DB return value in a separate variable and only overwrite the image file list when the DB call returns a non-None result. Applied to three locations:
Fixes
Fixes #22309
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.