[Fix] Fixed TTS quoted mode Error

This commit is contained in:
drPpZero
2023-05-27 19:13:48 +09:00
parent 7d49589abf
commit 83ea39bdcb
2 changed files with 8 additions and 9 deletions

View File

@@ -12,7 +12,7 @@ export async function sayTTS(character:character,text:string) {
if(character.ttsReadOnlyQuoted){
const matches = text.match(/"(.*?)"/g)
if(matches.length > 0){
if(matches && matches.length > 0){
text = matches.map(match => match.slice(1, -1)).join("");
}
else{
@@ -89,7 +89,7 @@ export async function sayTTS(character:character,text:string) {
const audioBuffer = await audioContext.decodeAudioData(await getVoice.arrayBuffer())
sourceNode = audioContext.createBufferSource();
sourceNode.buffer = audioBuffer;
sourceNode.connect(audioContext.destination);
sourceNode.connect(audioContext.destination);
sourceNode.start();
}
}