mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-17 15:53:59 -06:00
fix: JPEG and WebP images from a model are stored inside the chat instead of as files (#31975)
When a model returned an image, only PNG was saved as a file. JPEG and WebP images stayed as raw base64 data inside the chat in the database, so a 1.5 MB JPEG made the stored chat 1.5 MB larger. These images are now saved as files and the chat keeps only a link to them, the same way PNG already worked. Fixes #31916
This commit is contained in:
@@ -1766,7 +1766,7 @@ async def get_image_urls(delta_images, request, metadata, user) -> list[str]:
|
||||
if not url:
|
||||
continue
|
||||
|
||||
if url.startswith('data:image/png;base64'):
|
||||
if re.match(r'data:image/\w+;base64', url):
|
||||
url = await get_image_url_from_base64(request, url, metadata, user)
|
||||
|
||||
image_urls.append(url)
|
||||
|
||||
Reference in New Issue
Block a user