Skip to content

Commit ad03aad

Browse files
committed
make robot stop movement when speech is detected
1 parent 63d668d commit ad03aad

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/pages/operator/tsx/voice/realtimeSession.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,14 @@ export async function connectOpenAIRealtimeVoice(
531531
scheduleMicUnmute();
532532
}
533533

534+
// ── Instant stop on speech start ─────────────────────────────────────────
535+
// Stop any ongoing motion the moment the VAD detects speech, before
536+
// transcription or model inference. The next tool call will restart motion
537+
// if the command is anything other than "stop".
538+
if (eventType === "input_audio_buffer.speech_started") {
539+
executeStopMotionOnProvider(opts.voiceProvider);
540+
}
541+
534542
if (
535543
eventType.includes("input_audio_transcription") &&
536544
eventType.includes("completed")

0 commit comments

Comments
 (0)