mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-19 01:45:57 +08:00
feat: if support file exist
This commit is contained in:
parent
9851153d38
commit
c014ae43e1
@ -35,10 +35,10 @@ const IfElseNode: FC<NodeProps<IfElseNodeType>> = (props) => {
|
|||||||
<div className='space-y-0.5'>
|
<div className='space-y-0.5'>
|
||||||
{caseItem.conditions.map((condition, i) => (
|
{caseItem.conditions.map((condition, i) => (
|
||||||
<div key={condition.id} className='relative'>
|
<div key={condition.id} className='relative'>
|
||||||
{(condition.variable_selector?.length > 0 && condition.comparison_operator && (isEmptyRelatedOperator(condition.comparison_operator!) ? true : !!condition.value))
|
{((condition.variable_selector && condition.variable_selector?.length > 0) && condition.comparison_operator && (isEmptyRelatedOperator(condition.comparison_operator!) ? true : !!condition.value))
|
||||||
? (
|
? (
|
||||||
<ConditionValue
|
<ConditionValue
|
||||||
variableSelector={condition.variable_selector}
|
variableSelector={condition.variable_selector!}
|
||||||
operator={condition.comparison_operator}
|
operator={condition.comparison_operator}
|
||||||
value={condition.value}
|
value={condition.value}
|
||||||
/>
|
/>
|
||||||
|
@ -31,6 +31,8 @@ export enum ComparisonOperator {
|
|||||||
in = 'in',
|
in = 'in',
|
||||||
notIn = 'not in',
|
notIn = 'not in',
|
||||||
allOf = 'all of',
|
allOf = 'all of',
|
||||||
|
exists = 'exists',
|
||||||
|
notExists = 'not exists',
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Condition = {
|
export type Condition = {
|
||||||
|
@ -107,6 +107,11 @@ export const getOperators = (type?: VarType, file?: { key: string }) => {
|
|||||||
ComparisonOperator.empty,
|
ComparisonOperator.empty,
|
||||||
ComparisonOperator.notEmpty,
|
ComparisonOperator.notEmpty,
|
||||||
]
|
]
|
||||||
|
case VarType.file:
|
||||||
|
return [
|
||||||
|
ComparisonOperator.exists,
|
||||||
|
ComparisonOperator.notExists,
|
||||||
|
]
|
||||||
case VarType.arrayString:
|
case VarType.arrayString:
|
||||||
case VarType.arrayNumber:
|
case VarType.arrayNumber:
|
||||||
return [
|
return [
|
||||||
@ -143,7 +148,7 @@ export const comparisonOperatorNotRequireValue = (operator?: ComparisonOperator)
|
|||||||
if (!operator)
|
if (!operator)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
return [ComparisonOperator.empty, ComparisonOperator.notEmpty, ComparisonOperator.isNull, ComparisonOperator.isNotNull].includes(operator)
|
return [ComparisonOperator.empty, ComparisonOperator.notEmpty, ComparisonOperator.isNull, ComparisonOperator.isNotNull, ComparisonOperator.exists, ComparisonOperator.notExists].includes(operator)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const branchNameCorrect = (branches: Branch[]) => {
|
export const branchNameCorrect = (branches: Branch[]) => {
|
||||||
|
@ -421,6 +421,8 @@ const translation = {
|
|||||||
'in': 'in',
|
'in': 'in',
|
||||||
'not in': 'not in',
|
'not in': 'not in',
|
||||||
'all of': 'all of',
|
'all of': 'all of',
|
||||||
|
'exists': 'exists',
|
||||||
|
'not exists': 'not exists',
|
||||||
},
|
},
|
||||||
optionName: {
|
optionName: {
|
||||||
image: 'Image',
|
image: 'Image',
|
||||||
|
@ -421,6 +421,8 @@ const translation = {
|
|||||||
'in': '是',
|
'in': '是',
|
||||||
'not in': '不是',
|
'not in': '不是',
|
||||||
'all of': '全部是',
|
'all of': '全部是',
|
||||||
|
'exists': '存在',
|
||||||
|
'not exists': '不存在',
|
||||||
},
|
},
|
||||||
optionName: {
|
optionName: {
|
||||||
image: '图片',
|
image: '图片',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user