[PR #9486] [MERGED] Use DB for generated images #61235

Closed
opened 2026-05-06 04:39:41 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/9486
Author: @rragundez
Created: 2/6/2025
Status: Merged
Merged: 2/12/2025
Merged by: @tjbck

Base: devHead: store-images


📝 Commits (8)

  • 159578d Enable usage of the DB to store generated images
  • 8d43fda Add functionality in other image generation types
  • ac33382 Set get_config as the name of the function
  • 7e97e9d Improve style
  • 4974c9c Refactor upload function
  • 312f273 Add extension to image filename
  • ffb9e73 Save image metadata to DB
  • 2b05c9d Move file metadata into the [meta][data] key

📊 Changes

2 files changed (+62 additions, -89 deletions)

View changed files

📝 backend/open_webui/routers/files.py (+16 -20)
📝 backend/open_webui/routers/images.py (+46 -69)

📄 Description

At the moment images generated have several issues:

  • they are not managed by any external source
  • their behaviour is different from other uploaded files
  • there is no auth checks for users and images are just passed to the src if the img tag from the cache dir so they are basically public
  • If multiple replicas since the logic depends on having them on disk it will fail to load since the image might have been written in a different replica when created.

This change makes the images to be treated exactly in the same way as upload files and backed up by the same mechanism.
All the logic is pushed to the already proven 'files.py' logic. With this change all the problems mentioned above should be solved.

I tested using dall-e-3 openai model.

related to: #5109 and #8186

cc @jk-f5


🔄 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/9486 **Author:** [@rragundez](https://github.com/rragundez) **Created:** 2/6/2025 **Status:** ✅ Merged **Merged:** 2/12/2025 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `store-images` --- ### 📝 Commits (8) - [`159578d`](https://github.com/open-webui/open-webui/commit/159578dfd41a5fc68ac6c7cfdcf0db837600fe35) Enable usage of the DB to store generated images - [`8d43fda`](https://github.com/open-webui/open-webui/commit/8d43fdadc17c6db83df4f474a505fae1f509e6ea) Add functionality in other image generation types - [`ac33382`](https://github.com/open-webui/open-webui/commit/ac3338265d224bbff2ed80310a7bd1bd4d763bed) Set get_config as the name of the function - [`7e97e9d`](https://github.com/open-webui/open-webui/commit/7e97e9dcc925dbe969190a510cf1b34bf9fdd1d7) Improve style - [`4974c9c`](https://github.com/open-webui/open-webui/commit/4974c9cbb08eb9efd998c5eeb5ba75af827306b3) Refactor upload function - [`312f273`](https://github.com/open-webui/open-webui/commit/312f273a1bf60f66089fbcd9f7ad225466419d30) Add extension to image filename - [`ffb9e73`](https://github.com/open-webui/open-webui/commit/ffb9e739753f1d096531d5084fc524e642744266) Save image metadata to DB - [`2b05c9d`](https://github.com/open-webui/open-webui/commit/2b05c9d944757600289c38b3d2fde88ebf19997e) Move file metadata into the [meta][data] key ### 📊 Changes **2 files changed** (+62 additions, -89 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/files.py` (+16 -20) 📝 `backend/open_webui/routers/images.py` (+46 -69) </details> ### 📄 Description At the moment images generated have several issues: - they are not managed by any external source - their behaviour is different from other uploaded files - there is no auth checks for users and images are just passed to the src if the img tag from the cache dir so they are basically public - If multiple replicas since the logic depends on having them on disk it will fail to load since the image might have been written in a different replica when created. This change makes the images to be treated exactly in the same way as upload files and backed up by the same mechanism. All the logic is pushed to the already proven 'files.py' logic. With this change all the problems mentioned above should be solved. I tested using dall-e-3 openai model. related to: #5109 and #8186 cc @jk-f5 --- <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-05-06 04:39:42 -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#61235