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:
parent
8da98ce082
commit
d8f30b1df7
|
|
@ -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
|
||||
|
||||
|
||||
# ============================================================================
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in New Issue