mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-07 07:55:16 +02:00
chore: add language option for Rime
This commit is contained in:
parent
e255b33813
commit
e04ce4e852
2 changed files with 17 additions and 0 deletions
|
|
@ -591,6 +591,7 @@ class CambTTSConfiguration(BaseTTSConfiguration):
|
|||
|
||||
|
||||
RIME_TTS_MODELS = ["arcana", "mistv3", "mistv2", "mist"]
|
||||
RIME_TTS_LANGUAGES = ["en", "de", "fr", "es", "hi"]
|
||||
|
||||
|
||||
@register_tts
|
||||
|
|
@ -607,6 +608,10 @@ class RimeTTSConfiguration(BaseTTSConfiguration):
|
|||
speed: float = Field(
|
||||
default=1.0, ge=0.5, le=2.0, description="Speech speed multiplier"
|
||||
)
|
||||
language: str = Field(
|
||||
default="en",
|
||||
json_schema_extra={"examples": RIME_TTS_LANGUAGES, "allow_custom_input": True},
|
||||
)
|
||||
|
||||
|
||||
SPEACHES_TTS_MODELS = ["hexgrad/Kokoro-82M"]
|
||||
|
|
|
|||
|
|
@ -325,10 +325,22 @@ def create_tts_service(user_config, audio_config: "AudioConfig"):
|
|||
silence_time_s=1.0,
|
||||
)
|
||||
elif user_config.tts.provider == ServiceProviders.RIME.value:
|
||||
from pipecat.transcriptions.language import Language
|
||||
|
||||
speed = getattr(user_config.tts, "speed", None)
|
||||
language_code = getattr(user_config.tts, "language", None) or "en"
|
||||
rime_language_mapping = {
|
||||
"en": Language.EN,
|
||||
"de": Language.DE,
|
||||
"fr": Language.FR,
|
||||
"es": Language.ES,
|
||||
"hi": Language.HI,
|
||||
}
|
||||
pipecat_language = rime_language_mapping.get(language_code, Language.EN)
|
||||
settings_kwargs = {
|
||||
"voice": user_config.tts.voice,
|
||||
"model": user_config.tts.model,
|
||||
"language": pipecat_language,
|
||||
}
|
||||
if speed and speed != 1.0:
|
||||
settings_kwargs["speedAlpha"] = speed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue