Bläddra i källkod

refac: images generation endpoint size field

Timothy Jaeryang Baek 1 månad sedan
förälder
incheckning
8eb5807c5f
1 ändrade filer med 9 tillägg och 5 borttagningar
  1. 9 5
      backend/open_webui/routers/images.py

+ 9 - 5
backend/open_webui/routers/images.py

@@ -483,11 +483,15 @@ async def image_generations(
     # if IMAGE_SIZE = 'auto', default WidthxHeight to the 512x512 default
     # This is only relevant when the user has set IMAGE_SIZE to 'auto' with an
     # image model other than gpt-image-1, which is warned about on settings save
-    width, height = (
-        tuple(map(int, request.app.state.config.IMAGE_SIZE.split("x")))
-        if "x" in request.app.state.config.IMAGE_SIZE
-        else (512, 512)
-    )
+
+    size = "512x512"
+    if "x" in request.app.state.config.IMAGE_SIZE:
+        size = request.app.state.config.IMAGE_SIZE
+
+    if "x" in form_data.size:
+        size = form_data.size
+
+    width, height = tuple(map(int, size.split("x")))
 
     r = None
     try: