fix: if else node (#1383)

* fix: if else node

* fix

* fix
This commit is contained in:
heheer
2024-05-07 17:16:33 +08:00
committed by GitHub
parent 8f9203c053
commit 2a99e46353
6 changed files with 81 additions and 38 deletions

View File

@@ -25,6 +25,8 @@ import {
import { getSystemVariables } from '../app/utils';
import { TFunction } from 'next-i18next';
import { ReferenceValueProps } from '@fastgpt/global/core/workflow/type/io';
import { IfElseListItemType } from '@fastgpt/global/core/workflow/template/system/ifElse/type';
import { VariableConditionEnum } from '@fastgpt/global/core/workflow/template/system/ifElse/constant';
export const nodeTemplate2FlowNode = ({
template,
@@ -188,6 +190,29 @@ export const checkWorkflowNodeAndConnection = ({
continue;
}
if (data.flowNodeType === FlowNodeTypeEnum.ifElseNode) {
const ifElseList: IfElseListItemType[] = inputs.find(
(input) => input.key === NodeInputKeyEnum.ifElseList
)?.value;
if (
ifElseList.some((item) => {
return item.list.some((listItem) => {
return (
listItem.variable === undefined ||
listItem.condition === undefined ||
(listItem.value === undefined &&
listItem.condition !== VariableConditionEnum.isEmpty &&
listItem.condition !== VariableConditionEnum.isNotEmpty)
);
});
})
) {
return [data.nodeId];
} else {
continue;
}
}
// check node input
if (
inputs.some((input) => {