[fix] fixed https://github.com/kwaroran/RisuAI/issues/122 and TTS quoted mode (#123)
Fixed : an error not showing up right away when creating a Group Chat an error when text had no quotes in TTS quote mode occurs TypeError: Cannot read properties of null (reading 'length')
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user