(20241203) Mail sync'ing started. You can now hit a dedicated API endpoint to trigger a mail-sync process (in the background if you want) and save the mails to your database.
This commit is contained in:
+18
-2
@@ -52,7 +52,7 @@ from shared import constants
|
||||
from utils_v2.string import json
|
||||
from utils_v2.api import async_quart
|
||||
from utils_v2.date_time import date_time
|
||||
from utils_v2.database.async_mongo_v2 import AsyncMongo
|
||||
from utils_v2.database.async_mongo_v2 import AsyncMongo, AsyncMongoStorage
|
||||
from utils_v2.database.async_mysql_v2 import AsyncMySQL
|
||||
from utils_v2.cache.async_redis_cache_v2 import AsyncRedisCache
|
||||
from utils_v2.serialization.json_serializer import JSONSerializer
|
||||
@@ -72,7 +72,7 @@ from utils_v2.goog.gmail.gmail_client import AsyncGMailClient
|
||||
|
||||
# Behaviour Models:
|
||||
from models.behaviour.mail.oauth_v2 import MailOAuthModel
|
||||
from models.behaviour.mail.sync import MailSyncModel
|
||||
from models.behaviour.mail.sync_v2 import MailSyncModel
|
||||
|
||||
# To make REST API calls:
|
||||
import httpx
|
||||
@@ -90,6 +90,9 @@ from api.blueprints.test.callback import test_callback_bp
|
||||
# All the helpers:
|
||||
from api.helpers.user import session
|
||||
|
||||
# To work with LLMs:
|
||||
from langchain_openai import ChatOpenAI
|
||||
|
||||
|
||||
# *****************************************************************************************************************
|
||||
# ***** ****
|
||||
@@ -278,6 +281,13 @@ async def app_startup(**kwargs):
|
||||
debug = enable_debugging
|
||||
)
|
||||
await current_app.data_mongo.connect()
|
||||
current_app.files_mongo = AsyncMongo(
|
||||
connection_string = script_cred["mongoDb"]["files"]["connectionString"],
|
||||
database_name = script_cred["mongoDb"]["files"]["dbName"],
|
||||
max_connections = script_cred["mongoDb"]["files"]["poolSize"],
|
||||
debug = enable_debugging
|
||||
)
|
||||
await current_app.data_mongo.connect()
|
||||
|
||||
# ┳ ┓ ┳┳┓ ┓ ┓
|
||||
# ┃┏┓╋┏┓┏┓┏┓┏┓┃ ┃┃┃┏┓┏┫┏┓┃┏
|
||||
@@ -315,6 +325,12 @@ async def app_startup(**kwargs):
|
||||
debug_only_errors = False
|
||||
)
|
||||
|
||||
# For LLMs:
|
||||
current_app.llm = ChatOpenAI(
|
||||
model = script_cred["openAi"]["model"],
|
||||
openai_api_key = script_cred["openAi"]["openai_api_key"]
|
||||
)
|
||||
|
||||
# Pick the important stuff:
|
||||
current_app.whitelisted_ips = current_app.script_data["whitelistedIps"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user