diff --git a/simplylab/services/__init__.py b/simplylab/services/__init__.py index 7512483..6dd7912 100644 --- a/simplylab/services/__init__.py +++ b/simplylab/services/__init__.py @@ -6,8 +6,8 @@ from simplylab.services.chat import ChatService class Services: - def __init__(self, ctx: Context, providers: Providers): - self.ctx = ctx + def __init__(self, context: Context, providers: Providers): + self.ctx = context self.pvd = providers @property diff --git a/simplylab/services/chat.py b/simplylab/services/chat.py index 02948f6..fd6831a 100644 --- a/simplylab/services/chat.py +++ b/simplylab/services/chat.py @@ -8,12 +8,14 @@ from simplylab.model.req import GetAiChatResponseInput, GetUserChatHistoryInput, from simplylab.model.table import MessageRoleType, Message from simplylab.error import MessageLimitedInDailyError, MessageLimitedIn30SecondsError from simplylab.providers import Providers +from simplylab.services.shared import ServicesShared class ChatService: - def __init__(self, ctx: Context, providers: Providers): - self.ctx = ctx + def __init__(self, context: Context, providers: Providers): + self.ctx = context self.pvd = providers + self.shared = ServicesShared(context, providers) async def get_ai_chat_response(self, req: GetAiChatResponseInput) -> GetAiChatResponseOutput: if await self.pvd.chat.check_user_message_limited_in_30_seconds(self.ctx.user.id): diff --git a/simplylab/services/shared/__init__.py b/simplylab/services/shared/__init__.py new file mode 100644 index 0000000..e254511 --- /dev/null +++ b/simplylab/services/shared/__init__.py @@ -0,0 +1,12 @@ +from simplylab.model.entity import Context +from simplylab.providers import Providers + + +class ServicesShared: + def __init__(self, context: Context, providers: Providers) -> None: + self.ctx = context + self.pvd = providers + + def do_sth(self): + res = self.pvd.user.get_user_by_name("SimplyLab") + return None