[Frontend] Loosen Validation for TTS Models with No Uploaded Speakers (#5878)

Signed-off-by: Alex Brooks <albrooks@redhat.com>
This commit is contained in:
Alex Brooks authored and GitHub committed 2026-08-14 17:05:11 -06:00
1 parent 4b6d6d5cf7
commit fe54ecc388
4 files changed
+172 -13

No files matched your search

@@ -59,6 +59,16 @@ class OpenAICreateSpeechRequest(BaseModel):
validation_alias=AliasChoices("voice", "speaker"),
description="Speaker/voice to use. For Qwen3-TTS: vivian, ryan, aiden, etc.",
)
@field_validator("voice", mode="before")
@classmethod
def _normalize_voice(cls, voice: str | dict[str, str]) -> str:
if isinstance(voice, dict):
if "id" not in voice:
raise ValueError("voice dict must contain 'id'")
return voice["id"]
return voice
instructions: str | None = Field(
default=None,
description="Instructions for voice style/emotion (maps to 'instruct' for Qwen3-TTS)",