reduce speach interval for vocie mode
This commit is contained in:
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user