From 2de86cbac4ac74792f631d53108788d012dd69c6 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sat, 24 Jun 2023 16:32:00 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20docs(frontend=5Fnode):=20add=20s?= =?UTF-8?q?et=5Fdocumentation=20method=20to=20set=20the=20documentation=20?= =?UTF-8?q?of=20the=20frontend=20node=20=E2=9C=A8=20feat(frontend=5Fnode):?= =?UTF-8?q?=20add=20documentation=20field=20to=20the=20frontend=20node=20d?= =?UTF-8?q?ict=20representation=20The=20`set=5Fdocumentation`=20method=20i?= =?UTF-8?q?s=20added=20to=20the=20`FrontendNode`=20class=20to=20allow=20se?= =?UTF-8?q?tting=20the=20documentation=20of=20the=20frontend=20node.=20The?= =?UTF-8?q?=20`to=5Fdict`=20method=20is=20updated=20to=20include=20the=20`?= =?UTF-8?q?documentation`=20field=20in=20the=20dict=20representation=20of?= =?UTF-8?q?=20the=20frontend=20node.=20This=20improves=20the=20readability?= =?UTF-8?q?=20and=20usability=20of=20the=20frontend=20node=20by=20providin?= =?UTF-8?q?g=20documentation=20for=20the=20node.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/template/frontend_node/base.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/backend/langflow/template/frontend_node/base.py b/src/backend/langflow/template/frontend_node/base.py index 4801da086..751ecb709 100644 --- a/src/backend/langflow/template/frontend_node/base.py +++ b/src/backend/langflow/template/frontend_node/base.py @@ -15,14 +15,21 @@ class FrontendNode(BaseModel): base_classes: List[str] name: str = "" display_name: str = "" + documentation: str = "" + + def set_documentation(self, documentation: str) -> None: + """Sets the documentation of the frontend node.""" + self.documentation = documentation def to_dict(self) -> dict: + """Returns a dict representation of the frontend node.""" return { self.name: { "template": self.template.to_dict(self.format_field), "description": self.description, "base_classes": self.base_classes, "display_name": self.display_name or self.name, + "documentation": self.documentation, }, }