chore: fix dograh v2 speed option

This commit is contained in:
Abhishek Kumar 2026-06-19 21:24:48 +05:30
parent c554256db1
commit 8006d0edcd
5 changed files with 100 additions and 30 deletions

View file

@ -16,7 +16,8 @@ from api.enums import OrganizationConfigurationKey
from api.schemas.ai_model_configuration import (
DOGRAH_DEFAULT_LANGUAGE,
DOGRAH_DEFAULT_VOICE,
DOGRAH_SPEED_OPTIONS,
DOGRAH_SPEED_MAX,
DOGRAH_SPEED_MIN,
BYOKAIModelConfiguration,
BYOKPipelineAIModelConfiguration,
BYOKRealtimeAIModelConfiguration,
@ -436,7 +437,11 @@ def _convert_any_dograh_legacy_configuration(
dograh_key: str,
) -> OrganizationAIModelConfigurationV2:
speed = getattr(configuration.tts, "speed", 1.0)
if speed not in DOGRAH_SPEED_OPTIONS:
try:
speed = float(speed)
except (TypeError, ValueError):
speed = 1.0
if not DOGRAH_SPEED_MIN <= speed <= DOGRAH_SPEED_MAX:
speed = 1.0
return OrganizationAIModelConfigurationV2(
mode="dograh",