From 3583161064ac1fba90bf6e8bbf36a3fc98ebef63 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 4 Aug 2023 13:49:19 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(base.py):=20fix=20typo=20in?= =?UTF-8?q?=20"successfully"=20in=20the=20built=20object=20representation?= =?UTF-8?q?=20message=20=F0=9F=90=9B=20fix(custom=5Fcomponent.py):=20add?= =?UTF-8?q?=20support=20for=20custom=20representation=20of=20repr=5Fvalue?= =?UTF-8?q?=20if=20it=20is=20a=20dictionary=20by=20using=20yaml.dump()=20f?= =?UTF-8?q?unction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/graph/vertex/base.py | 6 +++++- src/backend/langflow/interface/custom/custom_component.py | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/graph/vertex/base.py b/src/backend/langflow/graph/vertex/base.py index 5139b6e90..cb7dc4905 100644 --- a/src/backend/langflow/graph/vertex/base.py +++ b/src/backend/langflow/graph/vertex/base.py @@ -269,4 +269,8 @@ class Vertex: def _built_object_repr(self): # Add a message with an emoji, stars for sucess, - return "Built sucessfully ✨" if self._built_object else "Failed to build 😵‍💫" + return ( + "Built sucessfully ✨" + if self._built_object is not None + else "Failed to build 😵‍💫" + ) diff --git a/src/backend/langflow/interface/custom/custom_component.py b/src/backend/langflow/interface/custom/custom_component.py index 200625be5..ce8956660 100644 --- a/src/backend/langflow/interface/custom/custom_component.py +++ b/src/backend/langflow/interface/custom/custom_component.py @@ -9,6 +9,7 @@ from langflow.utils import validate from langflow.database.base import session_getter from langflow.database.models.flow import Flow from pydantic import Extra +import yaml class CustomComponent(Component, extra=Extra.allow): @@ -24,6 +25,8 @@ class CustomComponent(Component, extra=Extra.allow): super().__init__(**data) def custom_repr(self): + if isinstance(self.repr_value, dict): + return yaml.dump(self.repr_value) if isinstance(self.repr_value, str): return self.repr_value return str(self.repr_value)