add ready flag

This commit is contained in:
ouoertheo
2023-08-22 08:30:33 -05:00
parent 24b6261f46
commit 56fcf1cbb8
5 changed files with 80 additions and 0 deletions

View File

@ -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