fix: propagate STT disable through shared transcription config

- add stt.enabled to the default user config
- make transcription_tools respect the disabled flag globally
- surface disabled state cleanly in voice mode diagnostics
- add regression coverage for disabled STT provider selection
This commit is contained in:
teknium1 2026-03-14 22:09:59 -07:00
parent c36136084a
commit f8ceadbad0
4 changed files with 47 additions and 5 deletions

View file

@ -59,6 +59,10 @@ class TestGetProvider:
from tools.transcription_tools import _get_provider
assert _get_provider({}) == "local"
def test_disabled_config_returns_none(self):
from tools.transcription_tools import _get_provider
assert _get_provider({"enabled": False, "provider": "openai"}) == "none"
# ---------------------------------------------------------------------------
# File validation
@ -217,6 +221,18 @@ class TestTranscribeAudio:
assert result["success"] is False
assert "No STT provider" in result["error"]
def test_disabled_config_returns_disabled_error(self, tmp_path):
audio_file = tmp_path / "test.ogg"
audio_file.write_bytes(b"fake audio")
with patch("tools.transcription_tools._load_stt_config", return_value={"enabled": False}), \
patch("tools.transcription_tools._get_provider", return_value="none"):
from tools.transcription_tools import transcribe_audio
result = transcribe_audio(str(audio_file))
assert result["success"] is False
assert "disabled" in result["error"].lower()
def test_invalid_file_returns_error(self):
from tools.transcription_tools import transcribe_audio
result = transcribe_audio("/nonexistent/file.ogg")