mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'main' into dev
This commit is contained in:
@@ -30,7 +30,7 @@ class SystemTtsProvider {
|
||||
}
|
||||
|
||||
get settingsHtml() {
|
||||
if (!window.speechSynthesis) {
|
||||
if (!('speechSynthesis' in window)) {
|
||||
return "Your browser or operating system doesn't support speech synthesis";
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class SystemTtsProvider {
|
||||
// TTS Interfaces //
|
||||
//#################//
|
||||
fetchTtsVoiceIds() {
|
||||
if (!window.speechSynthesis) {
|
||||
if (!('speechSynthesis' in window)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -92,6 +92,10 @@ class SystemTtsProvider {
|
||||
}
|
||||
|
||||
previewTtsVoice(voiceId) {
|
||||
if (!('speechSynthesis' in window)) {
|
||||
throw 'Speech synthesis API is not supported';
|
||||
}
|
||||
|
||||
const voice = speechSynthesis.getVoices().find(x => x.voiceURI === voiceId);
|
||||
|
||||
if (!voice) {
|
||||
@@ -108,11 +112,11 @@ class SystemTtsProvider {
|
||||
}
|
||||
|
||||
async getVoice(voiceName) {
|
||||
if (!window.speechSynthesis) {
|
||||
if (!('speechSynthesis' in window)) {
|
||||
return { voice_id: null }
|
||||
}
|
||||
|
||||
const voices = window.speechSynthesis.getVoices();
|
||||
const voices = speechSynthesis.getVoices();
|
||||
const match = voices.find(x => x.name == voiceName);
|
||||
|
||||
if (!match) {
|
||||
@@ -123,7 +127,7 @@ class SystemTtsProvider {
|
||||
}
|
||||
|
||||
async generateTts(text, voiceId) {
|
||||
if (!window.speechSynthesis) {
|
||||
if (!('speechSynthesis' in window)) {
|
||||
throw 'Speech synthesis API is not supported';
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user