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

@@ -15,6 +15,7 @@ import type {
} from '../app/type';
import { EditorVariablePickerType } from '../../../web/components/common/Textarea/PromptEditor/type';
import { defaultWhisperConfig } from '../app/constants';
import { IfElseResultEnum } from './template/system/ifElse/constant';
export const getHandleId = (nodeId: string, type: 'source' | 'target', key: string) => {
return `${nodeId}-${type}-${key}`;
@@ -136,3 +137,7 @@ export const formatEditorVariablePickerIcon = (
export const isReferenceValue = (value: any): boolean => {
return Array.isArray(value) && value.length === 2 && typeof value[0] === 'string';
};
export const getElseIFLabel = (i: number) => {
return i === 0 ? IfElseResultEnum.IF : `${IfElseResultEnum.ELSE_IF} ${i}`;
};