From 07e8e318ee16f605cff3e5bacc28cea1c4eba52f Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 27 Oct 2023 19:52:56 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20refactor(store.py):=20remove=20u?= =?UTF-8?q?nused=20code=20for=20creating=20component=20metadata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code was previously responsible for creating metadata for a component based on the nodes it contains. However, this functionality is no longer needed and has been removed to simplify the code and improve maintainability. --- src/backend/langflow/api/v1/store.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/backend/langflow/api/v1/store.py b/src/backend/langflow/api/v1/store.py index ac8de676f..5341a9fce 100644 --- a/src/backend/langflow/api/v1/store.py +++ b/src/backend/langflow/api/v1/store.py @@ -64,22 +64,6 @@ def create_component( store_api_Key: str = Depends(get_user_store_api_key), ): try: - # We need to add the metadata using the Component.data - # data is a dict that contains 'nodes' key. - # each node has an id like "SomeType-RANDOMSTRING" - # we need to create a metadata dict with SomeType as key - # and the value is the count this type appears in the nodes - # e.g. - # { - # "SomeType": { - # "count": 2 - # }, - # "total": 2 - # } - names = [node["id"].split("-")[0] for node in component.data["nodes"]] - metadata = {name: {"count": names.count(name)} for name in names} - metadata["total"] = len(names) - component.metadata = metadata return store_service.upload(store_api_Key, component) except Exception as exc: raise HTTPException(status_code=400, detail=str(exc))