From d1657eb9e73d890fcbe0066e2f8272ed9e28800f Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 3 Aug 2023 14:32:00 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20refactor(endpoints.py):=20remove?= =?UTF-8?q?=20unused=20imports=20and=20endpoints?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The following changes were made: - Removed unused imports from the file - Removed the unused `get_load_custom_component_from_path` endpoint - Removed the unused `get_load_custom_component_from_path_test` endpoint --- src/backend/langflow/api/v1/endpoints.py | 30 ------------------------ 1 file changed, 30 deletions(-) diff --git a/src/backend/langflow/api/v1/endpoints.py b/src/backend/langflow/api/v1/endpoints.py index f11a23340..c8e3673a8 100644 --- a/src/backend/langflow/api/v1/endpoints.py +++ b/src/backend/langflow/api/v1/endpoints.py @@ -11,9 +11,6 @@ from fastapi import APIRouter, Depends, HTTPException, UploadFile, Body from langflow.interface.custom.custom_component import CustomComponent -from langflow.interface.custom.directory_reader import ( - CustomComponentPathValueError, -) from langflow.api.v1.schemas import ( ProcessResponse, @@ -39,7 +36,6 @@ router = APIRouter(tags=["Base"]) @router.get("/all") def get_all(): native_components = build_langchain_types_dict() - # custom_components is a list of dicts # need to merge all the keys into one dict custom_components_from_file = {} @@ -55,32 +51,6 @@ def get_all(): return merge_nested_dicts(native_components, custom_components_from_file) -@router.get("/load_custom_component_from_path") -def get_load_custom_component_from_path(path: str): - try: - data = build_langchain_custom_component_list_from_path(path) - except CustomComponentPathValueError as err: - raise HTTPException( - status_code=400, - detail={"error": type(err).__name__, "traceback": str(err)}, - ) from err - - return data - - -@router.get("/load_custom_component_from_path_TEST") -def get_load_custom_component_from_path_test(path: str): - from langflow.interface.custom.directory_reader import ( - DirectoryReader, - ) - - reader = DirectoryReader(path, False) - file_list = reader.get_files() - data = reader.build_component_menu_list(file_list) - - return reader.filter_loaded_components(data, True) - - # For backwards compatibility we will keep the old endpoint @router.post("/predict/{flow_id}", response_model=ProcessResponse) @router.post("/process/{flow_id}", response_model=ProcessResponse)