Cleaned persistence manager, updated ui-options connectivity

This commit is contained in:
2025-04-06 19:35:05 +00:00
parent 0ab639fd25
commit 0842cbfefc
6 changed files with 107 additions and 114 deletions
+7 -7
View File
@@ -38,9 +38,9 @@ export class ElevenLabsTTSModule extends ApiTTSModuleBase {
return false;
}
// Check for API key
const apiKey = persistenceManager.getPreference('elevenlabs', 'api_key', '');
if (!apiKey) {
// API key is already loaded in parent initialize() method
// Just check if it's available
if (!this.apiKey) {
console.error('ElevenLabs TTS: API key not configured');
return false;
}
@@ -48,24 +48,24 @@ export class ElevenLabsTTSModule extends ApiTTSModuleBase {
// Load voices from ElevenLabs
try {
this.reportProgress(50, 'Loading ElevenLabs voices');
await this.loadVoices(apiKey);
await this.loadVoices(this.apiKey);
} catch (error) {
console.error('ElevenLabs TTS: Failed to load voices:', error);
return false;
}
// Load preferences
const preferredVoice = persistenceManager.getPreference('elevenlabs', 'voice', this.voiceOptions.voice);
const preferredVoice = persistenceManager.getPreference('tts', `${this.id}_voice`, this.voiceOptions.voice);
if (preferredVoice) {
this.voiceOptions.voice = preferredVoice;
}
const preferredModel = persistenceManager.getPreference('elevenlabs', 'model', this.voiceOptions.model);
const preferredModel = persistenceManager.getPreference('tts', `${this.id}_model`, this.voiceOptions.model);
if (preferredModel) {
this.voiceOptions.model = preferredModel;
}
const preferredSpeed = persistenceManager.getPreference('elevenlabs', 'speed', this.voiceOptions.speed);
const preferredSpeed = persistenceManager.getPreference('tts', `${this.id}_speed`, this.voiceOptions.speed);
if (typeof preferredSpeed === 'number') {
this.voiceOptions.speed = preferredSpeed;
}