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

@ -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) => {