From cabe9b8cbbd3bf0af62596178ac467ad2e5a6e54 Mon Sep 17 00:00:00 2001 From: Gabry848 Date: Tue, 10 Feb 2026 15:08:24 +0100 Subject: [PATCH] perf: reduce inter-turn delays for faster voice chat response - Reduce initial recording start delay from 500ms to 150ms - Reduce all auto-restart recording delays from 300ms/200ms to 100ms - Applies to: agent_end, audio_end, interrupted, and audio_end+no_chunks states Total improvement: ~200-400ms less delay between conversation turns. --- src/hooks/useVoiceChat.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hooks/useVoiceChat.ts b/src/hooks/useVoiceChat.ts index c657563..10e2ac5 100644 --- a/src/hooks/useVoiceChat.ts +++ b/src/hooks/useVoiceChat.ts @@ -117,7 +117,7 @@ export function useVoiceChat() { shouldAutoStartRecordingRef.current = false; setTimeout(() => { startRecording(); - }, 500); + }, 150); } else if (isMutedRef.current) { shouldAutoStartRecordingRef.current = false; } @@ -235,7 +235,7 @@ export function useVoiceChat() { if (audioRecorderRef.current && websocketRef.current?.isReady()) { startRecording(); } - }, 300); + }, 100); } } else { console.log(`[useVoiceChat] Audio in corso (chunks: ${audioPlayerRef.current?.getChunksCount() || 0}, playing: ${isPlaying}), mantengo mute fino a fine riproduzione`); @@ -264,7 +264,7 @@ export function useVoiceChat() { if (audioRecorderRef.current && websocketRef.current?.isReady()) { startRecording(); } - }, 300); + }, 100); } } else { // Agent non ha ancora finito, torna in processing @@ -288,7 +288,7 @@ export function useVoiceChat() { if (audioRecorderRef.current && websocketRef.current?.isReady()) { startRecording(); } - }, 300); + }, 100); } } break; @@ -313,7 +313,7 @@ export function useVoiceChat() { if (audioRecorderRef.current && websocketRef.current?.isReady()) { startRecording(); } - }, 200); + }, 100); } break; }