diff --git a/public/scripts/extensions/speech-recognition/index.js b/public/scripts/extensions/speech-recognition/index.js
index 8678b6bcd..1ac098f36 100644
--- a/public/scripts/extensions/speech-recognition/index.js
+++ b/public/scripts/extensions/speech-recognition/index.js
@@ -72,8 +72,11 @@ async function moduleWorker() {
}
else {
console.debug(DEBUG_PREFIX+"Found trigger word: ", triggerWord, " at index ", triggerPos);
- if (triggerPos < messageStart | messageStart == -1) { // & (triggerPos + triggerWord.length) < userMessageFormatted.length)) {
+ if (triggerPos < messageStart || messageStart == -1) { // & (triggerPos + triggerWord.length) < userMessageFormatted.length)) {
messageStart = triggerPos; // + triggerWord.length + 1;
+
+ if (!extension_settings.speech_recognition.Streaming.triggerWordsIncluded)
+ messageStart = triggerPos + triggerWord.length + 1;
}
}
}
@@ -93,6 +96,16 @@ async function moduleWorker() {
}
else{
userMessageFormatted = userMessageFormatted.substring(messageStart);
+ // Trim non alphanumeric character from the start
+ messageStart = 0;
+ for(const i of userMessageFormatted) {
+ if(/^[a-z]$/i.test(i)) {
+ break;
+ }
+ messageStart += 1;
+ }
+ userMessageFormatted = userMessageFormatted.substring(messageStart);
+ userMessageFormatted = userMessageFormatted.charAt(0).toUpperCase() + userMessageFormatted.substring(1);
processTranscript(userMessageFormatted);
}
}
diff --git a/public/scripts/extensions/speech-recognition/streaming.js b/public/scripts/extensions/speech-recognition/streaming.js
index 0ef41235c..2dc5d24c9 100644
--- a/public/scripts/extensions/speech-recognition/streaming.js
+++ b/public/scripts/extensions/speech-recognition/streaming.js
@@ -14,6 +14,7 @@ class StreamingSttProvider {
triggerWordsText: "",
triggerWords : [],
triggerWordsEnabled : false,
+ triggerWordsIncluded: false,
debug : false,
}
@@ -26,6 +27,10 @@ class StreamingSttProvider {
\
Enable trigger words\
\
+ \