Add check for empty text in sayTTS function

Signed-off-by: hashcoko <hashcoko@gmail.com>
This commit is contained in:
hashcoko
2023-11-28 15:24:13 +09:00
parent 6dbd0f5526
commit a183a702a6

View File

@@ -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: {