From 0504c6009cd9d2ff84bf2da9a73dbfda77881255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Fri, 22 May 2026 17:20:25 +0400 Subject: [PATCH] =?UTF-8?q?v51:=20onclose=20=D0=B4=D0=B0=D1=91=D1=82=20500?= =?UTF-8?q?ms=20=D1=84=D0=BE=D1=80=D1=83=20onmessage=20=E2=80=94=20close?= =?UTF-8?q?=20frame=20=D0=BE=D0=B1=D0=B3=D0=BE=D0=BD=D1=8F=D0=BB=20text=20?= =?UTF-8?q?frame?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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); + }; }); }