diff --git a/web/app/components/workflow/nodes/if-else/node.tsx b/web/app/components/workflow/nodes/if-else/node.tsx index 67ce6529a6..b1c0a4cc25 100644 --- a/web/app/components/workflow/nodes/if-else/node.tsx +++ b/web/app/components/workflow/nodes/if-else/node.tsx @@ -35,10 +35,10 @@ const IfElseNode: FC> = (props) => {
{caseItem.conditions.map((condition, i) => (
- {(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)) ? ( diff --git a/web/app/components/workflow/nodes/if-else/types.ts b/web/app/components/workflow/nodes/if-else/types.ts index 6fabe70d50..9b4097a3da 100644 --- a/web/app/components/workflow/nodes/if-else/types.ts +++ b/web/app/components/workflow/nodes/if-else/types.ts @@ -31,6 +31,8 @@ export enum ComparisonOperator { in = 'in', notIn = 'not in', allOf = 'all of', + exists = 'exists', + notExists = 'not exists', } export type Condition = { diff --git a/web/app/components/workflow/nodes/if-else/utils.ts b/web/app/components/workflow/nodes/if-else/utils.ts index 66f361ce90..e034ce98df 100644 --- a/web/app/components/workflow/nodes/if-else/utils.ts +++ b/web/app/components/workflow/nodes/if-else/utils.ts @@ -107,6 +107,11 @@ export const getOperators = (type?: VarType, file?: { key: string }) => { ComparisonOperator.empty, ComparisonOperator.notEmpty, ] + case VarType.file: + return [ + ComparisonOperator.exists, + ComparisonOperator.notExists, + ] case VarType.arrayString: case VarType.arrayNumber: return [ @@ -143,7 +148,7 @@ export const comparisonOperatorNotRequireValue = (operator?: ComparisonOperator) if (!operator) 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[]) => { diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index 2d5dd33cdf..a1582480f0 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -421,6 +421,8 @@ const translation = { 'in': 'in', 'not in': 'not in', 'all of': 'all of', + 'exists': 'exists', + 'not exists': 'not exists', }, optionName: { image: 'Image', diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index 9b0d0c6188..58366647b9 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -421,6 +421,8 @@ const translation = { 'in': '是', 'not in': '不是', 'all of': '全部是', + 'exists': '存在', + 'not exists': '不存在', }, optionName: { image: '图片',