Enhance email processing: improve logging for existing email checks and add unstructured.pytesseract to requirements
Browse files- app/controllers/mail.py +5 -3
- app/requirements.txt +1 -0
app/controllers/mail.py
CHANGED
@@ -76,10 +76,12 @@ def list_emails(service, messages):
|
|
76 |
for message in messages:
|
77 |
msg = service.users().messages().get(userId="me", id=message["id"], format="full").execute()
|
78 |
metadata = {}
|
79 |
-
logger.info("vectorstore.index_to_docstore_id: %s", vectorstore.index_to_docstore_id)
|
80 |
-
logger.info("type: %s", type(vectorstore.index_to_docstore_id))
|
81 |
-
if msg["id"] in vectorstore.index_to_docstore_id:
|
82 |
logger.info("Email already exists in the database.")
|
|
|
|
|
83 |
continue
|
84 |
for header in msg["payload"]["headers"]:
|
85 |
if header["name"] == "From":
|
|
|
76 |
for message in messages:
|
77 |
msg = service.users().messages().get(userId="me", id=message["id"], format="full").execute()
|
78 |
metadata = {}
|
79 |
+
logger.info("vectorstore.index_to_docstore_id: %s", vectorstore.index_to_docstore_id.values())
|
80 |
+
logger.info("type: %s", type(vectorstore.index_to_docstore_id.values()))
|
81 |
+
if msg["id"] in list(vectorstore.index_to_docstore_id.values()):
|
82 |
logger.info("Email already exists in the database.")
|
83 |
+
existing_ids = list(vectorstore.index_to_docstore_id.values())
|
84 |
+
logger.info("Existing email IDs in the database: %s", existing_ids)
|
85 |
continue
|
86 |
for header in msg["payload"]["headers"]:
|
87 |
if header["name"] == "From":
|
app/requirements.txt
CHANGED
@@ -193,6 +193,7 @@ tzdata==2025.1
|
|
193 |
unstructured==0.17.2
|
194 |
unstructured-client==0.32.0
|
195 |
unstructured-inference==0.8.10
|
|
|
196 |
uritemplate==4.1.1
|
197 |
urllib3==2.3.0
|
198 |
uvicorn==0.34.0
|
|
|
193 |
unstructured==0.17.2
|
194 |
unstructured-client==0.32.0
|
195 |
unstructured-inference==0.8.10
|
196 |
+
unstructured.pytesseract==0.3.15
|
197 |
uritemplate==4.1.1
|
198 |
urllib3==2.3.0
|
199 |
uvicorn==0.34.0
|