From c86fd2f7415a786ef51f9f6aba60a8bdf1eb569b Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 3 Aug 2023 11:43:18 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(types.py):=20change=20update?= =?UTF-8?q?=5Fdisplay=5Fname=5Fand=5Fdescription=20function=20name=20to=20?= =?UTF-8?q?update=5Fattributes=20to=20reflect=20its=20purpose=20more=20acc?= =?UTF-8?q?urately=20=F0=9F=90=9B=20fix(component.py):=20change=20field=5F?= =?UTF-8?q?config=20key=20to=20beta=20in=20template=5Fconfig=20dictionary?= =?UTF-8?q?=20to=20match=20the=20expected=20key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/custom/component.py | 4 ++-- src/backend/langflow/interface/types.py | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/backend/langflow/interface/custom/component.py b/src/backend/langflow/interface/custom/component.py index a9dc0f323..e18be4fa2 100644 --- a/src/backend/langflow/interface/custom/component.py +++ b/src/backend/langflow/interface/custom/component.py @@ -63,8 +63,8 @@ class Component(BaseModel): elif "description" in item_name: template_config["description"] = ast.literal_eval(item_value) - elif "field_config" in item_name: - template_config["field_config"] = ast.literal_eval(item_value) + elif "beta" in item_name: + template_config["beta"] = ast.literal_eval(item_value) return template_config diff --git a/src/backend/langflow/interface/types.py b/src/backend/langflow/interface/types.py index 46fa781d6..a0ad518bd 100644 --- a/src/backend/langflow/interface/types.py +++ b/src/backend/langflow/interface/types.py @@ -145,7 +145,7 @@ def add_code_field(template, raw_code, field_config): "dynamic": True, "required": True, "placeholder": "", - "show": True, + "show": field_config.pop("show", True), "multiline": True, "value": raw_code, "password": False, @@ -186,7 +186,7 @@ def build_frontend_node(custom_component: CustomComponent): return None -def update_display_name_and_description(frontend_node, template_config): +def update_attributes(frontend_node, template_config): """Update the display name and description of a frontend node""" if "display_name" in template_config: frontend_node["display_name"] = template_config["display_name"] @@ -194,6 +194,9 @@ def update_display_name_and_description(frontend_node, template_config): if "description" in template_config: frontend_node["description"] = template_config["description"] + if "beta" in template_config: + frontend_node["beta"] = template_config["beta"] + def build_field_config(custom_component: CustomComponent): """Build the field configuration for a custom component""" @@ -281,7 +284,7 @@ def build_langchain_template_custom_component(custom_component: CustomComponent) template_config = custom_component.build_template_config - update_display_name_and_description(frontend_node, template_config) + update_attributes(frontend_node, template_config) field_config = build_field_config(custom_component) add_extra_fields(