mirror of https://github.com/langgenius/dify.git
fix: chore: if boolean array bug
This commit is contained in:
parent
dc3cbd9a74
commit
d4f976270d
|
|
@ -58,13 +58,13 @@ const nodeDefault: NodeDefault<IfElseNodeType> = {
|
|||
if (isEmptyRelatedOperator(c.comparison_operator!))
|
||||
return true
|
||||
|
||||
return !!c.value
|
||||
return (c.varType === VarType.boolean || c.varType === VarType.arrayBoolean) ? c.value === undefined : !!c.value
|
||||
})
|
||||
if (!isSet)
|
||||
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t(`${i18nPrefix}.fields.variableValue`) })
|
||||
}
|
||||
else {
|
||||
if (!isEmptyRelatedOperator(condition.comparison_operator!) && (condition.varType === VarType.boolean ? condition.value === undefined : !condition.value))
|
||||
if (!isEmptyRelatedOperator(condition.comparison_operator!) && ((condition.varType === VarType.boolean || condition.varType === VarType.arrayBoolean) ? condition.value === undefined : !condition.value))
|
||||
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t(`${i18nPrefix}.fields.variableValue`) })
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,17 +24,14 @@ const IfElseNode: FC<NodeProps<IfElseNodeType>> = (props) => {
|
|||
if (!c.comparison_operator)
|
||||
return false
|
||||
|
||||
if (isEmptyRelatedOperator(c.comparison_operator!))
|
||||
return true
|
||||
|
||||
return c.varType === VarType.boolean ? true : !!c.value
|
||||
return (c.varType === VarType.boolean || c.varType === VarType.arrayBoolean) ? true : !!c.value
|
||||
})
|
||||
return isSet
|
||||
}
|
||||
else {
|
||||
if (isEmptyRelatedOperator(condition.comparison_operator!))
|
||||
return true
|
||||
return condition.varType === VarType.boolean ? true : !!condition.value
|
||||
return (condition.varType === VarType.boolean || condition.varType === VarType.arrayBoolean) ? true : !!condition.value
|
||||
}
|
||||
}, [])
|
||||
const conditionNotSet = (<div className='flex h-6 items-center space-x-1 rounded-md bg-workflow-block-parma-bg px-1 text-xs font-normal text-text-secondary'>
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ const useConfig = (id: string, payload: IfElseNodeType) => {
|
|||
varType: varItem.type,
|
||||
variable_selector: valueSelector,
|
||||
comparison_operator: getOperators(varItem.type, getIsVarFileAttribute(valueSelector) ? { key: valueSelector.slice(-1)[0] } : undefined)[0],
|
||||
value: varItem.type === VarType.boolean ? false : '',
|
||||
value: (varItem.type === VarType.boolean || varItem.type === VarType.arrayBoolean) ? false : '',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ const useConfig = (id: string, payload: ListFilterNodeType) => {
|
|||
isChatMode,
|
||||
isConstant: false,
|
||||
})
|
||||
let itemVarType = varType
|
||||
let itemVarType
|
||||
switch (varType) {
|
||||
case VarType.arrayNumber:
|
||||
itemVarType = VarType.number
|
||||
|
|
|
|||
Loading…
Reference in New Issue