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() }