From 33331dced8cb1ac2d6ec5b0ba721d01a04bcfafe Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Mon, 17 Jun 2024 17:12:19 -0300 Subject: [PATCH] refactor: Update artifact handling in Component class --- .../langflow/custom/custom_component/component.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/backend/base/langflow/custom/custom_component/component.py b/src/backend/base/langflow/custom/custom_component/component.py index 58a387f1b..3d6bcef42 100644 --- a/src/backend/base/langflow/custom/custom_component/component.py +++ b/src/backend/base/langflow/custom/custom_component/component.py @@ -114,6 +114,12 @@ class Component(CustomComponent): if not isinstance(custom_repr, str): custom_repr = str(custom_repr) raw = result + if self.status is None: + artifact_value = raw + else: + artifact_value = self.status + raw = self.status + if hasattr(raw, "data") and raw is not None: raw = raw.data if raw is None: @@ -123,11 +129,6 @@ class Component(CustomComponent): raw = raw.model_dump() if raw is None and isinstance(result, (dict, Data, str)): raw = result.data if isinstance(result, Data) else result - if self.status is None: - artifact_value = raw - else: - artifact_value = self.status - raw = self.status artifact_type = get_artifact_type(artifact_value, result) raw = post_process_raw(raw, artifact_type) artifact = {"repr": custom_repr, "raw": raw, "type": artifact_type}