fix: adding chainfrontendnode

This commit is contained in:
Gabriel Almeida 2023-04-08 08:55:22 -03:00 committed by Gabriel Luiz Freitas Almeida
commit cfd4a229ea
2 changed files with 16 additions and 1 deletions

View file

@ -1,9 +1,10 @@
from typing import Dict, List, Optional
from typing import Dict, List, Optional, Type
from langflow.custom.customs import get_custom_nodes
from langflow.interface.base import LangChainTypeCreator
from langflow.interface.custom_lists import chain_type_to_cls_dict
from langflow.settings import settings
from langflow.template.nodes import ChainFrontendNode
from langflow.utils.util import build_template_from_class
# Assuming necessary imports for Field, Template, and FrontendNode classes
@ -12,6 +13,10 @@ from langflow.utils.util import build_template_from_class
class ChainCreator(LangChainTypeCreator):
type_name: str = "chains"
@property
def frontend_node_class(self) -> Type[ChainFrontendNode]:
return ChainFrontendNode
@property
def type_to_loader_dict(self) -> Dict:
if self.type_dict is None:

View file

@ -289,3 +289,13 @@ class MemoryFrontendNode(FrontendNode):
field.field_type = "int"
field.value = 10
field.display_name = "Memory Size"
class ChainFrontendNode(FrontendNode):
@staticmethod
def format_field(field: TemplateField, name: Optional[str] = None) -> None:
FrontendNode.format_field(field, name)
if "key" in field.name:
field.password = False
field.show = False