feat: integrate faster-whisper local STT with three-provider fallback

Merge main's faster-whisper (local, free) with our Groq support into a
unified three-provider STT pipeline: local > groq > openai.

Provider priority ensures free options are tried first. Each provider
has its own transcriber function with model auto-correction, env-
overridable endpoints, and proper error handling.

74 tests cover the full provider matrix, fallback chains, model
correction, config loading, validation edge cases, and dispatch.
This commit is contained in:
0xbyt4 2026-03-13 23:33:16 +03:00
parent c433c89d7d
commit b8f8d3ef9e
6 changed files with 907 additions and 264 deletions

View file

@ -438,11 +438,14 @@ class TestTranscriptionGroqFallback:
assert "not found" in result.get("error", "").lower()
@patch.dict(os.environ, {}, clear=True)
def test_no_key_returns_error(self):
def test_no_key_returns_error(self, tmp_path):
audio_file = tmp_path / "test.ogg"
audio_file.write_bytes(b"fake audio data")
from tools.transcription_tools import transcribe_audio
result = transcribe_audio("/nonexistent/audio.mp3")
with patch("tools.transcription_tools._HAS_FASTER_WHISPER", False):
result = transcribe_audio(str(audio_file))
assert result["success"] is False
assert "not set" in result.get("error", "").lower() or "GROQ" in result.get("error", "")
assert "no stt provider" in result.get("error", "").lower()
# ===========================================================================