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 <gabriel@langflow.org> --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
a4a70d4aea
commit
b38b6aa601
1 changed files with 8 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue