mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
add ready flag
This commit is contained in:
@ -84,6 +84,7 @@ class CoquiTtsProvider {
|
|||||||
//#############################//
|
//#############################//
|
||||||
|
|
||||||
settings
|
settings
|
||||||
|
ready
|
||||||
|
|
||||||
defaultSettings = {
|
defaultSettings = {
|
||||||
voiceMap: "",
|
voiceMap: "",
|
||||||
@ -147,6 +148,7 @@ class CoquiTtsProvider {
|
|||||||
loadSettings(settings) {
|
loadSettings(settings) {
|
||||||
// Only accept keys defined in defaultSettings
|
// Only accept keys defined in defaultSettings
|
||||||
this.settings = this.defaultSettings
|
this.settings = this.defaultSettings
|
||||||
|
this.ready = false
|
||||||
|
|
||||||
for (const key in settings) {
|
for (const key in settings) {
|
||||||
if (key in this.settings) {
|
if (key in this.settings) {
|
||||||
@ -227,6 +229,21 @@ class CoquiTtsProvider {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Perform a simple readiness check by trying to fetch voiceIds
|
||||||
|
async checkReady(){
|
||||||
|
try {
|
||||||
|
if (!modules.includes('coqui-tts')){
|
||||||
|
this.ready = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await this.fetchTtsVoiceIds()
|
||||||
|
this.ready = true
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
this.ready = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateVoiceMap() {
|
updateVoiceMap() {
|
||||||
this.settings.voiceMap = "";
|
this.settings.voiceMap = "";
|
||||||
for (let i in this.settings.voiceMapDict) {
|
for (let i in this.settings.voiceMapDict) {
|
||||||
|
@ -11,6 +11,7 @@ class EdgeTtsProvider {
|
|||||||
//########//
|
//########//
|
||||||
|
|
||||||
settings
|
settings
|
||||||
|
ready = false
|
||||||
voices = []
|
voices = []
|
||||||
separator = ' . '
|
separator = ' . '
|
||||||
audioElement = document.createElement('audio')
|
audioElement = document.createElement('audio')
|
||||||
@ -52,10 +53,27 @@ class EdgeTtsProvider {
|
|||||||
$('#edge_tts_rate').val(this.settings.rate || 0);
|
$('#edge_tts_rate').val(this.settings.rate || 0);
|
||||||
$('#edge_tts_rate_output').text(this.settings.rate || 0);
|
$('#edge_tts_rate_output').text(this.settings.rate || 0);
|
||||||
|
|
||||||
|
this.checkReady()
|
||||||
|
|
||||||
console.info("Settings loaded")
|
console.info("Settings loaded")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Perform a simple readiness check by trying to fetch voiceIds
|
||||||
|
async checkReady(){
|
||||||
|
try {
|
||||||
|
if (!modules.includes('edge-tts')){
|
||||||
|
this.ready = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await this.fetchTtsVoiceIds()
|
||||||
|
this.ready = true
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
this.ready = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async onApplyClick() {
|
async onApplyClick() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ class ElevenLabsTtsProvider {
|
|||||||
//########//
|
//########//
|
||||||
|
|
||||||
settings
|
settings
|
||||||
|
ready = false
|
||||||
voices = []
|
voices = []
|
||||||
separator = ' ... ... ... '
|
separator = ' ... ... ... '
|
||||||
|
|
||||||
@ -66,9 +67,22 @@ class ElevenLabsTtsProvider {
|
|||||||
$('#elevenlabs_tts_similarity_boost').val(this.settings.similarity_boost)
|
$('#elevenlabs_tts_similarity_boost').val(this.settings.similarity_boost)
|
||||||
$('#elevenlabs_tts_api_key').val(this.settings.apiKey)
|
$('#elevenlabs_tts_api_key').val(this.settings.apiKey)
|
||||||
$('#tts_auto_generation').prop('checked', this.settings.multilingual)
|
$('#tts_auto_generation').prop('checked', this.settings.multilingual)
|
||||||
|
|
||||||
|
this.checkReady()
|
||||||
console.info("Settings loaded")
|
console.info("Settings loaded")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Perform a simple readiness check by trying to fetch voiceIds
|
||||||
|
async checkReady(){
|
||||||
|
try {
|
||||||
|
await this.fetchTtsVoiceIds()
|
||||||
|
this.ready = true
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
this.ready = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async onApplyClick() {
|
async onApplyClick() {
|
||||||
// Update on Apply click
|
// Update on Apply click
|
||||||
return await this.updateApiKey().catch( (error) => {
|
return await this.updateApiKey().catch( (error) => {
|
||||||
|
@ -8,6 +8,7 @@ class SileroTtsProvider {
|
|||||||
//########//
|
//########//
|
||||||
|
|
||||||
settings
|
settings
|
||||||
|
ready = false
|
||||||
voices = []
|
voices = []
|
||||||
separator = ' .. '
|
separator = ' .. '
|
||||||
|
|
||||||
@ -60,9 +61,26 @@ class SileroTtsProvider {
|
|||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
$('#silero_tts_endpoint').val(this.settings.provider_endpoint)
|
$('#silero_tts_endpoint').val(this.settings.provider_endpoint)
|
||||||
|
|
||||||
|
this.checkReady()
|
||||||
|
|
||||||
console.info("Settings loaded")
|
console.info("Settings loaded")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Perform a simple readiness check by trying to fetch voiceIds
|
||||||
|
async checkReady(){
|
||||||
|
try {
|
||||||
|
if (!modules.includes('silero-tts')){
|
||||||
|
this.ready = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await this.fetchTtsVoiceIds()
|
||||||
|
this.ready = true
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
this.ready = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async onApplyClick() {
|
async onApplyClick() {
|
||||||
return
|
return
|
||||||
|
@ -80,6 +80,7 @@ class SystemTtsProvider {
|
|||||||
//########//
|
//########//
|
||||||
|
|
||||||
settings
|
settings
|
||||||
|
ready = false
|
||||||
voices = []
|
voices = []
|
||||||
separator = ' ... '
|
separator = ' ... '
|
||||||
|
|
||||||
@ -145,9 +146,21 @@ class SystemTtsProvider {
|
|||||||
$('#system_tts_pitch').val(this.settings.pitch || this.defaultSettings.pitch);
|
$('#system_tts_pitch').val(this.settings.pitch || this.defaultSettings.pitch);
|
||||||
$('#system_tts_pitch_output').text(this.settings.pitch);
|
$('#system_tts_pitch_output').text(this.settings.pitch);
|
||||||
$('#system_tts_rate_output').text(this.settings.rate);
|
$('#system_tts_rate_output').text(this.settings.rate);
|
||||||
|
this.checkReady()
|
||||||
console.info("Settings loaded");
|
console.info("Settings loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Perform a simple readiness check by trying to fetch voiceIds
|
||||||
|
async checkReady(){
|
||||||
|
try {
|
||||||
|
await this.fetchTtsVoiceIds()
|
||||||
|
this.ready = true
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
this.ready = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async onApplyClick() {
|
async onApplyClick() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user