Added support for openai api tts.
This commit is contained in:
@@ -29,7 +29,6 @@ export class KokoroHandler extends TTSHandler {
|
||||
this.iframe = null;
|
||||
this.currentAudio = null;
|
||||
this.currentVoice = null;
|
||||
this.preloadCache = new Map();
|
||||
this.pendingGenerations = new Map();
|
||||
this.generationCounter = 0;
|
||||
|
||||
@@ -501,18 +500,11 @@ export class KokoroHandler extends TTSHandler {
|
||||
}
|
||||
|
||||
try {
|
||||
// Check if already in cache
|
||||
const cacheKey = `${this.currentVoice?.id || 'af_heart'}-${this.options.rate}-${text}`;
|
||||
if (this.preloadCache.has(cacheKey)) {
|
||||
return this.preloadCache.get(cacheKey);
|
||||
}
|
||||
|
||||
// Generate speech
|
||||
// No longer check the local cache as we're using TTSFactory's centralized cache
|
||||
// Generate speech directly
|
||||
const result = await this.generateSpeech(text);
|
||||
|
||||
// Store in cache
|
||||
this.preloadCache.set(cacheKey, result);
|
||||
|
||||
// Return result for centralized caching in TTSFactory
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('Kokoro TTS: Error preloading speech:', error);
|
||||
|
||||
Reference in New Issue
Block a user