From faf691f5b53cd95e56a9a51811f6518a4b9db4c9 Mon Sep 17 00:00:00 2001 From: sofly <9013581+sofly@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:31:23 +0000 Subject: [PATCH] feat: unsubscribe from all services on end conversation (COR-4408) (#500) We need to stop all voice services when server send the `end` message. Also we need to change UI state to show idle state. --- .../chat/src/views/VoiceWidget/services/voice.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/chat/src/views/VoiceWidget/services/voice.service.ts b/packages/chat/src/views/VoiceWidget/services/voice.service.ts index 8f640e301..1e7253937 100644 --- a/packages/chat/src/views/VoiceWidget/services/voice.service.ts +++ b/packages/chat/src/views/VoiceWidget/services/voice.service.ts @@ -64,11 +64,11 @@ export class VoiceService { private onSocketMessage = (message: SocketInputMessage) => { if (message.type === 'audio') { this.audio?.addChunk(message.payload.audio, message.payload.markIndex); - } else if (message.type === 'end') { - console.info('Conversation ended by server.', 'system'); - this.recorder.stop(); } else if (message.type === 'interrupt') { this.audio?.interrupt(); + } else if (message.type === 'end') { + console.info('Conversation ended by server.', 'system'); + this.stop(); } };