From cf63926e16dbcf3ea7eb6bd61c3066a7e217a15b Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 24 Jul 2025 15:59:44 +0800 Subject: [PATCH] chore: assigner node --- web/app/components/app/configuration/index.tsx | 4 ++-- .../nodes/_base/components/before-run-form/form-item.tsx | 2 +- .../nodes/assigner/components/var-list/index.tsx | 9 ++++++++- web/app/components/workflow/nodes/assigner/utils.ts | 2 +- web/app/components/workflow/nodes/if-else/default.ts | 4 ++-- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/web/app/components/app/configuration/index.tsx b/web/app/components/app/configuration/index.tsx index a7041d4a9e..5525a24a28 100644 --- a/web/app/components/app/configuration/index.tsx +++ b/web/app/components/app/configuration/index.tsx @@ -81,6 +81,7 @@ import { supportFunctionCall } from '@/utils/tool-call' import { MittProvider } from '@/context/mitt-context' import { fetchAndMergeValidCompletionParams } from '@/utils/completion-params' import Toast from '@/app/components/base/toast' +import { fetchCollectionList } from '@/service/tools' type PublishConfig = { modelConfig: ModelConfig @@ -520,8 +521,7 @@ const Configuration: FC = () => { useEffect(() => { (async () => { - // const collectionList = await fetchCollectionList() - const collectionList: any[] = [] // this api has problem in dev, so comment it for temporarily + const collectionList = await fetchCollectionList() if (basePath) { collectionList.forEach((item) => { if (typeof item.icon == 'string' && !item.icon.includes(basePath)) diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx index 06cb80f6e3..b0dde28988 100644 --- a/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx +++ b/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx @@ -168,7 +168,7 @@ const FormItem: FC = ({ ) } - { isBooleanType && ( + {isBooleanType && ( = ({ }, [list, onChange]) const handleToAssignedVarChange = useCallback((index: number) => { - return (value: ValueSelector | string | number) => { + return (value: ValueSelector | string | number | boolean) => { const newList = produce(list, (draft) => { draft[index].value = value as ValueSelector }) @@ -188,6 +189,12 @@ const VarList: FC = ({ className='w-full' /> )} + {assignedVarType === 'boolean' && ( + handleToAssignedVarChange(index)(value)} + /> + )} {assignedVarType === 'object' && ( ({ value: type, name: type, diff --git a/web/app/components/workflow/nodes/if-else/default.ts b/web/app/components/workflow/nodes/if-else/default.ts index 1be80592e5..b8c88ed990 100644 --- a/web/app/components/workflow/nodes/if-else/default.ts +++ b/web/app/components/workflow/nodes/if-else/default.ts @@ -1,4 +1,4 @@ -import { BlockEnum, type NodeDefault } from '../../types' +import { BlockEnum, type NodeDefault, VarType } from '../../types' import { type IfElseNodeType, LogicalOperator } from './types' import { isEmptyRelatedOperator } from './utils' import { ALL_CHAT_AVAILABLE_BLOCKS, ALL_COMPLETION_AVAILABLE_BLOCKS } from '@/app/components/workflow/blocks' @@ -64,7 +64,7 @@ const nodeDefault: NodeDefault = { errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t(`${i18nPrefix}.fields.variableValue`) }) } else { - if (!isEmptyRelatedOperator(condition.comparison_operator!) && !condition.value) + if (!isEmptyRelatedOperator(condition.comparison_operator!) && (condition.varType === VarType.boolean ? condition.value === undefined : !condition.value)) errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t(`${i18nPrefix}.fields.variableValue`) }) } }