diff --git a/web/app/components/workflow/nodes/agent/components/tool-condition/condition-item.tsx b/web/app/components/workflow/nodes/agent/components/tool-condition/condition-item.tsx index da611a1e39..b8b9608c3c 100644 --- a/web/app/components/workflow/nodes/agent/components/tool-condition/condition-item.tsx +++ b/web/app/components/workflow/nodes/agent/components/tool-condition/condition-item.tsx @@ -1,8 +1,4 @@ -import { - useCallback, - useMemo, - useState, -} from 'react' +import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import { RiDeleteBinLine } from '@remixicon/react' import { produce } from 'immer' @@ -24,9 +20,9 @@ import type { } from '@/app/components/workflow/types' import { VarType } from '@/app/components/workflow/types' import Input from '@/app/components/base/input' -import { SimpleSelect as Select } from '@/app/components/base/select' import ConditionInput from './condition-input' import cn from '@/utils/classnames' +import BoolValue from '@/app/components/workflow/panel/chat-variable-panel/components/bool-value' type Props = { className?: string @@ -51,10 +47,6 @@ const ConditionItem = ({ const [open, setOpen] = useState(false) const needsValue = operatorNeedsValue(condition.comparison_operator) - const booleanOptions = useMemo(() => ([ - { name: t('common.operation.yes'), value: 'true' }, - { name: t('common.operation.no'), value: 'false' }, - ]), [t]) const handleSelectVar = useCallback((valueSelector: ValueSelector, varItem: Var) => { const operators = getConditionOperators(varItem.type) @@ -91,29 +83,44 @@ const ConditionItem = ({ }, [handleValueChange]) const handleBooleanValueChange = useCallback((value: boolean) => { + if (disabled) + return handleValueChange(value) - }, [handleValueChange]) + }, [disabled, handleValueChange]) const renderValueInput = () => { if (!needsValue) return