Add voices endpoint (for support with OpenReader-WebUI)

This commit is contained in:
Richard Roberson 2025-03-27 03:29:02 -06:00
parent 0be7a9d0d7
commit 621b931a1a

12
app.py
View file

@ -114,6 +114,18 @@ async def create_speech_api(request: SpeechRequest):
filename=f"{request.voice}_{timestamp}.wav"
)
@app.get("/v1/audio/voices")
async def list_voices():
"""Return list of available voices"""
if not AVAILABLE_VOICES or len(AVAILABLE_VOICES) == 0:
raise HTTPException(status_code=404, detail="No voices available")
return JSONResponse(
content={
"status": "ok",
"voices": AVAILABLE_VOICES
}
)
# Legacy API endpoint for compatibility
@app.post("/speak")
async def speak(request: Request):