From 07f3ee59d74e291d8e9d40d02db667ea4046c734 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 5 Mar 2024 21:40:09 -0300 Subject: [PATCH] Refactor code in utils.py --- src/backend/langflow/interface/custom/utils.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/backend/langflow/interface/custom/utils.py b/src/backend/langflow/interface/custom/utils.py index 513669f75..c7e33b992 100644 --- a/src/backend/langflow/interface/custom/utils.py +++ b/src/backend/langflow/interface/custom/utils.py @@ -15,15 +15,12 @@ from langflow.interface.custom.attributes import ATTR_FUNC_MAPPING from langflow.interface.custom.code_parser.utils import extract_inner_type from langflow.interface.custom.custom_component import CustomComponent from langflow.interface.custom.directory_reader.utils import ( - build_custom_component_list_from_path, - determine_component_name, - merge_nested_dicts_with_renaming, -) + build_custom_component_list_from_path, determine_component_name, + merge_nested_dicts_with_renaming) from langflow.interface.custom.eval import eval_custom_component_code from langflow.template.field.base import TemplateField -from langflow.template.frontend_node.custom_components import ( - CustomComponentFrontendNode, -) +from langflow.template.frontend_node.custom_components import \ + CustomComponentFrontendNode from langflow.utils import validate from langflow.utils.util import get_base_classes @@ -224,6 +221,8 @@ def add_extra_fields(frontend_node, field_config, function_args): key in function_args_names for key in field_config.keys() ): for field_name, field_config in _field_config.copy().items(): + if "name" not in extra_field: + continue config = _field_config.get(field_name, {}) config = config.model_dump() if isinstance(config, BaseModel) else config field_name, field_type, field_value, field_required = get_field_properties(