From 95d6dd44ff4e79994022ead1eb6f79a91f053566 Mon Sep 17 00:00:00 2001 From: drascom Date: Mon, 6 Apr 2026 09:41:58 +0100 Subject: [PATCH] fix: Speaches STT service wiring * Fix Speaches STT service wiring * chore: bump pipecat submodule --------- Co-authored-by: drascom Co-authored-by: Abhishek Kumar --- api/services/pipecat/service_factory.py | 7 ++---- api/tests/test_speaches_service_factory.py | 28 ++++++++++++++++++++++ pipecat | 2 +- 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 api/tests/test_speaches_service_factory.py diff --git a/api/services/pipecat/service_factory.py b/api/services/pipecat/service_factory.py index 0a7a1e2..8b50bf3 100644 --- a/api/services/pipecat/service_factory.py +++ b/api/services/pipecat/service_factory.py @@ -145,12 +145,9 @@ def create_stt_service( sample_rate=audio_config.transport_in_sample_rate, ) elif user_config.stt.provider == ServiceProviders.SPEACHES.value: - base_url = user_config.stt.base_url.replace("http://", "ws://").replace( - "https://", "wss://" - ) - language = getattr(user_config.stt, "language", None) or "multi" + language = getattr(user_config.stt, "language", None) return SpeachesSTTService( - base_url=base_url, + base_url=user_config.stt.base_url, api_key=user_config.stt.api_key or "none", settings=SpeachesSTTSettings( model=user_config.stt.model, diff --git a/api/tests/test_speaches_service_factory.py b/api/tests/test_speaches_service_factory.py new file mode 100644 index 0000000..3c55b69 --- /dev/null +++ b/api/tests/test_speaches_service_factory.py @@ -0,0 +1,28 @@ +from types import SimpleNamespace +from unittest.mock import patch + +from api.services.configuration.registry import ServiceProviders +from api.services.pipecat.service_factory import create_stt_service + + +def test_create_speaches_stt_service_uses_http_base_url(): + user_config = SimpleNamespace( + stt=SimpleNamespace( + provider=ServiceProviders.SPEACHES.value, + base_url="http://localhost:9100/v1", + api_key=None, + model="Systran/faster-whisper-small", + language="tr", + ) + ) + audio_config = SimpleNamespace(transport_in_sample_rate=16000) + + with patch("api.services.pipecat.service_factory.SpeachesSTTService") as mock_service: + create_stt_service(user_config, audio_config) + + assert mock_service.call_count == 1 + kwargs = mock_service.call_args.kwargs + assert kwargs["base_url"] == "http://localhost:9100/v1" + assert kwargs["api_key"] == "none" + assert kwargs["settings"].model == "Systran/faster-whisper-small" + assert kwargs["settings"].language == "tr" diff --git a/pipecat b/pipecat index 43b231d..350ec06 160000 --- a/pipecat +++ b/pipecat @@ -1 +1 @@ -Subproject commit 43b231d8a8f30d1afacda6f35d334ef0efb223be +Subproject commit 350ec060a3cd9163a4afb8ed32e79f76f6659a07