📦 chore(factory.py): add AuthManagerFactory class to handle creation of AuthManager service

🐛 fix(service.py): add type hints and import for SettingsManager in AuthManager class
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-21 16:58:09 -03:00
commit 031ab7e4b7
2 changed files with 17 additions and 1 deletions

View file

@ -0,0 +1,12 @@
from langflow.services.factory import ServiceFactory
from langflow.services.auth.service import AuthManager
class AuthManagerFactory(ServiceFactory):
name = "auth_manager"
def __init__(self):
super().__init__(AuthManager)
def create(self, settings_manager):
return AuthManager(settings_manager)

View file

@ -1,10 +1,14 @@
from langflow.services.base import Service
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from langflow.services.settings.manager import SettingsManager
class AuthManager(Service):
name = "auth_manager"
def __init__(self, settings_manager):
def __init__(self, settings_manager: "SettingsManager"):
self.settings_manager = settings_manager
# We need to define a function that can be passed to the Depends() function.