From b38b6aa6013d4b9f01e623709040e1021c9152b1 Mon Sep 17 00:00:00 2001 From: Edwin Jose Date: Thu, 13 Feb 2025 15:49:47 -0500 Subject: [PATCH] fix: inconsistent text table result for Message Type output, setting message.text as default status instead of Table as self.status (#6319) * update message output to display only the text * Update component.py * Update component.py * [autofix.ci] apply automated fixes * Update src/backend/base/langflow/custom/custom_component/component.py Co-authored-by: Gabriel Luiz Freitas Almeida --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Gabriel Luiz Freitas Almeida --- .../base/langflow/custom/custom_component/component.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/backend/base/langflow/custom/custom_component/component.py b/src/backend/base/langflow/custom/custom_component/component.py index b43bef9f0..6e40bcea5 100644 --- a/src/backend/base/langflow/custom/custom_component/component.py +++ b/src/backend/base/langflow/custom/custom_component/component.py @@ -981,17 +981,23 @@ class Component(CustomComponent): return {"repr": custom_repr, "raw": raw, "type": artifact_type} def _process_raw_result(self, result): - if len(self.outputs) == 1: - return self.status or self.extract_data(result) + """Process the raw result of the component.""" return self.extract_data(result) def extract_data(self, result): + """Extract the data from the result. this is where the self.status is set.""" + if isinstance(result, Message): + self.status = result.get_text() + return ( + self.status if self.status is not None else "No text available" + ) # Provide a default message if .text_key is missing if hasattr(result, "data"): return result.data if hasattr(result, "model_dump"): return result.model_dump() if isinstance(result, Data | dict | str): return result.data if isinstance(result, Data) else result + if self.status: return self.status return result