refac
This commit is contained in:
@@ -468,7 +468,7 @@
|
||||
}
|
||||
|
||||
if ($settings.audio?.tts?.engine === 'browser-kokoro') {
|
||||
const blob = await $TTSWorker
|
||||
const url = await $TTSWorker
|
||||
.generate({
|
||||
text: content,
|
||||
voice: $settings?.audio?.tts?.voice ?? $config?.audio?.tts?.voice
|
||||
@@ -478,8 +478,8 @@
|
||||
toast.error(`${error}`);
|
||||
});
|
||||
|
||||
if (blob) {
|
||||
audioCache.set(content, new Audio(blob));
|
||||
if (url) {
|
||||
audioCache.set(content, new Audio(url));
|
||||
}
|
||||
} else if ($config.audio.tts.engine !== '') {
|
||||
const res = await synthesizeOpenAISpeech(
|
||||
|
||||
@@ -292,7 +292,7 @@
|
||||
loadingSpeech = false;
|
||||
});
|
||||
|
||||
if (url) {
|
||||
if (url && speaking) {
|
||||
$audioQueue.enqueue(url);
|
||||
loadingSpeech = false;
|
||||
}
|
||||
@@ -313,7 +313,7 @@
|
||||
loadingSpeech = false;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
if (res && speaking) {
|
||||
const blob = await res.blob();
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user