Project / core /pipeline /user_management_pipeline.py
puzan789's picture
updated
ad87194
raw
history blame
3.55 kB
from core.services.supabase.user_management.user_service import UserManagement
from core.services.supabase.user_management.chatbot_management import SupabaseChatoBotManagement
from core.services.supabase.chat_ai_setup.chataiusermanagement import ChatAIUserDBSetup
from core.services.supabase.user_management.chat_history import get_chat_history
from supabase.client import create_client
from qdrant_client import QdrantClient
import os
SUPABASE_URL = os.getenv("SUPABASE_URL")
SUPABASE_KEY = os.getenv("SUPABASE_KEY")
QDRANT_URL = os.getenv("QDRANT_URL")
QDRANT_API_KEY = os.getenv("QDRANT_API_KEY")
class SupabaseUserManagementPipeline:
def __init__(self):
self.supabase_client = create_client(SUPABASE_URL, SUPABASE_KEY)
self.qdrant_client = QdrantClient(url=QDRANT_URL, api_key=QDRANT_API_KEY)
self.user_management = UserManagement(supabase_client=self.supabase_client)
self.chatbot_management = SupabaseChatoBotManagement(supabase_client=self.supabase_client,
qdrant_client=self.qdrant_client)
self.user_db_setup = ChatAIUserDBSetup(supabase_client=self.supabase_client)
def user_signup_(self, username: str,password: str,email:str) -> dict:
return self.user_management.user_signup(username=username, password=password, email=email)
def user_signin_(self, username: str, password: str,email:str) -> dict:
return self.user_management.user_signin(username=username, password=password,email=email)
def check_session_(self) -> dict:
return self.user_management.check_session()
def get_user_data_(self, access_token: str) -> dict:
return self.user_management.get_user_data(access_token=access_token)
def refresh_session__(self, refresh_token: str) -> dict:
return self.user_management.refresh_session_(refresh_token=refresh_token)
def login_with_access_token_(self, access_token: str, refresh_token: str) -> dict:
return self.user_management.login_with_access_token(access_token=access_token, refresh_token=refresh_token)
def username_creation_oauth_(self, username: str, user_id: str):
return self.user_management.user_name_creation_oauth(user_id=user_id, username=username)
def set_session_data_(self, access_token: str, refresh_token: str, user_id: str):
return self.user_management.set_session_data(access_token=access_token, refresh_token=refresh_token,
user_id=user_id)
def sign_out_(self):
return self.user_management.sign_out_()
def oauth_signin_(self) -> dict:
return self.user_management.oauth()
def new_chatbot_(self, chatbot_name: str, username: str):
return self.chatbot_management.new_chatbot(chatbot_name=chatbot_name, username=username)
def get_chat_history_(self, vectorstore: str):
return get_chat_history(vectorstore=vectorstore, supabase_client=self.supabase_client)
def delete_table(self, table_name: str):
return self.chatbot_management.delete_table(table_name=table_name)
def list_tables(self, username: str):
return self.chatbot_management.list_tables(username=username)
def create_data_source_name(self, source_name: str, username: str):
return self.chatbot_management.create_data_source_name(source_name=source_name, username=username)
def delete_qdrant_cluster(self, vectorstorename):
self.qdrant_client.delete_collection(collection_name=vectorstorename)