mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refactor: use cleanup_response on openai
Signed-off-by: Sihyeon Jang <sihyeon.jang@navercorp.com>
This commit is contained in:
parent
2470da8336
commit
17f0bef2e2
1 changed files with 6 additions and 12 deletions
|
|
@ -893,10 +893,8 @@ async def generate_chat_completion(
|
||||||
detail=detail if detail else "Open WebUI: Server Connection Error",
|
detail=detail if detail else "Open WebUI: Server Connection Error",
|
||||||
)
|
)
|
||||||
finally:
|
finally:
|
||||||
if not streaming and session:
|
if not streaming:
|
||||||
if r:
|
await cleanup_response(r, session)
|
||||||
r.close()
|
|
||||||
await session.close()
|
|
||||||
|
|
||||||
|
|
||||||
async def embeddings(request: Request, form_data: dict, user):
|
async def embeddings(request: Request, form_data: dict, user):
|
||||||
|
|
@ -975,10 +973,8 @@ async def embeddings(request: Request, form_data: dict, user):
|
||||||
detail=detail if detail else "Open WebUI: Server Connection Error",
|
detail=detail if detail else "Open WebUI: Server Connection Error",
|
||||||
)
|
)
|
||||||
finally:
|
finally:
|
||||||
if not streaming and session:
|
if not streaming:
|
||||||
if r:
|
await cleanup_response(r, session)
|
||||||
r.close()
|
|
||||||
await session.close()
|
|
||||||
|
|
||||||
|
|
||||||
@router.api_route("/{path:path}", methods=["GET", "POST", "PUT", "DELETE"])
|
@router.api_route("/{path:path}", methods=["GET", "POST", "PUT", "DELETE"])
|
||||||
|
|
@ -1074,7 +1070,5 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
|
||||||
detail=detail if detail else "Open WebUI: Server Connection Error",
|
detail=detail if detail else "Open WebUI: Server Connection Error",
|
||||||
)
|
)
|
||||||
finally:
|
finally:
|
||||||
if not streaming and session:
|
if not streaming:
|
||||||
if r:
|
await cleanup_response(r, session)
|
||||||
r.close()
|
|
||||||
await session.close()
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue