From b772bbe9763d1d84c39f3916624835f30532e056 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 17 Aug 2023 22:33:52 -0300 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20fix(endpoints.py):=20add=20v?= =?UTF-8?q?alidation=20to=20ensure=20that=20custom=20components=20are=20in?= =?UTF-8?q?=20a=20single=20category?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/endpoints.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/backend/langflow/api/v1/endpoints.py b/src/backend/langflow/api/v1/endpoints.py index ca5e1c5c9..56ca36d6f 100644 --- a/src/backend/langflow/api/v1/endpoints.py +++ b/src/backend/langflow/api/v1/endpoints.py @@ -57,6 +57,13 @@ def get_all(): logger.info(f"Loading {len(custom_component_dicts)} category(ies)") for custom_component_dict in custom_component_dicts: # custom_component_dict is a dict of dicts + if len(custom_component_dict) > 1: + raise ValueError( + f"Custom components must be in a single category. Found {len(custom_component_dict)} categories" + ) + elif len(custom_component_dict) == 0: + continue + category = list(custom_component_dict.keys())[0] logger.info( f"Loading {len(custom_component_dict[category])} component(s) from category {category}" From d76cef81e84ffed5447965f76ed222c181d4c1e1 Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Thu, 17 Aug 2023 23:11:44 -0300 Subject: [PATCH 2/2] fix: Remove category log --- src/backend/langflow/api/v1/endpoints.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/backend/langflow/api/v1/endpoints.py b/src/backend/langflow/api/v1/endpoints.py index 56ca36d6f..1e1524222 100644 --- a/src/backend/langflow/api/v1/endpoints.py +++ b/src/backend/langflow/api/v1/endpoints.py @@ -56,18 +56,6 @@ def get_all(): logger.info(f"Loading {len(custom_component_dicts)} category(ies)") for custom_component_dict in custom_component_dicts: - # custom_component_dict is a dict of dicts - if len(custom_component_dict) > 1: - raise ValueError( - f"Custom components must be in a single category. Found {len(custom_component_dict)} categories" - ) - elif len(custom_component_dict) == 0: - continue - - category = list(custom_component_dict.keys())[0] - logger.info( - f"Loading {len(custom_component_dict[category])} component(s) from category {category}" - ) logger.debug(custom_component_dict) custom_components_from_file = merge_nested_dicts_with_renaming( custom_components_from_file, custom_component_dict