fix(stt): flag empty transcripts as no_speech

An STT provider that hears no words is reporting silence, not failing.
ElevenLabs/xAI empty-transcript errors now carry no_speech so live
voice loops can re-listen quietly instead of surfacing an error on
every pause.
This commit is contained in:
Brooklyn Nicholson 2026-07-22 17:47:04 -05:00
parent 8da98ce082
commit d8f30b1df7
2 changed files with 4 additions and 0 deletions

View File

@ -1209,6 +1209,7 @@ class TestTranscribeXAI:
assert result["success"] is False
assert "empty transcript" in result["error"]
assert result["no_speech"] is True # live voice loops treat this as silence
def test_permission_error(self, monkeypatch, sample_ogg, mock_xai_http_module):
monkeypatch.setenv("XAI_API_KEY", "xai-test-key")
@ -1453,6 +1454,7 @@ class TestTranscribeElevenLabs:
assert result["success"] is False
assert "empty transcript" in result["error"]
assert result["no_speech"] is True # live voice loops treat this as silence
# ============================================================================

View File

@ -1546,6 +1546,7 @@ def _transcribe_xai(file_path: str, model_name: str) -> Dict[str, Any]:
"success": False,
"transcript": "",
"error": "xAI STT returned empty transcript",
"no_speech": True,
}
logger.info(
@ -1633,6 +1634,7 @@ def _transcribe_elevenlabs(file_path: str, model_name: str) -> Dict[str, Any]:
"success": False,
"transcript": "",
"error": "ElevenLabs STT returned empty transcript",
"no_speech": True,
}
logger.info(