Add voices endpoint (for support with OpenReader-WebUI) (#22)
This commit is contained in:
parent
21ec3c620e
commit
a58d6edd79
1 changed files with 12 additions and 0 deletions
12
app.py
12
app.py
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue