fix: end voice call when brief generation completes
All checks were successful
Build & Push / build-and-push (push) Successful in 1m58s
All checks were successful
Build & Push / build-and-push (push) Successful in 1m58s
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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 */}
|
||||
<div className="flex items-center justify-center gap-3 pt-2">
|
||||
{status === 'idle' && (
|
||||
{status === 'idle' && !completedBrief && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={startConversation}
|
||||
|
||||
Reference in New Issue
Block a user