🐛 fix(base.py): fix typo in "successfully" in the built object representation message
🐛 fix(custom_component.py): add support for custom representation of repr_value if it is a dictionary by using yaml.dump() function
This commit is contained in:
parent
16be5f573a
commit
3583161064
2 changed files with 8 additions and 1 deletions
|
|
@ -269,4 +269,8 @@ class Vertex:
|
||||||
|
|
||||||
def _built_object_repr(self):
|
def _built_object_repr(self):
|
||||||
# Add a message with an emoji, stars for sucess,
|
# 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 😵💫"
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ from langflow.utils import validate
|
||||||
from langflow.database.base import session_getter
|
from langflow.database.base import session_getter
|
||||||
from langflow.database.models.flow import Flow
|
from langflow.database.models.flow import Flow
|
||||||
from pydantic import Extra
|
from pydantic import Extra
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
class CustomComponent(Component, extra=Extra.allow):
|
class CustomComponent(Component, extra=Extra.allow):
|
||||||
|
|
@ -24,6 +25,8 @@ class CustomComponent(Component, extra=Extra.allow):
|
||||||
super().__init__(**data)
|
super().__init__(**data)
|
||||||
|
|
||||||
def custom_repr(self):
|
def custom_repr(self):
|
||||||
|
if isinstance(self.repr_value, dict):
|
||||||
|
return yaml.dump(self.repr_value)
|
||||||
if isinstance(self.repr_value, str):
|
if isinstance(self.repr_value, str):
|
||||||
return self.repr_value
|
return self.repr_value
|
||||||
return str(self.repr_value)
|
return str(self.repr_value)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue