api.py: return error_type=transcription_failed on Whisper crash, frontend retry logic can now distinguish from network failures
This commit is contained in:
+2
-2
@@ -659,7 +659,7 @@ async def transcribe_audio(request: Request, audio: UploadFile = File(...), auth
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
if os.path.exists(tmp_path):
|
if os.path.exists(tmp_path):
|
||||||
os.unlink(tmp_path)
|
os.unlink(tmp_path)
|
||||||
raise HTTPException(status_code=500, detail=str(e))
|
return JSONResponse({"ok": False, "error": str(e), "error_type": "transcription_failed"}, status_code=500)
|
||||||
|
|
||||||
@app.get("/api/dreamer/status")
|
@app.get("/api/dreamer/status")
|
||||||
async def dreamer_status(auth: str = Depends(require_auth)):
|
async def dreamer_status(auth: str = Depends(require_auth)):
|
||||||
@@ -872,7 +872,7 @@ Keep the full description to 150-250 words. Do not speculate beyond what is visi
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
if tmp_audio_path and os.path.exists(tmp_audio_path):
|
if tmp_audio_path and os.path.exists(tmp_audio_path):
|
||||||
os.unlink(tmp_audio_path)
|
os.unlink(tmp_audio_path)
|
||||||
raise HTTPException(status_code=500, detail=str(e))
|
return JSONResponse({"ok": False, "error": str(e), "error_type": "transcription_failed"}, status_code=500)
|
||||||
|
|
||||||
# ── Voice only ───────────────────────────────────────────────────────────
|
# ── Voice only ───────────────────────────────────────────────────────────
|
||||||
elif audio is not None:
|
elif audio is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user