mirror of
https://github.com/langgenius/dify.git
synced 2026-08-28 21:23:22 +08:00
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!))
|
if (isEmptyRelatedOperator(c.comparison_operator!))
|
||||||
return true
|
return true
|
||||||
|
|
||||||
return !!c.value
|
return (c.varType === VarType.boolean || c.varType === VarType.arrayBoolean) ? c.value === undefined : !!c.value
|
||||||
})
|
})
|
||||||
if (!isSet)
|
if (!isSet)
|
||||||
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t(`${i18nPrefix}.fields.variableValue`) })
|
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t(`${i18nPrefix}.fields.variableValue`) })
|
||||||
}
|
}
|
||||||
else {
|
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`) })
|
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t(`${i18nPrefix}.fields.variableValue`) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,17 +24,14 @@ const IfElseNode: FC<NodeProps<IfElseNodeType>> = (props) => {
|
|||||||
if (!c.comparison_operator)
|
if (!c.comparison_operator)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
if (isEmptyRelatedOperator(c.comparison_operator!))
|
return (c.varType === VarType.boolean || c.varType === VarType.arrayBoolean) ? true : !!c.value
|
||||||
return true
|
|
||||||
|
|
||||||
return c.varType === VarType.boolean ? true : !!c.value
|
|
||||||
})
|
})
|
||||||
return isSet
|
return isSet
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (isEmptyRelatedOperator(condition.comparison_operator!))
|
if (isEmptyRelatedOperator(condition.comparison_operator!))
|
||||||
return true
|
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'>
|
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,
|
varType: varItem.type,
|
||||||
variable_selector: valueSelector,
|
variable_selector: valueSelector,
|
||||||
comparison_operator: getOperators(varItem.type, getIsVarFileAttribute(valueSelector) ? { key: valueSelector.slice(-1)[0] } : undefined)[0],
|
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,
|
isChatMode,
|
||||||
isConstant: false,
|
isConstant: false,
|
||||||
})
|
})
|
||||||
let itemVarType = varType
|
let itemVarType
|
||||||
switch (varType) {
|
switch (varType) {
|
||||||
case VarType.arrayNumber:
|
case VarType.arrayNumber:
|
||||||
itemVarType = VarType.number
|
itemVarType = VarType.number
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user