[feat] added read quoted only tts option
This commit is contained in:
@@ -350,13 +350,15 @@ export async function sendChat(chatProcessIndex = -1):Promise<boolean> {
|
||||
while(true){
|
||||
const readed = (await reader.read())
|
||||
if(readed.value){
|
||||
db.characters[selectedChar].chats[selectedChat].message[msgIndex].data =readed.value
|
||||
result = readed.value
|
||||
db.characters[selectedChar].chats[selectedChat].message[msgIndex].data = result
|
||||
setDatabase(db)
|
||||
}
|
||||
if(readed.done){
|
||||
break
|
||||
}
|
||||
}
|
||||
await sayTTS(currentChar, result)
|
||||
}
|
||||
else{
|
||||
const result2 = processScriptFull(currentChar, reformatContent(req.result), 'editoutput')
|
||||
|
||||
@@ -7,6 +7,16 @@ export async function sayTTS(character:character,text:string) {
|
||||
let db = get(DataBase)
|
||||
text = text.replace(/\*/g,'')
|
||||
|
||||
if(character.ttsReadOnlyQuoted){
|
||||
const matches = text.match(/"(.*?)"/g)
|
||||
if(matches.length > 0){
|
||||
text = matches.map(match => match.slice(1, -1)).join("");
|
||||
}
|
||||
else{
|
||||
text = ''
|
||||
}
|
||||
}
|
||||
|
||||
switch(character.ttsMode){
|
||||
case "webspeech":{
|
||||
if(speechSynthesis && SpeechSynthesisUtterance){
|
||||
@@ -19,7 +29,7 @@ export async function sayTTS(character:character,text:string) {
|
||||
}
|
||||
}
|
||||
utterThis.voice = voices[voiceIndex]
|
||||
speechSynthesis.speak(utterThis)
|
||||
const speak = speechSynthesis.speak(utterThis)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user