ソースを参照

refac: openai image async gen

Timothy J. Baek 7 ヶ月 前
コミット
d12b6cda4e
1 ファイル変更3 行追加1 行削除
  1. 3 1
      backend/open_webui/apps/images/main.py

+ 3 - 1
backend/open_webui/apps/images/main.py

@@ -470,7 +470,9 @@ async def image_generations(
                 "response_format": "b64_json",
             }
 
-            r = requests.post(
+            # Use asyncio.to_thread for the requests.post call
+            r = await asyncio.to_thread(
+                requests.post,
                 url=f"{app.state.config.OPENAI_API_BASE_URL}/images/generations",
                 json=data,
                 headers=headers,