diff --git a/index.html b/index.html index f767482..25daf9d 100644 --- a/index.html +++ b/index.html @@ -53,7 +53,7 @@ let mediaRecorder, audioChunks = [], userAudioBlob = null, ttsText = ''; let isRecording = false, isAnalyzing = false, micAnalyser = null, micAnimId = null; let recordStartTime = 0, recordDuration = 0; // ---------- Версия ---------- -const VERSION = 'v50'; +const VERSION = 'v51'; document.getElementById('ver').textContent = VERSION; // ---------- Перевод на русский (Groq) ---------- @@ -660,7 +660,13 @@ async function transcribe(blob) { }; ws.onerror = () => { console.log('[WS] error'); clearTimeout(timeout); done({ text: '', error: 'network' }); }; - ws.onclose = (e) => { console.log('[WS] close code=' + e.code); clearTimeout(timeout); done({ text: '', error: 'network' }); }; + ws.onclose = (e) => { + console.log('[WS] close code=' + e.code); + // close может прийти раньше onmessage — даём фору 500ms + setTimeout(() => { + if (!settled) { clearTimeout(timeout); done({ text: '', error: 'network' }); } + }, 500); + }; }); }