(20241224) ..
This commit is contained in:
+15
-15
@@ -226,7 +226,7 @@ class MailController:
|
|||||||
|
|
||||||
# Invoke the LLM and return the response:
|
# Invoke the LLM and return the response:
|
||||||
return await llm.invoke(
|
return await llm.invoke(
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_conn = mongo_conn,
|
||||||
user_info = user_info,
|
user_info = user_info,
|
||||||
llm_input = LLMInput(
|
llm_input = LLMInput(
|
||||||
messages = prompt_template + [
|
messages = prompt_template + [
|
||||||
@@ -272,7 +272,7 @@ class MailController:
|
|||||||
|
|
||||||
# Simply call the core model:
|
# Simply call the core model:
|
||||||
return await current_app.core_auth_token_controller.get_token_key(
|
return await current_app.core_auth_token_controller.get_token_key(
|
||||||
db_conn = db_conn,
|
sql_conn = db_conn,
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_data_conn = mongo_conn,
|
||||||
auth_token = auth_token,
|
auth_token = auth_token,
|
||||||
token_notes = {
|
token_notes = {
|
||||||
@@ -292,7 +292,7 @@ class MailController:
|
|||||||
|
|
||||||
# Simply call the core model:
|
# Simply call the core model:
|
||||||
return await current_app.core_auth_token_controller.set_token(
|
return await current_app.core_auth_token_controller.set_token(
|
||||||
db_conn = db_conn,
|
sql_conn = db_conn,
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_data_conn = mongo_conn,
|
||||||
token_key = token_key,
|
token_key = token_key,
|
||||||
auth_token = auth_token,
|
auth_token = auth_token,
|
||||||
@@ -355,7 +355,7 @@ class MailController:
|
|||||||
# we first check if the mail already exists in our database:
|
# we first check if the mail already exists in our database:
|
||||||
if not force_sync:
|
if not force_sync:
|
||||||
mail_records = await current_app.core_message_controller.get_previews(
|
mail_records = await current_app.core_message_controller.get_previews(
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_conn = mongo_conn,
|
||||||
token_ids = [ObjectId(auth_token.authTokenId)],
|
token_ids = [ObjectId(auth_token.authTokenId)],
|
||||||
limit = 1,
|
limit = 1,
|
||||||
skip = 0,
|
skip = 0,
|
||||||
@@ -418,7 +418,7 @@ class MailController:
|
|||||||
# Invoke the LLM:
|
# Invoke the LLM:
|
||||||
try:
|
try:
|
||||||
ai_snippet = await self.summarize_mail_with_ai(
|
ai_snippet = await self.summarize_mail_with_ai(
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_conn = mongo_conn,
|
||||||
user_info = user_info,
|
user_info = user_info,
|
||||||
llm = llm,
|
llm = llm,
|
||||||
message = mail_message,
|
message = mail_message,
|
||||||
@@ -468,7 +468,7 @@ class MailController:
|
|||||||
auth_token.lastRefreshTs = date_time.get_current_utc_date_time(as_string = True)
|
auth_token.lastRefreshTs = date_time.get_current_utc_date_time(as_string = True)
|
||||||
await self.set_token(
|
await self.set_token(
|
||||||
db_conn = db_conn,
|
db_conn = db_conn,
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_conn = mongo_conn,
|
||||||
token_key = auth_token.key,
|
token_key = auth_token.key,
|
||||||
auth_token = auth_token,
|
auth_token = auth_token,
|
||||||
session_token = session_token
|
session_token = session_token
|
||||||
@@ -494,7 +494,7 @@ class MailController:
|
|||||||
# Now, for every mail in the list, we fetch the mail and note the results:
|
# Now, for every mail in the list, we fetch the mail and note the results:
|
||||||
tasks = [
|
tasks = [
|
||||||
self.__sync_one_gmail(
|
self.__sync_one_gmail(
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_conn = mongo_conn,
|
||||||
user_info = user_info,
|
user_info = user_info,
|
||||||
auth_token = auth_token,
|
auth_token = auth_token,
|
||||||
mail_client = mail_client,
|
mail_client = mail_client,
|
||||||
@@ -532,7 +532,7 @@ class MailController:
|
|||||||
# Make the bulk insert operation:
|
# Make the bulk insert operation:
|
||||||
if mongo_operations:
|
if mongo_operations:
|
||||||
sync_count = await current_app.core_message_controller.bulk_write(
|
sync_count = await current_app.core_message_controller.bulk_write(
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_conn = mongo_conn,
|
||||||
mongo_operations = mongo_operations
|
mongo_operations = mongo_operations
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -573,7 +573,7 @@ class MailController:
|
|||||||
|
|
||||||
# We first load the authorization tokens:
|
# We first load the authorization tokens:
|
||||||
auth_token = await self.get_token_from_key(
|
auth_token = await self.get_token_from_key(
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_conn = mongo_conn,
|
||||||
token_key = token_key,
|
token_key = token_key,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -589,7 +589,7 @@ class MailController:
|
|||||||
if auth_token.client == "gmail":
|
if auth_token.client == "gmail":
|
||||||
return await self.__sync_many_gmail(
|
return await self.__sync_many_gmail(
|
||||||
db_conn = db_conn,
|
db_conn = db_conn,
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_conn = mongo_conn,
|
||||||
user_info = user_info,
|
user_info = user_info,
|
||||||
auth_token = auth_token,
|
auth_token = auth_token,
|
||||||
mail_client = current_app.gmail_client,
|
mail_client = current_app.gmail_client,
|
||||||
@@ -657,7 +657,7 @@ class MailController:
|
|||||||
|
|
||||||
# We first load the authorization tokens:
|
# We first load the authorization tokens:
|
||||||
auth_token = await self.get_token_from_key(
|
auth_token = await self.get_token_from_key(
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_conn = mongo_conn,
|
||||||
token_key = token_key,
|
token_key = token_key,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -673,7 +673,7 @@ class MailController:
|
|||||||
# if auth_token.client == "gmail":
|
# if auth_token.client == "gmail":
|
||||||
# return await self.__send_one_gmail(
|
# return await self.__send_one_gmail(
|
||||||
# db_conn = db_conn,
|
# db_conn = db_conn,
|
||||||
# mongo_data_conn = mongo_conn,
|
# mongo_conn = mongo_conn,
|
||||||
# user_info = user_info,
|
# user_info = user_info,
|
||||||
# auth_token = auth_token,
|
# auth_token = auth_token,
|
||||||
# mail_client = current_app.gmail_client,
|
# mail_client = current_app.gmail_client,
|
||||||
@@ -717,7 +717,7 @@ class MailController:
|
|||||||
|
|
||||||
# Simply call the core model:
|
# Simply call the core model:
|
||||||
return await current_app.core_message_controller.get_previews(
|
return await current_app.core_message_controller.get_previews(
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_conn = mongo_conn,
|
||||||
token_ids = token_ids,
|
token_ids = token_ids,
|
||||||
limit = limit,
|
limit = limit,
|
||||||
skip = skip,
|
skip = skip,
|
||||||
@@ -732,7 +732,7 @@ class MailController:
|
|||||||
|
|
||||||
# Simply call the core model:
|
# Simply call the core model:
|
||||||
return await current_app.core_message_controller.get_message(
|
return await current_app.core_message_controller.get_message(
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_conn = mongo_conn,
|
||||||
message_id = message_id
|
message_id = message_id
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -751,7 +751,7 @@ class MailController:
|
|||||||
|
|
||||||
# Simply call the core model:
|
# Simply call the core model:
|
||||||
return await current_app.core_message_controller.update_tags(
|
return await current_app.core_message_controller.update_tags(
|
||||||
mongo_data_conn = mongo_conn,
|
mongo_conn = mongo_conn,
|
||||||
message_id = message_id,
|
message_id = message_id,
|
||||||
unset_tags = unset_tags,
|
unset_tags = unset_tags,
|
||||||
set_tags = set_tags
|
set_tags = set_tags
|
||||||
|
|||||||
Reference in New Issue
Block a user