Quellcode durchsuchen

fix url value when response contains url tag

When the response contains b64 json, the "url" tag still exists but comes as null, the logic is to resolve this point where it contains the url tag, but empty, thus directing to b64_json
Davi S. Zucon vor 7 Monaten
Ursprung
Commit
846509bf9f
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      backend/open_webui/routers/images.py

+ 2 - 2
backend/open_webui/routers/images.py

@@ -517,9 +517,9 @@ async def image_generations(
             images = []
 
             for image in res["data"]:
-                if "url" in image:
+                if image_url := image.get("url",None):
                     image_data, content_type = load_url_image_data(
-                        image["url"], headers
+                        image_url, headers
                     )
                 else:
                     image_data, content_type = load_b64_image_data(image["b64_json"])