From 2b97b280c979c4fffbe6cf75f03f8b436744cc46 Mon Sep 17 00:00:00 2001 From: hjlarry Date: Fri, 5 Dec 2025 14:41:05 +0800 Subject: [PATCH 1/3] feat: support tool multi-select input --- api/core/plugin/entities/parameters.py | 13 ++++++++++--- api/core/workflow/nodes/tool/entities.py | 4 ++-- .../model-provider-page/declarations.ts | 1 + .../nodes/_base/components/form-input-item.tsx | 4 ++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/api/core/plugin/entities/parameters.py b/api/core/plugin/entities/parameters.py index 88a3a7bd43..0d1157497e 100644 --- a/api/core/plugin/entities/parameters.py +++ b/api/core/plugin/entities/parameters.py @@ -76,9 +76,13 @@ class PluginParameter(BaseModel): auto_generate: PluginParameterAutoGenerate | None = None template: PluginParameterTemplate | None = None required: bool = False - default: Union[float, int, str, bool] | None = None + default: Union[float, int, str, bool, list] | None = None min: Union[float, int] | None = None max: Union[float, int] | None = None + multiple: bool | None = Field( + default=False, + description="Whether the parameter is multiple select, only valid for select or dynamic-select type", + ) precision: int | None = None options: list[PluginParameterOption] = Field(default_factory=list) @@ -112,8 +116,11 @@ def cast_parameter_value(typ: StrEnum, value: Any, /): ): if value is None: return "" - else: - return value if isinstance(value, str) else str(value) + if isinstance(value, list): + return value + if isinstance(value, str): + return value + return str(value) case PluginParameterType.BOOLEAN: if value is None: diff --git a/api/core/workflow/nodes/tool/entities.py b/api/core/workflow/nodes/tool/entities.py index c1cfbb1edc..0bf274115c 100644 --- a/api/core/workflow/nodes/tool/entities.py +++ b/api/core/workflow/nodes/tool/entities.py @@ -54,8 +54,8 @@ class ToolNodeData(BaseNodeData, ToolEntity): for val in value: if not isinstance(val, str): raise ValueError("value must be a list of strings") - elif typ == "constant" and not isinstance(value, str | int | float | bool | dict): - raise ValueError("value must be a string, int, float, bool or dict") + elif typ == "constant" and not isinstance(value, str | int | float | bool | list | dict): + raise ValueError("value must be a string, int, float, bool, list or dict") return typ tool_parameters: dict[str, ToolInput] diff --git a/web/app/components/header/account-setting/model-provider-page/declarations.ts b/web/app/components/header/account-setting/model-provider-page/declarations.ts index 9a3c45cace..6121ae61ff 100644 --- a/web/app/components/header/account-setting/model-provider-page/declarations.ts +++ b/web/app/components/header/account-setting/model-provider-page/declarations.ts @@ -121,6 +121,7 @@ export type CredentialFormSchemaBase = { label: TypeWithI18N type: FormTypeEnum required: boolean + multiple?: boolean default?: string tooltip?: TypeWithI18N show_on: FormShowOnObject[] diff --git a/web/app/components/workflow/nodes/_base/components/form-input-item.tsx b/web/app/components/workflow/nodes/_base/components/form-input-item.tsx index 14a0f19317..61bf1aaa48 100644 --- a/web/app/components/workflow/nodes/_base/components/form-input-item.tsx +++ b/web/app/components/workflow/nodes/_base/components/form-input-item.tsx @@ -110,6 +110,8 @@ const FormInputItem: FC = ({ return VarType.arrayFile else if (type === FormTypeEnum.file) return VarType.file + else if (isMultipleSelect) + return VarType.array else if (isSelect) return VarType.string // else if (isAppSelector) @@ -129,6 +131,8 @@ const FormInputItem: FC = ({ const getFilterVar = () => { if (isNumber) return (varPayload: any) => varPayload.type === VarType.number + else if (isMultipleSelect) + return (varPayload: any) => [VarType.array, VarType.arrayString, VarType.arrayNumber, VarType.arrayObject].includes(varPayload.type) else if (isString) return (varPayload: any) => [VarType.string, VarType.number, VarType.secret].includes(varPayload.type) else if (isFile) From 8225e3db8b2d3a435e840e26b2ebc0853028adad Mon Sep 17 00:00:00 2001 From: hjlarry Date: Fri, 5 Dec 2025 14:51:15 +0800 Subject: [PATCH 2/3] fix: incorrect text color under dark theme --- .../datasets/hit-testing/components/result-item-external.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/components/datasets/hit-testing/components/result-item-external.tsx b/web/app/components/datasets/hit-testing/components/result-item-external.tsx index 2c793cd54a..cf8011dbeb 100644 --- a/web/app/components/datasets/hit-testing/components/result-item-external.tsx +++ b/web/app/components/datasets/hit-testing/components/result-item-external.tsx @@ -31,7 +31,7 @@ const ResultItemExternal: FC = ({ payload, positionId }) => { {/* Main */}
-
{content}
+
{content}
{/* Foot */} From a4aead52c9f0a955295c0bf9115d8161f3eeda69 Mon Sep 17 00:00:00 2001 From: hjlarry Date: Fri, 5 Dec 2025 14:51:41 +0800 Subject: [PATCH 3/3] Revert "fix: incorrect text color under dark theme" This reverts commit 8225e3db8b2d3a435e840e26b2ebc0853028adad. --- .../datasets/hit-testing/components/result-item-external.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/components/datasets/hit-testing/components/result-item-external.tsx b/web/app/components/datasets/hit-testing/components/result-item-external.tsx index cf8011dbeb..2c793cd54a 100644 --- a/web/app/components/datasets/hit-testing/components/result-item-external.tsx +++ b/web/app/components/datasets/hit-testing/components/result-item-external.tsx @@ -31,7 +31,7 @@ const ResultItemExternal: FC = ({ payload, positionId }) => { {/* Main */}
-
{content}
+
{content}
{/* Foot */}