Checkpoint current UI and ink integration state
This commit is contained in:
@@ -36,7 +36,8 @@ export class ApiTTSModuleBase extends TTSHandlerModule {
|
||||
'generateSpeechAudio',
|
||||
'preprocessText',
|
||||
'getPlaybackVolume',
|
||||
'applyCurrentVolume'
|
||||
'applyCurrentVolume',
|
||||
'notifyReadyState'
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -510,28 +511,19 @@ export class ApiTTSModuleBase extends TTSHandlerModule {
|
||||
if (wasReady !== this.isReady) {
|
||||
console.log(`${this.name}: TTS ready state changed to ${this.isReady ? 'ready' : 'not ready'} after API key change`);
|
||||
|
||||
// Find and notify the TTS factory
|
||||
const ttsFactory = this.getModule('tts-factory');
|
||||
if (ttsFactory) {
|
||||
// If we have a key now (and didn't before), try initializing voices
|
||||
if (this.isReady && !wasReady) {
|
||||
// Reload voices with the new API key
|
||||
this.loadVoices().then((voicesLoaded) => {
|
||||
this.isReady = voicesLoaded !== false && !!this.apiKey;
|
||||
// Then set up voice from preferences
|
||||
this.setupVoiceFromPreferences().then(() => {
|
||||
console.log(`${this.name}: API key status: ${this.isReady ? 'ready' : 'not ready'}`);
|
||||
// Notify the factory of our readiness change
|
||||
ttsFactory.updateTTSAvailability();
|
||||
document.dispatchEvent(new CustomEvent('tts:status:updated', {
|
||||
detail: { provider: this.id, ready: this.isReady }
|
||||
}));
|
||||
});
|
||||
// If we have a key now (and didn't before), try initializing voices.
|
||||
// TTS providers must not depend back on tts-factory; they publish
|
||||
// readiness and the factory listens for handler-state changes.
|
||||
if (this.isReady && !wasReady) {
|
||||
this.loadVoices().then((voicesLoaded) => {
|
||||
this.isReady = voicesLoaded !== false && !!this.apiKey;
|
||||
this.setupVoiceFromPreferences().then(() => {
|
||||
console.log(`${this.name}: API key status: ${this.isReady ? 'ready' : 'not ready'}`);
|
||||
this.notifyReadyState();
|
||||
});
|
||||
} else {
|
||||
// Just update the availability
|
||||
ttsFactory.updateTTSAvailability();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.notifyReadyState();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -566,17 +558,19 @@ export class ApiTTSModuleBase extends TTSHandlerModule {
|
||||
this.setupVoiceFromPreferences().then(() => {
|
||||
console.log(`${this.name}: API URL status: ${this.isReady ? 'ready' : 'not ready'}`);
|
||||
|
||||
// Notify the TTS factory
|
||||
const ttsFactory = this.getModule('tts-factory');
|
||||
if (ttsFactory) {
|
||||
ttsFactory.updateTTSAvailability();
|
||||
}
|
||||
document.dispatchEvent(new CustomEvent('tts:status:updated', {
|
||||
detail: { provider: this.id, ready: this.isReady }
|
||||
}));
|
||||
this.notifyReadyState();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
notifyReadyState() {
|
||||
document.dispatchEvent(new CustomEvent('tts:handler-state-changed', {
|
||||
detail: { handler: this.id, ready: this.isReady === true }
|
||||
}));
|
||||
document.dispatchEvent(new CustomEvent('tts:status:updated', {
|
||||
detail: { provider: this.id, ready: this.isReady === true }
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user