(20241203) Mails sync'ing, listing, and fetching done.
This commit is contained in:
+21
-3
@@ -73,6 +73,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_v2 import MailSyncModel
|
||||
from models.behaviour.mail.retrieve import MailRetrieveModel
|
||||
|
||||
# To make REST API calls:
|
||||
import httpx
|
||||
@@ -84,6 +85,8 @@ from icecream import IceCreamDebugger
|
||||
from api.blueprints.mail.oauth_request import mail_oauth_bp
|
||||
from api.blueprints.mail.oauth_callback import mail_callback_bp
|
||||
from api.blueprints.mail.sync import mail_sync_bp
|
||||
from api.blueprints.mail.list import mail_list_bp
|
||||
from api.blueprints.mail.retrieve import mail_retrieve_bp
|
||||
from api.blueprints.tech.chat_alerts import tech_chat_alert_bp
|
||||
from api.blueprints.test.callback import test_callback_bp
|
||||
|
||||
@@ -119,6 +122,8 @@ app = cors(app)
|
||||
app.register_blueprint(mail_oauth_bp, url_prefix = f"/{MODULE_BASE}/mail")
|
||||
app.register_blueprint(mail_callback_bp, url_prefix = f"/{MODULE_BASE}/mail")
|
||||
app.register_blueprint(mail_sync_bp, url_prefix = f"/{MODULE_BASE}/mail")
|
||||
app.register_blueprint(mail_list_bp, url_prefix = f"/{MODULE_BASE}/mail")
|
||||
app.register_blueprint(mail_retrieve_bp, url_prefix = f"/{MODULE_BASE}/mail")
|
||||
app.register_blueprint(tech_chat_alert_bp, url_prefix = f"/{MODULE_BASE}/tech/alert")
|
||||
app.register_blueprint(test_callback_bp, url_prefix = f"/{MODULE_BASE}/test")
|
||||
|
||||
@@ -309,10 +314,18 @@ async def app_startup(**kwargs):
|
||||
debug_prefix = "Mail-Sync | ",
|
||||
debug_only_errors = True
|
||||
)
|
||||
current_app.mail_retrieve_model = MailRetrieveModel(
|
||||
cache = current_app.module_cache,
|
||||
alert_url = current_app.script_data["alerts"]["url"],
|
||||
http_client = current_app.http_client,
|
||||
debug = enable_debugging,
|
||||
debug_prefix = "Mail-Retr | ",
|
||||
debug_only_errors = True
|
||||
)
|
||||
|
||||
# ┏┓
|
||||
# ┃ ┏┓┏┓┏┓┏┓┏╋┏┓┏┓┏
|
||||
# ┗┛┗┛┛┗┛┗┗ ┗┗┗┛┛ ┛
|
||||
# ┏┓ ┓ ┏┓┓•
|
||||
# ┃ ┏┓┏┓┏┓┏┓┏╋┏┓┏┓┏ ┏┓┏┓┏┫ ┃ ┃┓┏┓┏┓╋┏
|
||||
# ┗┛┗┛┛┗┛┗┗ ┗┗┗┛┛ ┛ ┗┻┛┗┗┻ ┗┛┗┗┗ ┛┗┗┛
|
||||
|
||||
# Create an instance to handle GMail-related activities:
|
||||
current_app.gmail_client = AsyncGMailClient(
|
||||
@@ -325,6 +338,11 @@ async def app_startup(**kwargs):
|
||||
debug_only_errors = False
|
||||
)
|
||||
|
||||
# ┏┓┳ ┳┳┓ •
|
||||
# ┣┫┃ ┃┃┃┏┓┏┓┓┏
|
||||
# ┛┗┻ ┛ ┗┗┻┗┫┗┗
|
||||
# ┛
|
||||
|
||||
# For LLMs:
|
||||
current_app.llm = ChatOpenAI(
|
||||
model = script_cred["openAi"]["model"],
|
||||
|
||||
Reference in New Issue
Block a user