From 25a59d745dda6f54ddd5eef3b171e64a75ec7d1e Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 28 Jul 2023 11:22:10 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(types.py):=20refactor=20ad?= =?UTF-8?q?d=5Fnew=5Fcustom=5Ffield=20function=20to=20improve=20readabilit?= =?UTF-8?q?y=20and=20maintainability=20=F0=9F=94=A7=20chore(types.py):=20r?= =?UTF-8?q?efactor=20build=5Ffield=5Fconfig=20function=20to=20improve=20re?= =?UTF-8?q?adability=20and=20maintainability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/types.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/interface/types.py b/src/backend/langflow/interface/types.py index 52d7666c0..3b62d24db 100644 --- a/src/backend/langflow/interface/types.py +++ b/src/backend/langflow/interface/types.py @@ -101,6 +101,11 @@ def add_new_custom_field( field_value = field_config.pop("value", field_value) field_advanced = field_config.pop("advanced", False) + # If options is a list, then it's a dropdown + # If options is None, then it's a list of strings + is_list = isinstance(field_config.get("options"), list) + field_config["is_list"] = is_list or field_config.get("is_list", False) + if "name" in field_config: warnings.warn( "The 'name' key in field_config is used to build the object and can't be changed." @@ -188,7 +193,6 @@ def update_display_name_and_description(frontend_node, template_config): def build_field_config(custom_component: CustomComponent): """Build the field configuration for a custom component""" - is_valid = custom_component.is_check_valid() try: custom_class = get_function_custom(custom_component.code)