diff --git a/integrations/openclaw-athena-talk/dist/index.js b/integrations/openclaw-athena-talk/dist/index.js index 61742e7..f031f90 100644 --- a/integrations/openclaw-athena-talk/dist/index.js +++ b/integrations/openclaw-athena-talk/dist/index.js @@ -235,7 +235,11 @@ class AthenaTalkBridge { return; const frameBytes = 24000 * 2 / 50; for (let offset = 0; offset < pcm.length; offset += frameBytes) { + if (controller.signal.aborted || generation !== this.generation || !this.isConnected()) { + return; + } this.req.onAudio?.(pcm.subarray(offset, Math.min(offset + frameBytes, pcm.length))); + await new Promise((resolve) => setTimeout(resolve, 20)); } this.req.onResponseDone?.({ status: "completed", responseId }); this.req.onEvent?.({ direction: "server", type: "response.done", responseId }); diff --git a/integrations/openclaw-athena-talk/index.ts b/integrations/openclaw-athena-talk/index.ts index cbb2bfa..9e49751 100644 --- a/integrations/openclaw-athena-talk/index.ts +++ b/integrations/openclaw-athena-talk/index.ts @@ -243,7 +243,14 @@ class AthenaTalkBridge { if (generation !== this.generation || !this.isConnected()) return; const frameBytes = 24000 * 2 / 50; for (let offset = 0; offset < pcm.length; offset += frameBytes) { + if (controller.signal.aborted || generation !== this.generation || !this.isConnected()) { + return; + } this.req.onAudio?.(pcm.subarray(offset, Math.min(offset + frameBytes, pcm.length))); + // Gateway relay drops audio frames when its WebSocket queue is full. + // Pace 20 ms PCM frames in realtime instead of flooding the complete + // synthesized response into the socket in a few milliseconds. + await new Promise((resolve) => setTimeout(resolve, 20)); } this.req.onResponseDone?.({ status: "completed", responseId }); this.req.onEvent?.({ direction: "server", type: "response.done", responseId }); diff --git a/integrations/openclaw-athena-talk/openclaw.plugin.json b/integrations/openclaw-athena-talk/openclaw.plugin.json index c5e8a49..5160837 100644 --- a/integrations/openclaw-athena-talk/openclaw.plugin.json +++ b/integrations/openclaw-athena-talk/openclaw.plugin.json @@ -2,7 +2,7 @@ "id": "athena-talk", "name": "Athena Local Talk", "description": "Local German voice conversations through Athena without a public speech provider.", - "version": "0.1.0", + "version": "0.1.1", "enabledByDefault": true, "activation": { "onStartup": true, diff --git a/integrations/openclaw-athena-talk/package.json b/integrations/openclaw-athena-talk/package.json index 8333bc9..954d366 100644 --- a/integrations/openclaw-athena-talk/package.json +++ b/integrations/openclaw-athena-talk/package.json @@ -1,6 +1,6 @@ { "name": "openclaw-plugin-athena-talk", - "version": "0.1.0", + "version": "0.1.1", "description": "Private realtime Talk bridge for Athena STT, OpenClaw agent consult, and Athena TTS.", "type": "module", "private": true,