fix: disable STT retries and stop continuous mode after 3 silent cycles
- Set max_retries=0 on the STT OpenAI client. The SDK default (2) honors Groq's retry-after header (often 53s), blocking the thread for up to ~106s on rate limits. Voice STT should fail fast, not retry silently. - Stop continuous recording mode after 3 consecutive no-speech cycles to prevent infinite restart loops when nobody is talking.
This commit is contained in:
parent
0a89933f9b
commit
c3dc4448bf
2 changed files with 12 additions and 1 deletions
|
|
@ -150,7 +150,7 @@ def transcribe_audio(file_path: str, model: Optional[str] = None) -> Dict[str, A
|
|||
try:
|
||||
from openai import OpenAI, APIError, APIConnectionError, APITimeoutError
|
||||
|
||||
client = OpenAI(api_key=api_key, base_url=base_url, timeout=30)
|
||||
client = OpenAI(api_key=api_key, base_url=base_url, timeout=30, max_retries=0)
|
||||
|
||||
with open(file_path, "rb") as audio_file:
|
||||
transcription = client.audio.transcriptions.create(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue