From d32b6bd0314e862076879abb69b7106d2fc9d3da Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Wed, 12 Jun 2024 10:45:24 -0300 Subject: [PATCH] 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. --- .../base/langflow/template/field/inputs.py | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/backend/base/langflow/template/field/inputs.py diff --git a/src/backend/base/langflow/template/field/inputs.py b/src/backend/base/langflow/template/field/inputs.py new file mode 100644 index 000000000..c71061f6e --- /dev/null +++ b/src/backend/base/langflow/template/field/inputs.py @@ -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