From af86cb3556394b561f9e116c84ccffddc2ed319b Mon Sep 17 00:00:00 2001 From: zhaoying Date: Tue, 7 Apr 2026 17:12:21 +0800 Subject: [PATCH] fix(web): tool node number support variable --- .../Properties/ToolConfig/index.tsx | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/web/src/views/Workflow/components/Properties/ToolConfig/index.tsx b/web/src/views/Workflow/components/Properties/ToolConfig/index.tsx index 8ae3cd4d..7857eb23 100644 --- a/web/src/views/Workflow/components/Properties/ToolConfig/index.tsx +++ b/web/src/views/Workflow/components/Properties/ToolConfig/index.tsx @@ -1,4 +1,4 @@ -import { type FC, useEffect, useState } from "react"; +import { type FC, useEffect, useState, useMemo } from "react"; import { useTranslation } from 'react-i18next' import { Form, Select, InputNumber, Switch, Cascader, type CascaderProps, Tooltip } from 'antd' import type { Suggestion } from '../../Editor/plugin/AutocompletePlugin' @@ -163,6 +163,24 @@ const ToolConfig: FC<{ options: Suggestion[]; }> = ({ form.setFieldsValue(inititalValue) } + const getNumberOptions = useMemo(() => { + const list: Suggestion[] = [] + + options.forEach(vo => { + if (vo.children && vo?.children?.length > 0) { + const filterChild = vo.children.filter(child => child.dataType === 'number') + + if (filterChild.length > 0) { + list.push({ ...vo, children: filterChild }) + } else { + list.push({ ...vo, children: [] }) + } + } else { + list.push({ ...vo }) + } + }) + return list + }, [options]) return ( <> @@ -202,15 +220,14 @@ const ToolConfig: FC<{ options: Suggestion[]; }> = ({ : parameter.type === 'boolean' ? : parameter.type === 'integer' || parameter.type === 'number' - ? form.setFieldValue(['tool_parameters', parameter.name], value)} - /> + ? :