[fix] setvar not working
This commit is contained in:
@@ -56,13 +56,13 @@
|
||||
async function displaya(message:string){
|
||||
if($DataBase.autoTranslate && $DataBase.translator !== ''){
|
||||
if(msgTranslated==='')
|
||||
msgDisplay = risuChatParser(message, {chara: name, chatID: idx})
|
||||
msgDisplay = await translate(risuChatParser(message, {chara: name, chatID: idx}), false)
|
||||
msgDisplay = risuChatParser(message, {chara: name, chatID: idx, rmVar: true})
|
||||
msgDisplay = await translate(risuChatParser(message, {chara: name, chatID: idx, rmVar:true}), false)
|
||||
msgTranslated = msgDisplay
|
||||
translated = true;
|
||||
}
|
||||
else{
|
||||
msgDisplay = risuChatParser(message, {chara: name, chatID: idx})
|
||||
msgDisplay = risuChatParser(message, {chara: name, chatID: idx, rmVar: true})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,13 +130,13 @@
|
||||
translated = true
|
||||
return
|
||||
}
|
||||
msgDisplay = (await translate(risuChatParser(message, {chara: name, chatID: idx}), false))
|
||||
msgDisplay = (await translate(risuChatParser(message, {chara: name, chatID: idx, rmVar: true}), false))
|
||||
msgTranslated = msgDisplay
|
||||
translating = false
|
||||
translated = true
|
||||
}
|
||||
else{
|
||||
msgDisplay = risuChatParser(message, {chara: name, chatID: idx})
|
||||
msgDisplay = risuChatParser(message, {chara: name, chatID: idx, rmVar:true})
|
||||
translated = false
|
||||
}
|
||||
}}>
|
||||
|
||||
@@ -284,6 +284,7 @@ export function risuChatParser(da:string, arg:{
|
||||
chatID?:number
|
||||
db?:Database
|
||||
chara?:string|character|groupChat
|
||||
rmVar?:boolean
|
||||
} = {}):string{
|
||||
const chatID = arg.chatID ?? -1
|
||||
const db = arg.db ?? get(DataBase)
|
||||
@@ -394,7 +395,10 @@ export function risuChatParser(da:string, arg:{
|
||||
}
|
||||
case 'addvar':
|
||||
case 'setvar':{
|
||||
return ''
|
||||
if(arg.rmVar){
|
||||
return ''
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'button':{
|
||||
return `<button style="padding" x-risu-prompt="${arra[2]}">${arra[1]}</button>`
|
||||
|
||||
@@ -275,7 +275,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
const chat:OpenAIChat = {
|
||||
role: 'assistant',
|
||||
content: processScript(nowChatroom,
|
||||
risuChatParser(firstMsg, {chara: currentChar}),
|
||||
risuChatParser(firstMsg, {chara: currentChar, rmVar: true}),
|
||||
'editprocess')
|
||||
}
|
||||
chats.push(chat)
|
||||
@@ -284,7 +284,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
|
||||
const ms = currentChat.message
|
||||
for(const msg of ms){
|
||||
let formedChat = processScript(nowChatroom,risuChatParser(msg.data, {chara: currentChar}), 'editprocess')
|
||||
let formedChat = processScript(nowChatroom,risuChatParser(msg.data, {chara: currentChar, rmVar: true}), 'editprocess')
|
||||
let name = ''
|
||||
if(msg.role === 'char'){
|
||||
if(msg.saying){
|
||||
|
||||
Reference in New Issue
Block a user