Add voices endpoint (for support with OpenReader-WebUI) (#22)

This commit is contained in:
Richard Roberson 2025-04-11 21:50:08 -06:00 committed by GitHub
parent 21ec3c620e
commit a58d6edd79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

12
app.py
View file

@ -130,6 +130,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):