mirror of
https://github.com/open-webui/open-webui
synced 2024-11-24 21:13:59 +00:00
Return a dict from get_available_voices
This commit is contained in:
parent
59d2c670ba
commit
4560f3b1ae
@ -459,16 +459,18 @@ async def get_models(user=Depends(get_verified_user)):
|
|||||||
return {"models": get_available_models()}
|
return {"models": get_available_models()}
|
||||||
|
|
||||||
|
|
||||||
def get_available_voices() -> list[dict]:
|
def get_available_voices() -> dict:
|
||||||
|
"""Returns {voice_id: voice_name} dict"""
|
||||||
|
ret = {}
|
||||||
if app.state.config.TTS_ENGINE == "openai":
|
if app.state.config.TTS_ENGINE == "openai":
|
||||||
return [
|
ret = {
|
||||||
{"name": "alloy", "id": "alloy"},
|
"alloy": "alloy",
|
||||||
{"name": "echo", "id": "echo"},
|
"echo": "echo",
|
||||||
{"name": "fable", "id": "fable"},
|
"fable": "fable",
|
||||||
{"name": "onyx", "id": "onyx"},
|
"onyx": "onyx",
|
||||||
{"name": "nova", "id": "nova"},
|
"nova": "nova",
|
||||||
{"name": "shimmer", "id": "shimmer"},
|
"shimmer": "shimmer",
|
||||||
]
|
}
|
||||||
elif app.state.config.TTS_ENGINE == "elevenlabs":
|
elif app.state.config.TTS_ENGINE == "elevenlabs":
|
||||||
try:
|
try:
|
||||||
ret = get_elevenlabs_voices()
|
ret = get_elevenlabs_voices()
|
||||||
@ -513,4 +515,4 @@ def get_elevenlabs_voices() -> dict:
|
|||||||
|
|
||||||
@app.get("/voices")
|
@app.get("/voices")
|
||||||
async def get_voices(user=Depends(get_verified_user)):
|
async def get_voices(user=Depends(get_verified_user)):
|
||||||
return {"voices": get_available_voices()}
|
return {"voices": [{"id": k, "name": v} for k, v in get_available_voices().items()]}
|
||||||
|
Loading…
Reference in New Issue
Block a user