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:
ogabrielluiz 2024-06-12 10:45:24 -03:00
commit d32b6bd031

View 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