(20241209) SMS auth and sending ready.

This commit is contained in:
2024-12-09 19:39:15 +05:30
parent d10b156c0b
commit 845827a6bc
18 changed files with 367 additions and 348 deletions
+5 -3
View File
@@ -72,6 +72,7 @@ from shared import constants
# Data Models:
from models.data.api.mail.sync import MailSyncRequestHeaders, MailSyncRequestData
from models.data.api.mail.sync import MailSyncOneResult, MailSyncManyResults
from models.data.core.user_info import CoreUserInfoModel
# To work with datatypes:
from typing import Literal
@@ -126,7 +127,7 @@ def init(blueprint_setup_state):
async def sync_mails(
user_info: dict,
user_info: CoreUserInfoModel,
mongo_conn: AsyncMongo,
llm: ChatOpenAI,
inbound_headers: dict,
@@ -136,6 +137,7 @@ async def sync_mails(
"""
A very simple function, but kept separate so that we get the option to switch between running it in the foreground
and running it in the background.
:param user_info: The information of the user as extracted from the session token.
:param mongo_conn: The instance of the database connector to use to sync the mails.
:param llm: The instance of the LLM to use to summarize the mails.
:param inbound_headers: The headers that came in with the request.
@@ -215,7 +217,7 @@ async def sync_mail(
if mode in ["background", "bg"]:
current_app.add_background_task(
sync_mails,
user_info = kwargs["session_info"],
user_info = CoreUserInfoModel(**kwargs["session_info"]),
mongo_conn = current_app.data_mongo,
llm = current_app.llm,
inbound_headers = inbound_headers,
@@ -229,7 +231,7 @@ async def sync_mail(
# Otherwise we process it right here:
sync_results = await sync_mails(
user_info = kwargs["session_info"],
user_info = CoreUserInfoModel(**kwargs["session_info"]),
mongo_conn = current_app.data_mongo,
llm = current_app.llm,
inbound_headers = inbound_headers,