Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions api/core/plugin/entities/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ class PluginParameter(BaseModel):
default: Union[float, int, str, bool, list, dict] | 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)

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions api/core/workflow/nodes/tool/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def check_type(cls, value, validation_info: ValidationInfo):
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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export type CredentialFormSchemaBase = {
label: TypeWithI18N
type: FormTypeEnum
required: boolean
multiple?: boolean
default?: string
tooltip?: TypeWithI18N
show_on: FormShowOnObject[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ const FormInputItem: FC<Props> = ({
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)
Expand All @@ -129,6 +131,8 @@ const FormInputItem: FC<Props> = ({
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)
Expand Down
Loading