[fix] fix triggers

This commit is contained in:
kwaroran
2023-08-02 06:24:08 +09:00
parent edadb88405
commit 2205442fc9
2 changed files with 5 additions and 4 deletions

View File

@@ -503,7 +503,9 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
await sayTTS(currentChar, result)
}
else{
const msgs = req.type === 'success' ? [['char',req.result]] as const : req.type === 'multiline' ? req.result : []
const msgs = (req.type === 'success') ? [['char',req.result]] as const
: (req.type === 'multiline') ? req.result
: []
for(const msg of msgs){
const msgIndex = db.characters[selectedChar].chats[selectedChat].message.length
const result2 = processScriptFull(nowChatroom, reformatContent(msg[1]), 'editoutput', msgIndex)

View File

@@ -67,14 +67,13 @@ export function runTrigger(char:character,mode:triggerMode, arg:{
historyend: '',
promptend: ''
}
let varValues = getVarChat(-1, char)
let varValuesChanged = false
const triggers = char.triggerscript
const chat = arg.chat ?? char.chats[char.chatPage]
if(!triggers){
return null
}
let varValues = getVarChat(-1, char)
let varValuesChanged = false
for(const trigger of triggers){
if(mode !== trigger.type){
continue