From 49029d6cdab54a841618e34460628af71046f8da Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 14 Jul 2023 14:13:27 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(base.py):=20refactor=20Tem?= =?UTF-8?q?plateFieldCreator=20class=20to=20improve=20code=20readability?= =?UTF-8?q?=20and=20maintainability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/template/field/base.py | 36 ++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/template/field/base.py b/src/backend/langflow/template/field/base.py index dcdb3ea92..31c68d094 100644 --- a/src/backend/langflow/template/field/base.py +++ b/src/backend/langflow/template/field/base.py @@ -6,24 +6,58 @@ from pydantic import BaseModel class TemplateFieldCreator(BaseModel, ABC): field_type: str = "str" + """The type of field this is. Default is a string.""" + required: bool = False + """Specifies if the field is required. Defaults to False.""" + placeholder: str = "" + """A placeholder string for the field. Default is an empty string.""" + is_list: bool = False + """Defines if the field is a list. Default is False.""" + show: bool = True + """Should the field be shown. Defaults to True.""" + multiline: bool = False + """Defines if the field will allow the user to open a text editor. Default is False.""" + value: Any = None + """The value of the field. Default is None.""" + suffixes: list[str] = [] - fileTypes: list[str] = [] + """List of suffixes for a file field. Default is an empty list.""" + file_types: list[str] = [] + """List of file types associated with the field. Default is an empty list. (duplicate)""" + file_path: Union[str, None] = None + """The file path of the field if it is a file. Defaults to None.""" + password: bool = False + """Specifies if the field is a password. Defaults to False.""" + options: list[str] = [] + """List of options for the field. Only used when is_list=True. Default is an empty list.""" + name: str = "" + """Name of the field. Default is an empty string.""" + display_name: Optional[str] = None + """Display name of the field. Defaults to None.""" + advanced: bool = False + """Specifies if the field will an advanced parameter (hidden). Defaults to False.""" + input_types: list[str] = [] + """List of input types for the handle when the field has more than one type. Default is an empty list.""" + dynamic: bool = False + """Specifies if the field is dynamic. Defaults to False.""" + info: Optional[str] = "" + """Additional information about the field to be shown in the tooltip. Defaults to an empty string.""" def to_dict(self): result = self.dict()