From 26044ff53b20a27b35d7bcfdb645a6b72959c694 Mon Sep 17 00:00:00 2001 From: ValueOn AG Date: Wed, 4 Mar 2026 00:09:10 +0100 Subject: [PATCH] fixes comm blocking bot and feedback --- .../views/commcoach/CommcoachCoachingView.tsx | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/pages/views/commcoach/CommcoachCoachingView.tsx b/src/pages/views/commcoach/CommcoachCoachingView.tsx index d658658..4c41154 100644 --- a/src/pages/views/commcoach/CommcoachCoachingView.tsx +++ b/src/pages/views/commcoach/CommcoachCoachingView.tsx @@ -136,14 +136,14 @@ export const CommcoachCoachingView: React.FC = () => { }; recognition.onspeechstart = () => { - if (cancelled) return; + if (cancelled || coach.isTtsPlayingRef.current) return; setIsUserSpeaking(true); transcriptPartsRef.current = []; setLiveTranscript(''); }; recognition.onresult = (event: SpeechRecognitionEvent) => { - if (cancelled) return; + if (cancelled || coach.isTtsPlayingRef.current) return; const finalized: string[] = []; let currentInterim = ''; for (let i = 0; i < event.results.length; i++) { @@ -163,6 +163,12 @@ export const CommcoachCoachingView: React.FC = () => { recognition.onspeechend = () => { if (cancelled) return; + if (coach.isTtsPlayingRef.current) { + transcriptPartsRef.current = []; + setLiveTranscript(''); + setIsUserSpeaking(false); + return; + } const fullTranscript = transcriptPartsRef.current.join(' ').trim(); if (fullTranscript) { const wordCount = fullTranscript.split(/\s+/).filter(Boolean).length; @@ -175,9 +181,15 @@ export const CommcoachCoachingView: React.FC = () => { recognition.onend = () => { if (cancelled) return; + setIsUserSpeaking(false); + transcriptPartsRef.current = []; + setLiveTranscript(''); if (speechRecognitionRef.current === recognition) { - speechRecognitionRef.current = null; - setIsUserSpeaking(false); + try { + recognition.start(); + } catch { + speechRecognitionRef.current = null; + } } };