From 8f20105b4b58b5fd3e36b54508a2db696edeba17 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 11 Oct 2023 18:33:13 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix(custom=5Fcomponent.py):=20fi?= =?UTF-8?q?x=20import=20statement=20for=20CUSTOM=5FCOMPONENT=5FSUPPORTED?= =?UTF-8?q?=5FTYPES=20=F0=9F=94=A7=20fix(custom=5Fcomponent.py):=20fix=20a?= =?UTF-8?q?rgument=20type=20in=20return=20statement=20of=20CustomComponent?= =?UTF-8?q?.get=5Fargs()=20=F0=9F=94=A7=20fix(custom=5Fcomponents.py):=20m?= =?UTF-8?q?ake=20description=20attribute=20optional=20in=20CustomComponent?= =?UTF-8?q?FrontendNode=20class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/custom/custom_component.py | 3 ++- .../langflow/template/frontend_node/custom_components.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/interface/custom/custom_component.py b/src/backend/langflow/interface/custom/custom_component.py index ccc0b08b2..42b68ed40 100644 --- a/src/backend/langflow/interface/custom/custom_component.py +++ b/src/backend/langflow/interface/custom/custom_component.py @@ -1,7 +1,7 @@ from typing import Any, Callable, List, Optional, Union from uuid import UUID from fastapi import HTTPException -from langflow.interface.custom.constants import CUSTOM_COMPONENT_SUPPORTED_TYPES +from langflow.field_typing.constants import CUSTOM_COMPONENT_SUPPORTED_TYPES from langflow.interface.custom.component import Component from langflow.interface.custom.directory_reader import DirectoryReader from langflow.services.getters import get_db_service @@ -108,6 +108,7 @@ class CustomComponent(Component, extra=Extra.allow): ), }, ) + # TODO arg type should be Data if it is None return args @property diff --git a/src/backend/langflow/template/frontend_node/custom_components.py b/src/backend/langflow/template/frontend_node/custom_components.py index 4f36a1c9f..e239775bc 100644 --- a/src/backend/langflow/template/frontend_node/custom_components.py +++ b/src/backend/langflow/template/frontend_node/custom_components.py @@ -2,6 +2,7 @@ from langflow.template.field.base import TemplateField from langflow.template.frontend_node.base import FrontendNode from langflow.template.template.base import Template from langflow.interface.custom.constants import DEFAULT_CUSTOM_COMPONENT_CODE +from typing import Optional class CustomComponentFrontendNode(FrontendNode): @@ -24,7 +25,7 @@ class CustomComponentFrontendNode(FrontendNode): ) ], ) - description: str = "Create any custom component you want!" + description: Optional[str] = None base_classes: list[str] = [] def to_dict(self):