mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix speech recognition plugin for Safari
This commit is contained in:
@ -25,8 +25,8 @@ function composeValues(previous, interim) {
|
||||
grammar: '' // Custom grammar
|
||||
}, options);
|
||||
|
||||
const speechRecognition = window.SpeechRecognition || webkitSpeechRecognition;
|
||||
const speechRecognitionList = window.SpeechGrammarList || webkitSpeechGrammarList;
|
||||
const speechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
||||
const speechRecognitionList = window.SpeechGrammarList || window.webkitSpeechGrammarList;
|
||||
|
||||
if (!speechRecognition) {
|
||||
console.warn('Speech recognition is not supported in this browser.');
|
||||
@ -35,7 +35,7 @@ function composeValues(previous, interim) {
|
||||
|
||||
const recognition = new speechRecognition();
|
||||
|
||||
if (settings.grammar) {
|
||||
if (settings.grammar && speechRecognitionList) {
|
||||
speechRecognitionList.addFromString(settings.grammar, 1);
|
||||
recognition.grammars = speechRecognitionList;
|
||||
}
|
||||
|
Reference in New Issue
Block a user