diff --git a/src/backend/base/langflow/api/v1/endpoints.py b/src/backend/base/langflow/api/v1/endpoints.py index 93cdf2ce3..b4054fd3d 100644 --- a/src/backend/base/langflow/api/v1/endpoints.py +++ b/src/backend/base/langflow/api/v1/endpoints.py @@ -466,8 +466,8 @@ async def custom_component( component = Component(code=raw_code.code) built_frontend_node, component_instance = build_custom_component_template(component, user_id=user.id) - - built_frontend_node = component_instance.post_code_processing(built_frontend_node, raw_code.frontend_node) + if raw_code.frontend_node is not None: + built_frontend_node = component_instance.post_code_processing(built_frontend_node, raw_code.frontend_node) return built_frontend_node diff --git a/src/backend/base/langflow/custom/custom_component/component.py b/src/backend/base/langflow/custom/custom_component/component.py index b945f491f..592d8e2b3 100644 --- a/src/backend/base/langflow/custom/custom_component/component.py +++ b/src/backend/base/langflow/custom/custom_component/component.py @@ -225,12 +225,3 @@ class Component(CustomComponent): def build(self, **kwargs): self.set_attributes(kwargs) - - def post_code_processing(self, new_build_config: dict, current_build_config: dict): - """ - This function is called after the code validation is done. - """ - frontend_node = update_frontend_node_with_template_values( - frontend_node=new_build_config, raw_frontend_node=current_build_config - ) - return frontend_node diff --git a/src/backend/base/langflow/custom/custom_component/custom_component.py b/src/backend/base/langflow/custom/custom_component/custom_component.py index 369199148..5505ae132 100644 --- a/src/backend/base/langflow/custom/custom_component/custom_component.py +++ b/src/backend/base/langflow/custom/custom_component/custom_component.py @@ -17,6 +17,7 @@ from langflow.schema.schema import OutputLog from langflow.services.deps import get_storage_service, get_variable_service, session_scope from langflow.services.storage.service import StorageService from langflow.services.tracing.schema import Log +from langflow.template.utils import update_frontend_node_with_template_values from langflow.type_extraction.type_extraction import ( extract_inner_type_from_generic_alias, extract_union_types_from_generic_alias, @@ -495,3 +496,12 @@ class CustomComponent(BaseComponent): self._logs.append(log) if self.vertex: self._tracing_service.add_log(trace_name=self.vertex.id, log=log) + + def post_code_processing(self, new_build_config: dict, current_build_config: dict): + """ + This function is called after the code validation is done. + """ + frontend_node = update_frontend_node_with_template_values( + frontend_node=new_build_config, raw_frontend_node=current_build_config + ) + return frontend_node