refac: images generation endpoint size field

This commit is contained in:
Timothy Jaeryang Baek 2025-08-19 23:14:41 +04:00
parent 7670543a39
commit 8eb5807c5f

View file

@ -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: