From a183a702a6a1fb1a70cd4237abc38334d622b592 Mon Sep 17 00:00:00 2001 From: hashcoko Date: Tue, 28 Nov 2023 15:24:13 +0900 Subject: [PATCH] Add check for empty text in sayTTS function Signed-off-by: hashcoko --- src/ts/process/tts.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ts/process/tts.ts b/src/ts/process/tts.ts index 07d3c09b..708c9e97 100644 --- a/src/ts/process/tts.ts +++ b/src/ts/process/tts.ts @@ -149,6 +149,9 @@ export async function sayTTS(character:character,text:string) { } case 'novelai': { const audioContext = new AudioContext(); + if(text === ''){ + alertError(language.errors.emptyText) + } const response = await globalFetch(`https://api.novelai.net/ai/generate-voice?text=${text}&voice=-1&seed=${character.naittsConfig.voice}&opus=false&version=${character.naittsConfig.version}`, { method: 'GET', headers: {