perf: keep the server responsive while photos are prepared for image editing (#35249)

When a photo is sent for an image edit, Open WebUI first rotates and re-encodes it so the provider sees it upright. That work stalled every other chat and request on the server for its full duration, about 130 ms per 12 MP photo and longer with each extra image in the request. It now runs without holding up other users, and the edited images are unchanged.

<table>
<tr><th>Request</th><th>Longest server stall before</th><th>After</th></tr>
<tr><td>1 photo (12 MP)</td><td>136 ms</td><td>23 ms</td></tr>
<tr><td>3 photos (12 MP)</td><td>377 ms</td><td>19 ms</td></tr>
</table>

Relates to #35245
This commit is contained in:
Classic298 authored and GitHub committed 2026-11-30 22:55:15 +04:00
1 parent 75ca922153
commit 555f5516b9
1 file changed
+2 -2
+2 -2
View File
@@ -990,12 +990,12 @@ async def image_edits(
if isinstance(form_data.image, str):
image = form_data.image
if ENABLE_OPENAI_IMAGE_EDIT_NORMALIZATION:
image = normalize_openai_edit_image_data_url(image)
image = await asyncio.to_thread(normalize_openai_edit_image_data_url, image)
files = [get_image_file_item(image)]
elif isinstance(form_data.image, list):
for img in form_data.image:
if ENABLE_OPENAI_IMAGE_EDIT_NORMALIZATION:
img = normalize_openai_edit_image_data_url(img)
img = await asyncio.to_thread(normalize_openai_edit_image_data_url, img)
files.append(get_image_file_item(img, 'image[]'))
url_search_params = ''