From 19f1286cc7ac5b984fe5e4264c21df8ac2ab0b43 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 16 Jul 2025 15:38:48 +0400 Subject: [PATCH] fix: emoji call --- backend/open_webui/routers/audio.py | 10 +++++++--- backend/open_webui/routers/tasks.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/routers/audio.py b/backend/open_webui/routers/audio.py index c63ad3bfe7..a9aa93e08a 100644 --- a/backend/open_webui/routers/audio.py +++ b/backend/open_webui/routers/audio.py @@ -376,9 +376,13 @@ async def speech(request: Request, user=Depends(get_verified_user)): if r is not None: status_code = r.status - res = await r.json() - if "error" in res: - detail = f"External: {res['error'].get('message', '')}" + + try: + res = await r.json() + if "error" in res: + detail = f"External: {res['error']}" + except Exception: + detail = f"External: {e}" raise HTTPException( status_code=status_code, diff --git a/backend/open_webui/routers/tasks.py b/backend/open_webui/routers/tasks.py index 3832c0306b..2dec218d92 100644 --- a/backend/open_webui/routers/tasks.py +++ b/backend/open_webui/routers/tasks.py @@ -695,11 +695,11 @@ async def generate_emoji( "max_completion_tokens": 4, } ), - "chat_id": form_data.get("chat_id", None), "metadata": { **(request.state.metadata if hasattr(request.state, "metadata") else {}), "task": str(TASKS.EMOJI_GENERATION), "task_body": form_data, + "chat_id": form_data.get("chat_id", None), }, }