diff --git a/backend/open_webui/routers/images.py b/backend/open_webui/routers/images.py index c51d2f996..275704f34 100644 --- a/backend/open_webui/routers/images.py +++ b/backend/open_webui/routers/images.py @@ -517,10 +517,8 @@ async def image_generations( images = [] for image in res["data"]: - if "url" in image: - image_data, content_type = load_url_image_data( - image["url"], headers - ) + if image_url := image.get("url", None): + image_data, content_type = load_url_image_data(image_url, headers) else: image_data, content_type = load_b64_image_data(image["b64_json"])