mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-09 22:35:54 -05:00
fix(backend): clean up parsing a bit for gmail read (#10555)
<!-- Clearly explain the need for these changes: --> Toran hit an error on reading a snippet incorrectly ### Changes 🏗️ Does fallback getting from dictionary when building email objects <!-- Concisely describe all of the changes made in this pull request: --> ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [ ] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [ ] Deploy to dev and have Toran test against his inbox --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -310,18 +310,18 @@ class GmailReadBlock(Block):
|
||||
]
|
||||
|
||||
email = Email(
|
||||
threadId=msg["threadId"],
|
||||
threadId=msg.get("threadId", None),
|
||||
labelIds=msg.get("labelIds", []),
|
||||
id=msg["id"],
|
||||
subject=headers.get("subject", "No Subject"),
|
||||
snippet=msg["snippet"],
|
||||
snippet=msg.get("snippet", ""),
|
||||
from_=parseaddr(headers.get("from", ""))[1],
|
||||
to=to_recipients if to_recipients else [],
|
||||
cc=cc_recipients,
|
||||
bcc=bcc_recipients,
|
||||
date=headers.get("date", ""),
|
||||
body=await self._get_email_body(msg, service),
|
||||
sizeEstimate=msg["sizeEstimate"],
|
||||
sizeEstimate=msg.get("sizeEstimate", 0),
|
||||
attachments=attachments,
|
||||
)
|
||||
email_data.append(email)
|
||||
@@ -985,7 +985,7 @@ class GmailGetThreadBlock(Block):
|
||||
email = Email(
|
||||
threadId=msg.get("threadId", thread_id),
|
||||
labelIds=msg.get("labelIds", []),
|
||||
id=msg["id"],
|
||||
id=msg.get("id"),
|
||||
subject=headers.get("subject", "No Subject"),
|
||||
snippet=msg.get("snippet", ""),
|
||||
from_=parseaddr(headers.get("from", ""))[1],
|
||||
|
||||
Reference in New Issue
Block a user