From 82fcdfb67a6f7fa9ee012719d29d64813af76d77 Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Thu, 30 May 2024 18:29:40 -0300 Subject: [PATCH] feat: Add inputs and outputs to CustomComponent This commit adds the `inputs` and `outputs` fields to the `CustomComponent` class in the `custom_component.py` file. The `inputs` field is of type `List[Input]` and the `outputs` field is of type `List[Output]`. This change allows for better organization and management of the component's input and output fields. --- .../langflow/custom/custom_component/custom_component.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/base/langflow/custom/custom_component/custom_component.py b/src/backend/base/langflow/custom/custom_component/custom_component.py index aeac9cae6..75cbabfe8 100644 --- a/src/backend/base/langflow/custom/custom_component/custom_component.py +++ b/src/backend/base/langflow/custom/custom_component/custom_component.py @@ -7,6 +7,7 @@ import yaml from cachetools import TTLCache, cachedmethod from langchain_core.documents import Document from pydantic import BaseModel + from langflow.custom.code_parser.utils import ( extract_inner_type_from_generic_alias, extract_union_types_from_generic_alias, @@ -17,6 +18,7 @@ from langflow.schema import Record from langflow.schema.dotdict import dotdict from langflow.services.deps import get_storage_service, get_variable_service, session_scope from langflow.services.storage.service import StorageService +from langflow.template.field.base import Input, Output from langflow.utils import validate if TYPE_CHECKING: @@ -78,6 +80,9 @@ class CustomComponent(Component): """The status of the component. This is displayed on the frontend. Defaults to None.""" _flows_records: Optional[List[Record]] = None + inputs: Optional[List[Input]] = None + outputs: Optional[List[Output]] = None + def update_state(self, name: str, value: Any): if not self.vertex: raise ValueError("Vertex is not set") @@ -464,3 +469,4 @@ class CustomComponent(Component): Any: The result of the build process. """ raise NotImplementedError + raise NotImplementedError