chore: Add truthy operator to trigger conditions
This commit is contained in:
@@ -632,4 +632,5 @@ export const languageEnglish = {
|
||||
select: "Select",
|
||||
lowLevelAccessConfirm: "This character uses Low Level Access. which means this character can access the AI model and your storage directly. do you really want to import this character?",
|
||||
triggerLowLevelOnly: "This trigger only works with Low Level Access. to enable this trigger, enable Low Level Access in advanced settings in the character.",
|
||||
truthy: "Truthy",
|
||||
}
|
||||
@@ -63,7 +63,7 @@
|
||||
value.conditions.push({
|
||||
type: 'value',
|
||||
value: '',
|
||||
operator: '=',
|
||||
operator: 'true',
|
||||
var: ''
|
||||
})
|
||||
value.conditions = value.conditions
|
||||
@@ -139,6 +139,7 @@
|
||||
{/if}
|
||||
<span class="text-textcolor2 text-sm">{language.value}</span>
|
||||
<SelectInput bind:value={cond.operator} size="sm">
|
||||
<OptionInput value="true">{language.truthy}</OptionInput>
|
||||
<OptionInput value="=">{language.equal}</OptionInput>
|
||||
<OptionInput value="!=">{language.notEqual}</OptionInput>
|
||||
<OptionInput value=">">{language.greater}</OptionInput>
|
||||
|
||||
@@ -26,13 +26,13 @@ export type triggerConditionsVar = {
|
||||
type:'var'|'value'
|
||||
var:string
|
||||
value:string
|
||||
operator:'='|'!='|'>'|'<'|'>='|'<='|'null'
|
||||
operator:'='|'!='|'>'|'<'|'>='|'<='|'null'|'true'
|
||||
}
|
||||
|
||||
export type triggerConditionsChatIndex = {
|
||||
type:'chatindex'
|
||||
value:string
|
||||
operator:'='|'!='|'>'|'<'|'>='|'<='|'null'
|
||||
operator:'='|'!='|'>'|'<'|'>='|'<='|'null'|'true'
|
||||
}
|
||||
|
||||
export type triggerConditionsExists ={
|
||||
@@ -186,6 +186,12 @@ export async function runTrigger(char:character,mode:triggerMode, arg:{
|
||||
const conditionValue = risuChatParser(condition.value,{chara:char})
|
||||
varValue = risuChatParser(varValue,{chara:char})
|
||||
switch(condition.operator){
|
||||
case 'true': {
|
||||
if(varValue !== 'true' && varValue !== '1'){
|
||||
pass = false
|
||||
}
|
||||
break
|
||||
}
|
||||
case '=':
|
||||
if(varValue !== conditionValue){
|
||||
pass = false
|
||||
|
||||
Reference in New Issue
Block a user