mirror of
https://github.com/open-webui/open-webui
synced 2025-01-30 14:29:55 +00:00
Sanitize voice_id
This commit is contained in:
parent
4560f3b1ae
commit
442f50303a
@ -254,6 +254,13 @@ async def speech(request: Request, user=Depends(get_verified_user)):
|
|||||||
raise HTTPException(status_code=400, detail="Invalid JSON payload")
|
raise HTTPException(status_code=400, detail="Invalid JSON payload")
|
||||||
|
|
||||||
voice_id = payload.get("voice", "")
|
voice_id = payload.get("voice", "")
|
||||||
|
|
||||||
|
if voice_id not in get_available_voices():
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=400,
|
||||||
|
detail="Invalid voice id",
|
||||||
|
)
|
||||||
|
|
||||||
url = f"https://api.elevenlabs.io/v1/text-to-speech/{voice_id}"
|
url = f"https://api.elevenlabs.io/v1/text-to-speech/{voice_id}"
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
|
Loading…
Reference in New Issue
Block a user