diff --git a/src/backend/base/langflow/custom/custom_component/component.py b/src/backend/base/langflow/custom/custom_component/component.py index 639dbc240f1e..cd950a85f66b 100644 --- a/src/backend/base/langflow/custom/custom_component/component.py +++ b/src/backend/base/langflow/custom/custom_component/component.py @@ -957,19 +957,19 @@ def _build_artifact(self, result): custom_repr = str(custom_repr) raw = self._process_raw_result(result) - artifact_type = get_artifact_type(self.status or raw, result) + artifact_type = get_artifact_type(raw or self.status, result) raw, artifact_type = post_process_raw(raw, artifact_type) return {"repr": custom_repr, "raw": raw, "type": artifact_type} def _process_raw_result(self, result): - if self.status: - raw = self.status - elif hasattr(result, "data"): + if hasattr(result, "data"): raw = result.data elif hasattr(result, "model_dump"): raw = result.model_dump() elif isinstance(result, dict | Data | str): raw = result.data if isinstance(result, Data) else result + elif self.status: + raw = self.status else: raw = result return raw diff --git a/src/backend/base/langflow/schema/artifact.py b/src/backend/base/langflow/schema/artifact.py index fcf9109621e7..03be57867aa4 100644 --- a/src/backend/base/langflow/schema/artifact.py +++ b/src/backend/base/langflow/schema/artifact.py @@ -63,6 +63,8 @@ def _to_list_of_dicts(raw): def post_process_raw(raw, artifact_type: str): + default_message = "Built Successfully ✨" + if artifact_type == ArtifactType.STREAM.value: raw = "" elif artifact_type == ArtifactType.ARRAY.value: @@ -74,7 +76,7 @@ def post_process_raw(raw, artifact_type: str): artifact_type = ArtifactType.OBJECT.value except Exception: # noqa: BLE001 logger.opt(exception=True).debug(f"Error converting to json: {raw} ({type(raw)})") - raw = "Built Successfully ✨" + raw = default_message else: - raw = "Built Successfully ✨" + raw = default_message return raw, artifact_type