From 628e78959dddf5d451ccac192824f26544994f60 Mon Sep 17 00:00:00 2001 From: italojohnny Date: Thu, 20 Jun 2024 21:06:54 -0300 Subject: [PATCH] fix union-attr error reported by mypy --- .../base/langflow/interface/initialize/loading.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/backend/base/langflow/interface/initialize/loading.py b/src/backend/base/langflow/interface/initialize/loading.py index c6b933f51..8e24ebc94 100644 --- a/src/backend/base/langflow/interface/initialize/loading.py +++ b/src/backend/base/langflow/interface/initialize/loading.py @@ -166,6 +166,10 @@ async def build_custom_component(params: dict, custom_component: "CustomComponen artifact_type = get_artifact_type(custom_component.repr_value or raw, build_result) raw = post_process_raw(raw, artifact_type) artifact = {"repr": custom_repr, "raw": raw, "type": artifact_type} - custom_component._artifacts = {custom_component.vertex.outputs[0].get("name"): artifact} - custom_component._results = {custom_component.vertex.outputs[0].get("name"): build_result} - return custom_component, build_result, artifact + + if custom_component.vertex is not None: + custom_component._artifacts = {custom_component.vertex.outputs[0].get("name"): artifact} + custom_component._results = {custom_component.vertex.outputs[0].get("name"): build_result} + return custom_component, build_result, artifact + + raise ValueError("Custom component does not have a vertex")