From 9c107f9d2d4cd747d5831c9251c31c57bb0bb10f Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 3 Mar 2025 20:07:59 -0800 Subject: [PATCH] refac: images "url" fallback --- backend/open_webui/routers/images.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/routers/images.py b/backend/open_webui/routers/images.py index 131fa2df4..f8be93719 100644 --- a/backend/open_webui/routers/images.py +++ b/backend/open_webui/routers/images.py @@ -517,7 +517,13 @@ async def image_generations( images = [] for image in res["data"]: - image_data, content_type = load_b64_image_data(image["b64_json"]) + if "url" in image: + image_data, content_type = load_url_image_data( + image["url"], headers + ) + else: + image_data, content_type = load_b64_image_data(image["b64_json"]) + url = upload_image(request, data, image_data, content_type, user) images.append({"url": url}) return images