mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-29 18:46:59 +00:00
feat(tts): pass lang_code to OpenAI-compatible TTS providers (Kokoro multilingual support)
The 'language' config field in tts.openai.language was read but never passed to the API. This caused Kokoro (and other OpenAI-compatible TTS backends that support lang_code) to default to English phonemization regardless of the configured language. Now passes lang_code via extra_body when language is set in config.
This commit is contained in:
parent
ce4e2e6102
commit
c0dda61032
1 changed files with 3 additions and 0 deletions
|
|
@ -1332,6 +1332,7 @@ def _generate_openai_tts(
|
|||
if speed is None:
|
||||
speed_default = tts_config.get("speed", 1.0) if isinstance(tts_config, dict) else 1.0
|
||||
speed = float(oai_config.get("speed", speed_default))
|
||||
language = oai_config.get("language")
|
||||
|
||||
# The managed OpenAI audio gateway only proxies MANAGED_OPENAI_TTS_MODELS.
|
||||
# A model set for direct OpenAI (e.g. "tts-1-hd") 400s there with
|
||||
|
|
@ -1367,6 +1368,8 @@ def _generate_openai_tts(
|
|||
create_kwargs["speed"] = max(0.25, min(4.0, speed))
|
||||
if instructions:
|
||||
create_kwargs["instructions"] = instructions
|
||||
if language:
|
||||
create_kwargs["extra_body"] = {"lang_code": language}
|
||||
response = client.audio.speech.create(**create_kwargs)
|
||||
|
||||
response.stream_to_file(output_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue