feat(api): add CHECKBOX parameter type to plugin and tool entities

- Introduced CHECKBOX as a new parameter type in CommonParameterType and PluginParameterType.
- Updated as_normal_type and cast_parameter_value functions to handle CHECKBOX type.
- Enhanced ToolParameter class to include CHECKBOX for consistency across parameter types.

These changes expand the parameter capabilities within the API, allowing for more versatile input options.
This commit is contained in:
Harry
2025-09-29 13:45:13 +08:00
parent 19cc67561b
commit e377e90666
4 changed files with 25 additions and 3 deletions

View File

@ -6,7 +6,13 @@ from typing import Any, Optional, Union
from pydantic import BaseModel, ConfigDict, Field
from core.entities.provider_entities import ProviderConfig
from core.plugin.entities.parameters import PluginParameterAutoGenerate, PluginParameterOption, PluginParameterTemplate
from core.plugin.entities.parameters import (
PluginParameterAutoGenerate,
PluginParameterOption,
PluginParameterTemplate,
as_normal_type,
cast_parameter_value,
)
from core.tools.entities.common_entities import I18nObject
@ -24,6 +30,13 @@ class TriggerParameterType(StrEnum):
OBJECT = "object"
ARRAY = "array"
DYNAMIC_SELECT = "dynamic-select"
CHECKBOX = "checkbox"
def as_normal_type(self):
return as_normal_type(self)
def cast_value(self, value: Any):
return cast_parameter_value(self, value)
class TriggerParameter(BaseModel):