fix: improve cleanup_response positioning for better resource management
Signed-off-by: Sihyeon Jang <sihyeon.jang@navercorp.com>
This commit is contained in:
@@ -184,7 +184,6 @@ async def send_post_request(
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
res = await r.json()
|
res = await r.json()
|
||||||
await cleanup_response(r, session)
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
except HTTPException as e:
|
except HTTPException as e:
|
||||||
@@ -196,6 +195,9 @@ async def send_post_request(
|
|||||||
status_code=r.status if r else 500,
|
status_code=r.status if r else 500,
|
||||||
detail=detail if e else "Open WebUI: Server Connection Error",
|
detail=detail if e else "Open WebUI: Server Connection Error",
|
||||||
)
|
)
|
||||||
|
finally:
|
||||||
|
if not stream:
|
||||||
|
await cleanup_response(r, session)
|
||||||
|
|
||||||
|
|
||||||
def get_api_key(idx, url, configs):
|
def get_api_key(idx, url, configs):
|
||||||
|
|||||||
Reference in New Issue
Block a user