diff --git a/custom_components/openclaw/www/openclaw-chat-card.js b/custom_components/openclaw/www/openclaw-chat-card.js index a59420d..cfcfc69 100644 --- a/custom_components/openclaw/www/openclaw-chat-card.js +++ b/custom_components/openclaw/www/openclaw-chat-card.js @@ -1043,7 +1043,9 @@ class OpenClawChatCard extends HTMLElement { const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition; this._recognition = new SpeechRecognition(); - this._recognition.continuous = this._isVoiceMode; + this._recognition.continuous = false; + this._recognition.interimResults = false; + this._recognition.maxAlternatives = 1; this._recognition.lang = this._getSpeechRecognitionLanguage(); this._voiceStatus = this._isVoiceMode ? this._wakeWordEnabled @@ -1088,6 +1090,17 @@ class OpenClawChatCard extends HTMLElement { } }; + this._recognition.onspeechend = () => { + if (this._voiceStopRequested) { + return; + } + try { + this._recognition.stop(); + } catch (e) { + // ignore + } + }; + this._recognition.onerror = (event) => { const err = event?.error || "unknown"; if (err === "aborted") {