[feat] added read quoted only tts option
This commit is contained in:
@@ -263,5 +263,6 @@ export const languageEnglish = {
|
|||||||
textBackgrounds: "Custom Text Screen Color",
|
textBackgrounds: "Custom Text Screen Color",
|
||||||
textBorder: "Text Outlines",
|
textBorder: "Text Outlines",
|
||||||
textScreenRound: "Round Text Screen",
|
textScreenRound: "Round Text Screen",
|
||||||
textScreenBorder: "Text Screen Borders"
|
textScreenBorder: "Text Screen Borders",
|
||||||
|
ttsReadOnlyQuoted: "Read Only Quoted"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -498,6 +498,12 @@
|
|||||||
</select>
|
</select>
|
||||||
{/await}
|
{/await}
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if currentChar.data.ttsMode === 'webspeech' || currentChar.data.ttsMode === 'elevenlab'}
|
||||||
|
<div class="flex items-center mt-2">
|
||||||
|
<Check bind:check={currentChar.data.ttsReadOnlyQuoted}/>
|
||||||
|
<span>{language.ttsReadOnlyQuoted}</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{:else if subMenu === 2}
|
{:else if subMenu === 2}
|
||||||
<h2 class="mb-2 text-2xl font-bold mt-2">{language.advancedSettings}</h2>
|
<h2 class="mb-2 text-2xl font-bold mt-2">{language.advancedSettings}</h2>
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ export interface character{
|
|||||||
ttsSpeech?:string
|
ttsSpeech?:string
|
||||||
supaMemory?:boolean
|
supaMemory?:boolean
|
||||||
additionalAssets?:[string, string][]
|
additionalAssets?:[string, string][]
|
||||||
|
ttsReadOnlyQuoted?:boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -350,13 +350,15 @@ export async function sendChat(chatProcessIndex = -1):Promise<boolean> {
|
|||||||
while(true){
|
while(true){
|
||||||
const readed = (await reader.read())
|
const readed = (await reader.read())
|
||||||
if(readed.value){
|
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)
|
setDatabase(db)
|
||||||
}
|
}
|
||||||
if(readed.done){
|
if(readed.done){
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await sayTTS(currentChar, result)
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
const result2 = processScriptFull(currentChar, reformatContent(req.result), 'editoutput')
|
const result2 = processScriptFull(currentChar, reformatContent(req.result), 'editoutput')
|
||||||
|
|||||||
@@ -7,6 +7,16 @@ export async function sayTTS(character:character,text:string) {
|
|||||||
let db = get(DataBase)
|
let db = get(DataBase)
|
||||||
text = text.replace(/\*/g,'')
|
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){
|
switch(character.ttsMode){
|
||||||
case "webspeech":{
|
case "webspeech":{
|
||||||
if(speechSynthesis && SpeechSynthesisUtterance){
|
if(speechSynthesis && SpeechSynthesisUtterance){
|
||||||
@@ -19,7 +29,7 @@ export async function sayTTS(character:character,text:string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
utterThis.voice = voices[voiceIndex]
|
utterThis.voice = voices[voiceIndex]
|
||||||
speechSynthesis.speak(utterThis)
|
const speak = speechSynthesis.speak(utterThis)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user