From ed964260ba63672026cb2ed77465d959b233de57 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 16 Mar 2024 02:45:24 -0700 Subject: [PATCH] fix: openai urls issue --- backend/apps/openai/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/apps/openai/main.py b/backend/apps/openai/main.py index 375ed3f12..c5e5ab61e 100644 --- a/backend/apps/openai/main.py +++ b/backend/apps/openai/main.py @@ -111,6 +111,7 @@ async def speech(request: Request, user=Depends(get_verified_user)): headers["Authorization"] = f"Bearer {app.state.OPENAI_API_KEYS[idx]}" headers["Content-Type"] = "application/json" + r = None try: r = requests.post( url=f"{app.state.OPENAI_API_BASE_URLS[idx]}/audio/speech", @@ -218,6 +219,9 @@ async def get_models(url_idx: Optional[int] = None, user=Depends(get_current_use return models else: url = app.state.OPENAI_API_BASE_URLS[url_idx] + + r = None + try: r = requests.request(method="GET", url=f"{url}/models") r.raise_for_status() @@ -290,6 +294,8 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)): headers["Authorization"] = f"Bearer {key}" headers["Content-Type"] = "application/json" + r = None + try: r = requests.request( method=request.method,