From 0ecb5317492c3f768a3d433b814f252867866f45 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 28 Jun 2023 11:33:42 -0300 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=A7=20fix(base.py):=20add=20input?= =?UTF-8?q?=5Ftypes=20property=20to=20TemplateFieldCreator=20class=20?= =?UTF-8?q?=F0=9F=94=A7=20fix(index.ts):=20add=20input=5Ftypes=20property?= =?UTF-8?q?=20to=20TemplateVariableType=20interface=20The=20`input=5Ftypes?= =?UTF-8?q?`=20property=20is=20added=20to=20the=20`TemplateFieldCreator`?= =?UTF-8?q?=20class=20in=20`base.py`=20and=20the=20`TemplateVariableType`?= =?UTF-8?q?=20interface=20in=20`index.ts`.=20This=20change=20allows=20for?= =?UTF-8?q?=20specifying=20the=20input=20types=20for=20template=20fields?= =?UTF-8?q?=20and=20template=20variables,=20respectively.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/template/field/base.py | 1 + src/frontend/src/types/api/index.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/backend/langflow/template/field/base.py b/src/backend/langflow/template/field/base.py index a9c18ff63..b73a516b4 100644 --- a/src/backend/langflow/template/field/base.py +++ b/src/backend/langflow/template/field/base.py @@ -21,6 +21,7 @@ class TemplateFieldCreator(BaseModel, ABC): name: str = "" display_name: Optional[str] = None advanced: bool = False + input_types: list[str] = [] def to_dict(self): result = self.dict() diff --git a/src/frontend/src/types/api/index.ts b/src/frontend/src/types/api/index.ts index 7fc10f309..ecd79240e 100644 --- a/src/frontend/src/types/api/index.ts +++ b/src/frontend/src/types/api/index.ts @@ -23,6 +23,7 @@ export type TemplateVariableType = { show: boolean; multiline?: boolean; value?: any; + input_types?: Array; [key: string]: any; }; export type sendAllProps = { From 40179ee0118664a4ab240d8053ec70239f33304d Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 28 Jun 2023 11:33:56 -0300 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=A7=20chore(validate.py):=20add=20?= =?UTF-8?q?input=5Ftypes=20to=20template=5Ffield=20in=20post=5Fvalidate=5F?= =?UTF-8?q?prompt=20function=20The=20input=5Ftypes=20attribute=20is=20adde?= =?UTF-8?q?d=20to=20the=20template=5Ffield=20in=20the=20post=5Fvalidate=5F?= =?UTF-8?q?prompt=20function.=20This=20change=20allows=20for=20specifying?= =?UTF-8?q?=20the=20input=20types=20that=20are=20accepted=20for=20the=20te?= =?UTF-8?q?mplate=20field,=20providing=20more=20flexibility=20and=20contro?= =?UTF-8?q?l=20over=20the=20input=20data.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/validate.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/langflow/api/v1/validate.py b/src/backend/langflow/api/v1/validate.py index 64e2b9c98..1223029b8 100644 --- a/src/backend/langflow/api/v1/validate.py +++ b/src/backend/langflow/api/v1/validate.py @@ -42,6 +42,7 @@ def post_validate_prompt(prompt: ValidatePromptRequest): field_type="str", show=True, advanced=False, + input_types=["BaseLoader"], ) prompt.frontend_node.template[variable] = template_field.to_dict()