Merge remote-tracking branch 'refs/remotes/origin/main'

This commit is contained in:
Magzhan Zhumabayev
2026-05-01 18:08:56 +05:00
10 changed files with 87 additions and 26 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ def _build_single_stt_provider(
) -> BaseSTT:
normalized = provider.lower().strip()
if normalized in {"openai", "whisper", "openai_whisper"}:
# Whisper accepts an 8 kHz WAV container; keep the exact AudioSocket PCM, no resampling.
# Whisper accepts the configured WAV container; keep the exact AudioSocket PCM, no resampling.
return OpenAISTT(input_sample_rate_hz=input_sample_rate_hz)
if normalized in {"elevenlabs", "eleven_labs", "scribe"}:
return ElevenLabsSTT(
+2 -2
View File
@@ -1010,8 +1010,8 @@ class YandexSpeechKitSTT(BaseSTT):
api_base: str | None = None,
language: str | None = None,
topic: str | None = None,
input_sample_rate_hz: int = 8000,
target_sample_rate_hz: int = 8000,
input_sample_rate_hz: int = 16000,
target_sample_rate_hz: int = 16000,
timeout_seconds: float | None = None,
) -> None:
self._api_key = str(api_key if api_key is not None else _yandex_api_key()).strip()
+1 -1
View File
@@ -79,7 +79,7 @@ class OpenAISTT(BaseSTT):
api_key: str | None = None,
model: str | None = None,
base_url: str | None = None,
input_sample_rate_hz: int = 8000,
input_sample_rate_hz: int = 16000,
prompt: str | None = None,
language: str | None = None,
timeout_seconds: float | None = None,
+6 -3
View File
@@ -119,11 +119,15 @@ class ElevenLabsTTS(BaseTTS):
str(output_format or os.getenv("ELEVENLABS_TTS_OUTPUT_FORMAT", "pcm_16000")).strip().lower()
or "pcm_16000"
)
requested_sample_rate_hz = _sample_rate_from_pcm_format(requested_output_format)
self._target_sample_rate_hz = int(
target_sample_rate_hz
if target_sample_rate_hz is not None
else (_sample_rate_from_pcm_format(requested_output_format) or 16000)
else (requested_sample_rate_hz or 16000)
)
if self._target_sample_rate_hz == 8000:
LOGGER.warning("ElevenLabs TTS target sample rate 8000Hz is disabled; using 16000Hz")
self._target_sample_rate_hz = 16000
self._output_format = self._resolve_provider_output_format(
requested_output_format=requested_output_format,
target_sample_rate_hz=self._target_sample_rate_hz,
@@ -381,8 +385,7 @@ class ElevenLabsTTS(BaseTTS):
normalized = requested_output_format.strip().lower() or "pcm_16000"
if normalized == "pcm_8000":
LOGGER.warning(
"ElevenLabs TTS does not provide reliable PCM16 8kHz streaming; requesting pcm_16000 "
"and resampling to %sHz locally",
"ElevenLabs TTS PCM16 8kHz output is disabled; requesting pcm_16000 for %sHz target",
target_sample_rate_hz,
)
return "pcm_16000"