mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-22 08:38:13 +02:00
chore: fix dograh v2 speed option
This commit is contained in:
parent
c554256db1
commit
8006d0edcd
5 changed files with 100 additions and 30 deletions
|
|
@ -18,6 +18,9 @@ from api.services.configuration.registry import (
|
|||
TTSConfig,
|
||||
)
|
||||
|
||||
DOGRAH_SPEED_MIN = 0.5
|
||||
DOGRAH_SPEED_MAX = 2.0
|
||||
DOGRAH_SPEED_STEP = 0.1
|
||||
DOGRAH_SPEED_OPTIONS: tuple[float, ...] = (0.8, 1.0, 1.2)
|
||||
DOGRAH_DEFAULT_VOICE = "default"
|
||||
DOGRAH_DEFAULT_LANGUAGE = "multi"
|
||||
|
|
@ -49,16 +52,9 @@ class EffectiveAIModelConfiguration(BaseModel):
|
|||
class DograhManagedAIModelConfiguration(BaseModel):
|
||||
api_key: str
|
||||
voice: str = DOGRAH_DEFAULT_VOICE
|
||||
speed: float = Field(default=1.0)
|
||||
speed: float = Field(default=1.0, ge=DOGRAH_SPEED_MIN, le=DOGRAH_SPEED_MAX)
|
||||
language: str = DOGRAH_DEFAULT_LANGUAGE
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_speed(self):
|
||||
if self.speed not in DOGRAH_SPEED_OPTIONS:
|
||||
allowed = ", ".join(str(speed) for speed in DOGRAH_SPEED_OPTIONS)
|
||||
raise ValueError(f"Dograh speed must be one of: {allowed}")
|
||||
return self
|
||||
|
||||
|
||||
class BYOKPipelineAIModelConfiguration(BaseModel):
|
||||
llm: LLMConfig
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue