From 3bf07674ad60906b6e5f80a0d128b239c1c22979 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 31 Mar 2026 20:35:48 -0400 Subject: [PATCH] fix: end voice call when brief generation completes The WebSocket, mic, and audio contexts were never torn down after complete_brief succeeded, so the Gemini agent kept listening and responding in the background. Now endConversation() fires as soon as the brief arrives, and the Start button is hidden during the 1.5s transition so it doesn't flash. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/configurator/VoiceAgent.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/configurator/VoiceAgent.tsx b/src/components/configurator/VoiceAgent.tsx index 92c8b57..c878c77 100644 --- a/src/components/configurator/VoiceAgent.tsx +++ b/src/components/configurator/VoiceAgent.tsx @@ -73,17 +73,18 @@ export default function VoiceAgent({ locale, onComplete }: VoiceAgentProps) { } }, [transcript]); - // Handle completion + // Handle completion — end the call, then transition useEffect(() => { if (completedBrief && completedFormData) { - console.log('[VoiceAgent] Brief complete, transitioning in 1.5s...'); + console.log('[VoiceAgent] Brief complete, ending conversation and transitioning in 1.5s...'); + endConversation(); const timer = setTimeout(() => { console.log('[VoiceAgent] Calling onComplete'); onComplete(completedBrief, completedFormData); }, 1500); return () => clearTimeout(timer); } - }, [completedBrief, completedFormData, onComplete]); + }, [completedBrief, completedFormData, onComplete, endConversation]); // Orb animation driven by agent amplitude const amplitudeValue = useMotionValue(0); @@ -255,7 +256,7 @@ export default function VoiceAgent({ locale, onComplete }: VoiceAgentProps) { {/* Controls */}
- {status === 'idle' && ( + {status === 'idle' && !completedBrief && (