From 48965a8ba8b6622792503e3a67e8029866715de2 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 21 Aug 2023 19:14:58 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(endpoints.py):=20add=20check?= =?UTF-8?q?=20for=20empty=20custom=5Fcomponent=5Fdict=20to=20prevent=20err?= =?UTF-8?q?ors=20=F0=9F=90=9B=20fix(login.py):=20update=20import=20stateme?= =?UTF-8?q?nt=20for=20auth=20utils=20module=20=F0=9F=90=9B=20fix(users.py)?= =?UTF-8?q?:=20update=20import=20statement=20for=20auth=20utils=20module?= =?UTF-8?q?=20=F0=9F=90=9B=20fix(factory.py):=20remove=20unnecessary=20arg?= =?UTF-8?q?ument=20from=20create=20method=20=F0=9F=90=9B=20fix(test=5Fcli.?= =?UTF-8?q?py):=20convert=20temp=5Fdir=20to=20string=20before=20checking?= =?UTF-8?q?=20if=20it's=20in=20COMPONENTS=5FPATH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/endpoints.py | 2 ++ src/backend/langflow/routers/login.py | 2 +- src/backend/langflow/routers/users.py | 2 +- src/backend/langflow/services/chat/factory.py | 2 +- tests/test_cli.py | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/backend/langflow/api/v1/endpoints.py b/src/backend/langflow/api/v1/endpoints.py index 928d6609c..221091b7f 100644 --- a/src/backend/langflow/api/v1/endpoints.py +++ b/src/backend/langflow/api/v1/endpoints.py @@ -59,6 +59,8 @@ def get_all(): logger.info(f"Loading {len(custom_component_dicts)} category(ies)") for custom_component_dict in custom_component_dicts: # custom_component_dict is a dict of dicts + if not custom_component_dict: + continue category = list(custom_component_dict.keys())[0] logger.info( f"Loading {len(custom_component_dict[category])} component(s) from category {category}" diff --git a/src/backend/langflow/routers/login.py b/src/backend/langflow/routers/login.py index 6a103d646..b559b0a23 100644 --- a/src/backend/langflow/routers/login.py +++ b/src/backend/langflow/routers/login.py @@ -4,7 +4,7 @@ from fastapi.security import OAuth2PasswordRequestForm from langflow.services.utils import get_session from langflow.services.database.models import Token -from langflow.auth.auth import ( +from langflow.services.auth.utils import ( authenticate_user, create_user_tokens, create_refresh_token, diff --git a/src/backend/langflow/routers/users.py b/src/backend/langflow/routers/users.py index 135437b74..2a944cb64 100644 --- a/src/backend/langflow/routers/users.py +++ b/src/backend/langflow/routers/users.py @@ -14,7 +14,7 @@ from sqlmodel import Session, select from fastapi import APIRouter, Depends, HTTPException from langflow.services.utils import get_session -from langflow.auth.auth import get_current_active_user, get_password_hash +from langflow.services.auth.utils import get_current_active_user, get_password_hash from langflow.services.database.models.user import ( update_user, ) diff --git a/src/backend/langflow/services/chat/factory.py b/src/backend/langflow/services/chat/factory.py index 03597ed11..ca844893a 100644 --- a/src/backend/langflow/services/chat/factory.py +++ b/src/backend/langflow/services/chat/factory.py @@ -6,6 +6,6 @@ class ChatManagerFactory(ServiceFactory): def __init__(self): super().__init__(ChatManager) - def create(self, settings_service): + def create(self): # Here you would have logic to create and configure a ChatManager return ChatManager() diff --git a/tests/test_cli.py b/tests/test_cli.py index 408500d7a..c990ef9e8 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -27,4 +27,4 @@ def test_components_path(runner, client, default_settings): ) assert result.exit_code == 0, result.stdout settings_manager = utils.get_settings_manager() - assert temp_dir in settings_manager.settings.COMPONENTS_PATH + assert str(temp_dir) in settings_manager.settings.COMPONENTS_PATH