chore: Add truthy operator to trigger conditions
This commit is contained in:
@@ -632,4 +632,5 @@ export const languageEnglish = {
|
|||||||
select: "Select",
|
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?",
|
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.",
|
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({
|
value.conditions.push({
|
||||||
type: 'value',
|
type: 'value',
|
||||||
value: '',
|
value: '',
|
||||||
operator: '=',
|
operator: 'true',
|
||||||
var: ''
|
var: ''
|
||||||
})
|
})
|
||||||
value.conditions = value.conditions
|
value.conditions = value.conditions
|
||||||
@@ -139,6 +139,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<span class="text-textcolor2 text-sm">{language.value}</span>
|
<span class="text-textcolor2 text-sm">{language.value}</span>
|
||||||
<SelectInput bind:value={cond.operator} size="sm">
|
<SelectInput bind:value={cond.operator} size="sm">
|
||||||
|
<OptionInput value="true">{language.truthy}</OptionInput>
|
||||||
<OptionInput value="=">{language.equal}</OptionInput>
|
<OptionInput value="=">{language.equal}</OptionInput>
|
||||||
<OptionInput value="!=">{language.notEqual}</OptionInput>
|
<OptionInput value="!=">{language.notEqual}</OptionInput>
|
||||||
<OptionInput value=">">{language.greater}</OptionInput>
|
<OptionInput value=">">{language.greater}</OptionInput>
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ export type triggerConditionsVar = {
|
|||||||
type:'var'|'value'
|
type:'var'|'value'
|
||||||
var:string
|
var:string
|
||||||
value:string
|
value:string
|
||||||
operator:'='|'!='|'>'|'<'|'>='|'<='|'null'
|
operator:'='|'!='|'>'|'<'|'>='|'<='|'null'|'true'
|
||||||
}
|
}
|
||||||
|
|
||||||
export type triggerConditionsChatIndex = {
|
export type triggerConditionsChatIndex = {
|
||||||
type:'chatindex'
|
type:'chatindex'
|
||||||
value:string
|
value:string
|
||||||
operator:'='|'!='|'>'|'<'|'>='|'<='|'null'
|
operator:'='|'!='|'>'|'<'|'>='|'<='|'null'|'true'
|
||||||
}
|
}
|
||||||
|
|
||||||
export type triggerConditionsExists ={
|
export type triggerConditionsExists ={
|
||||||
@@ -186,6 +186,12 @@ export async function runTrigger(char:character,mode:triggerMode, arg:{
|
|||||||
const conditionValue = risuChatParser(condition.value,{chara:char})
|
const conditionValue = risuChatParser(condition.value,{chara:char})
|
||||||
varValue = risuChatParser(varValue,{chara:char})
|
varValue = risuChatParser(varValue,{chara:char})
|
||||||
switch(condition.operator){
|
switch(condition.operator){
|
||||||
|
case 'true': {
|
||||||
|
if(varValue !== 'true' && varValue !== '1'){
|
||||||
|
pass = false
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
case '=':
|
case '=':
|
||||||
if(varValue !== conditionValue){
|
if(varValue !== conditionValue){
|
||||||
pass = false
|
pass = false
|
||||||
|
|||||||
Reference in New Issue
Block a user