From c9f49690801e85b60081f258967864084ca751ef Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 24 Aug 2023 22:49:52 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(types.py):=20fix=20regex=20p?= =?UTF-8?q?attern=20in=20extract=5Ftype=5Ffrom=5Foptional=20function=20to?= =?UTF-8?q?=20correctly=20extract=20type=20from=20optional=20field=5Ftype?= =?UTF-8?q?=20=F0=9F=90=9B=20fix(types.py):=20fix=20logic=20in=20add=5Fnew?= =?UTF-8?q?=5Fcustom=5Ffield=20function=20to=20correctly=20set=20is=5Flist?= =?UTF-8?q?=20flag=20when=20field=5Ftype=20contains=20"list"=20keyword=20?= =?UTF-8?q?=E2=9C=A8=20feat(types.py):=20add=20field=5Fcontains=5Flist=20v?= =?UTF-8?q?ariable=20to=20check=20if=20field=5Ftype=20contains=20"list"=20?= =?UTF-8?q?keyword=20to=20improve=20semantics=20in=20add=5Fnew=5Fcustom=5F?= =?UTF-8?q?field=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/types.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/interface/types.py b/src/backend/langflow/interface/types.py index 6f4b6a8cd..e558a3e0c 100644 --- a/src/backend/langflow/interface/types.py +++ b/src/backend/langflow/interface/types.py @@ -103,6 +103,7 @@ def add_new_custom_field( # if it is, update the value display_name = field_config.pop("display_name", field_name) field_type = field_config.pop("field_type", field_type) + field_contains_list = "list" in field_type.lower() field_type = process_type(field_type) field_value = field_config.pop("value", field_value) field_advanced = field_config.pop("advanced", False) @@ -113,7 +114,9 @@ def add_new_custom_field( # 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) + field_config["is_list"] = ( + is_list or field_config.get("is_list", False) or field_contains_list + ) if "name" in field_config: warnings.warn( @@ -175,7 +178,7 @@ def extract_type_from_optional(field_type): Returns: str: The extracted type, or an empty string if no type was found. """ - match = re.search(r"\[(.*?)\]", field_type) + match = re.search(r"\[(.*?)\]$", field_type) return match[1] if match else None