Limit waiting for TTS to init to 1 second on chat change

This commit is contained in:
Cohee 2023-12-10 21:50:52 +02:00
parent 420d186823
commit 2e50efc35c
1 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import { callPopup, cancelTtsPlay, eventSource, event_types, name2, saveSettingsDebounced } from '../../../script.js';
import { ModuleWorkerWrapper, doExtrasFetch, extension_settings, getApiUrl, getContext, modules } from '../../extensions.js';
import { escapeRegex, getStringHash } from '../../utils.js';
import { delay, escapeRegex, getStringHash } from '../../utils.js';
import { EdgeTtsProvider } from './edge.js';
import { ElevenLabsTtsProvider } from './elevenlabs.js';
import { SileroTtsProvider } from './silerotts.js';
@ -698,7 +698,8 @@ export function saveTtsProviderSettings() {
async function onChatChanged() {
await resetTtsPlayback();
await initVoiceMap();
const voiceMapInit = initVoiceMap();
await Promise.race([voiceMapInit, await delay(1000)]);
ttsLastMessage = null;
}