[PR #21480] [CLOSED] fix: images send to models #26097

Closed
opened 2026-04-20 06:19:25 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/21480
Author: @Classic298
Created: 2/16/2026
Status: Closed

Base: devHead: fix-image-input


📝 Commits (1)

  • 687c06e fix: preserve image data when loading messages from DB (#155)

📊 Changes

1 file changed (+35 additions, -4 deletions)

View changed files

📝 backend/open_webui/utils/middleware.py (+35 -4)

📄 Description

The load_messages_from_db function replaces frontend-constructed messages with DB messages for tool call handling, but only keeps role/content/output fields, dropping the files array.

The frontend builds image_url content parts from message.files at request time. Since the DB stores content as plain text (not multipart arrays with image_url items), replacing messages causes all image data to be silently lost. Vision-capable models then receive no images.

Fix: reconstruct image_url content parts from the message's files array when loading from DB, matching the frontend's behavior.

Fixes #21477, #21457

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.

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/21480 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 2/16/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix-image-input` --- ### 📝 Commits (1) - [`687c06e`](https://github.com/open-webui/open-webui/commit/687c06ec11d9f536fd2bd07f4b24c62afa5e9b09) fix: preserve image data when loading messages from DB (#155) ### 📊 Changes **1 file changed** (+35 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/utils/middleware.py` (+35 -4) </details> ### 📄 Description The load_messages_from_db function replaces frontend-constructed messages with DB messages for tool call handling, but only keeps role/content/output fields, dropping the files array. The frontend builds image_url content parts from message.files at request time. Since the DB stores content as plain text (not multipart arrays with image_url items), replacing messages causes all image data to be silently lost. Vision-capable models then receive no images. Fix: reconstruct image_url content parts from the message's files array when loading from DB, matching the frontend's behavior. Fixes #21477, #21457 ### Contributor License Agreement <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. --> By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 06:19:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#26097