From 55e6b3252bf212969b78b866ef3b9379236f6a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Font=20Mu=C3=B1iz?= <91348432+AleDev11@users.noreply.github.com> Date: Fri, 25 Sep 2026 23:09:12 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20no=20mostrar=20el=20aviso=20de=20ElevenL?= =?UTF-8?q?abs=20al=20detener=20la=20grabaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/index.ts | 2 ++ src/main/transcription/elevenlabs.ts | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/index.ts b/src/main/index.ts index e393456..f2291a2 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -166,6 +166,8 @@ function startRecording(meetingId: string, channels: AudioChannel[], withScreen }, onStatus: (status) => emitLive({ type: 'status', channel, status }), onError: (message) => { + // Mensajes de una sesión que ya se cerró (p. ej. al detener): no afectan a nada. + if (rec !== r) return if (!isFatalLive(message)) return emitLive({ type: 'error', message }) const provider = LIVE_NAMES[liveProviderFor(settings)] ?? settings.liveProvider emitLive({ diff --git a/src/main/transcription/elevenlabs.ts b/src/main/transcription/elevenlabs.ts index 8e0f9dc..405e5ef 100644 --- a/src/main/transcription/elevenlabs.ts +++ b/src/main/transcription/elevenlabs.ts @@ -73,6 +73,8 @@ export function elevenLabsLive(o: LiveOptions, cb: LiveCallbacks): LiveSession { case 'session_started': case 'committed_transcript_entities': case 'warning': + // Aviso de que no había audio pendiente al cerrar: no es un error. + case 'commit_throttled': break default: if (msg.error || msg.message) cb.onError(`ElevenLabs (${msg.message_type}): ${msg.error ?? msg.message}`) @@ -101,7 +103,8 @@ export function elevenLabsLive(o: LiveOptions, cb: LiveCallbacks): LiveSession { }, stop() { if (ws.readyState === WebSocket.OPEN) { - ws.send(chunk(new Uint8Array(0), true)) + // ElevenLabs exige al menos 0,3 s sin confirmar para cerrar el último fragmento. + if (bytesSent / BYTES_PER_SECOND - lastCommit >= 0.3) ws.send(chunk(new Uint8Array(0), true)) setTimeout(() => ws.close(), 1500) } else ws.terminate() }