fix: emoji call

This commit is contained in:
Timothy Jaeryang Baek 2025-07-16 15:38:48 +04:00
parent 82093cf690
commit 19f1286cc7
2 changed files with 8 additions and 4 deletions

View file

@ -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,

View file

@ -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),
},
}