refactor: Add field input classes for different data types
Add field input classes for different data types in the `inputs.py` file. This change allows for better organization and separation of concerns in the codebase. Each input class specifies the field type and provides default values or options where applicable. This update improves the maintainability and extensibility of the codebase.
This commit is contained in:
parent
e5fe8be38e
commit
d32b6bd031
1 changed files with 46 additions and 0 deletions
46
src/backend/base/langflow/template/field/inputs.py
Normal file
46
src/backend/base/langflow/template/field/inputs.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
from pydantic import SecretStr
|
||||
|
||||
from langflow.field_typing.constants import NestedDict
|
||||
from langflow.template.field.base import Input
|
||||
|
||||
|
||||
class StrInput(Input):
|
||||
field_type: str | type | None = str
|
||||
|
||||
|
||||
class SecretStrInput(Input):
|
||||
field_type: str | type | None = SecretStr
|
||||
password = True
|
||||
|
||||
|
||||
class IntInput(Input):
|
||||
field_type: str | type | None = int
|
||||
|
||||
|
||||
class FloatInput(Input):
|
||||
field_type: str | type | None = float
|
||||
|
||||
|
||||
class BoolInput(Input):
|
||||
field_type: str | type | None = bool
|
||||
|
||||
|
||||
class NestedDictInput(Input):
|
||||
field_type: str | type | None = NestedDict
|
||||
|
||||
|
||||
class DictInput(Input):
|
||||
field_type: str | type | None = dict
|
||||
|
||||
|
||||
class ListInput(Input):
|
||||
is_list = True
|
||||
|
||||
|
||||
class DropdownInput(Input):
|
||||
field_type: str | type | None = str
|
||||
options = []
|
||||
|
||||
|
||||
class FileInput(Input):
|
||||
field_type: str | type | None = str
|
||||
Loading…
Add table
Add a link
Reference in a new issue