add ready flag
This commit is contained in:
parent
24b6261f46
commit
56fcf1cbb8
|
@ -84,6 +84,7 @@ class CoquiTtsProvider {
|
|||
//#############################//
|
||||
|
||||
settings
|
||||
ready
|
||||
|
||||
defaultSettings = {
|
||||
voiceMap: "",
|
||||
|
@ -147,6 +148,7 @@ class CoquiTtsProvider {
|
|||
loadSettings(settings) {
|
||||
// Only accept keys defined in defaultSettings
|
||||
this.settings = this.defaultSettings
|
||||
this.ready = false
|
||||
|
||||
for (const key in 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() {
|
||||
this.settings.voiceMap = "";
|
||||
for (let i in this.settings.voiceMapDict) {
|
||||
|
|
|
@ -11,6 +11,7 @@ class EdgeTtsProvider {
|
|||
//########//
|
||||
|
||||
settings
|
||||
ready = false
|
||||
voices = []
|
||||
separator = ' . '
|
||||
audioElement = document.createElement('audio')
|
||||
|
@ -52,10 +53,27 @@ class EdgeTtsProvider {
|
|||
$('#edge_tts_rate').val(this.settings.rate || 0);
|
||||
$('#edge_tts_rate_output').text(this.settings.rate || 0);
|
||||
|
||||
this.checkReady()
|
||||
|
||||
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() {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ class ElevenLabsTtsProvider {
|
|||
//########//
|
||||
|
||||
settings
|
||||
ready = false
|
||||
voices = []
|
||||
separator = ' ... ... ... '
|
||||
|
||||
|
@ -66,9 +67,22 @@ class ElevenLabsTtsProvider {
|
|||
$('#elevenlabs_tts_similarity_boost').val(this.settings.similarity_boost)
|
||||
$('#elevenlabs_tts_api_key').val(this.settings.apiKey)
|
||||
$('#tts_auto_generation').prop('checked', this.settings.multilingual)
|
||||
|
||||
this.checkReady()
|
||||
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() {
|
||||
// Update on Apply click
|
||||
return await this.updateApiKey().catch( (error) => {
|
||||
|
|
|
@ -8,6 +8,7 @@ class SileroTtsProvider {
|
|||
//########//
|
||||
|
||||
settings
|
||||
ready = false
|
||||
voices = []
|
||||
separator = ' .. '
|
||||
|
||||
|
@ -60,9 +61,26 @@ class SileroTtsProvider {
|
|||
}, 2000);
|
||||
|
||||
$('#silero_tts_endpoint').val(this.settings.provider_endpoint)
|
||||
|
||||
this.checkReady()
|
||||
|
||||
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() {
|
||||
return
|
||||
|
|
|
@ -80,6 +80,7 @@ class SystemTtsProvider {
|
|||
//########//
|
||||
|
||||
settings
|
||||
ready = false
|
||||
voices = []
|
||||
separator = ' ... '
|
||||
|
||||
|
@ -145,9 +146,21 @@ class SystemTtsProvider {
|
|||
$('#system_tts_pitch').val(this.settings.pitch || this.defaultSettings.pitch);
|
||||
$('#system_tts_pitch_output').text(this.settings.pitch);
|
||||
$('#system_tts_rate_output').text(this.settings.rate);
|
||||
this.checkReady()
|
||||
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() {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue