mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-07 07:55:16 +02:00
feat: configurable ElevenLabs base URL for Data Residency (#278)
* feat: configurable ElevenLabs base URL for Data Residency (#269) Adds a `base_url` field to `ElevenlabsTTSConfiguration` so users on an ElevenLabs Data Residency plan (EU, etc.) can point Dograh at the regional endpoint instead of the hardcoded global one. Defaults to `https://api.elevenlabs.io`, preserving existing behaviour. The service factory rewrites the HTTP scheme to WSS when constructing the WebSocket TTS service. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix: fix drift --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f2cb6499e1
commit
7f0dac1ad5
3 changed files with 17 additions and 2 deletions
|
|
@ -443,6 +443,14 @@ class ElevenlabsTTSConfiguration(BaseServiceConfiguration):
|
|||
default="eleven_flash_v2_5",
|
||||
json_schema_extra={"examples": ELEVENLABS_TTS_MODELS},
|
||||
)
|
||||
base_url: str = Field(
|
||||
default="https://api.elevenlabs.io",
|
||||
description=(
|
||||
"ElevenLabs API base URL. Override to use a Data Residency endpoint "
|
||||
"(e.g. https://api.eu.residency.elevenlabs.io) for GDPR / HIPAA / "
|
||||
"regional compliance."
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
OPENAI_TTS_MODELS = ["gpt-4o-mini-tts"]
|
||||
|
|
|
|||
|
|
@ -247,9 +247,16 @@ def create_tts_service(user_config, audio_config: "AudioConfig"):
|
|||
voice_id = user_config.tts.voice.split(" - ")[1]
|
||||
except IndexError:
|
||||
voice_id = user_config.tts.voice
|
||||
# ElevenLabs TTS uses WebSocket. Users configure base_url with an HTTP
|
||||
# scheme (matching ElevenLabs documentation, e.g.
|
||||
# https://api.eu.residency.elevenlabs.io); rewrite it to the WS scheme.
|
||||
elevenlabs_url = user_config.tts.base_url.replace("https://", "wss://").replace(
|
||||
"http://", "ws://"
|
||||
)
|
||||
return ElevenLabsTTSService(
|
||||
reconnect_on_error=False,
|
||||
api_key=user_config.tts.api_key,
|
||||
url=elevenlabs_url,
|
||||
settings=ElevenLabsTTSSettings(
|
||||
voice=voice_id,
|
||||
model=user_config.tts.model,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# generated by datamodel-codegen:
|
||||
# filename: dograh-openapi-XXXXXX.json.OGVaBJhIgZ
|
||||
# timestamp: 2026-05-11T11:41:34+00:00
|
||||
# filename: dograh-openapi-XXXXXX.json.Zvc0Wos2dk
|
||||
# timestamp: 2026-05-12T13:08:52+00:00
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue