[fix] setvar not working

This commit is contained in:
kwaroran
2023-07-18 01:02:08 +09:00
parent 1f376631d1
commit e676d183ad
3 changed files with 12 additions and 8 deletions

View File

@@ -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>`

View File

@@ -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){