fix: #457 llm will add rfp compliant id when replying
This commit is contained in:
@@ -36,7 +36,12 @@ logger = logging.getLogger(__name__)
|
|||||||
GMAIL_BATCH_SIZE = 25
|
GMAIL_BATCH_SIZE = 25
|
||||||
GMAIL_REQUEST_DELAY = 0.1
|
GMAIL_REQUEST_DELAY = 0.1
|
||||||
HTML_BODY_TRUNCATE_LIMIT = 20000
|
HTML_BODY_TRUNCATE_LIMIT = 20000
|
||||||
GMAIL_METADATA_HEADERS = ["Subject", "From", "To", "Cc", "Message-ID", "Date"]
|
|
||||||
|
GMAIL_METADATA_HEADERS = [
|
||||||
|
"Subject", "From", "To", "Cc",
|
||||||
|
"Message-ID", "In-Reply-To", "References",
|
||||||
|
"Date"
|
||||||
|
]
|
||||||
LOW_VALUE_TEXT_PLACEHOLDERS = (
|
LOW_VALUE_TEXT_PLACEHOLDERS = (
|
||||||
"your client does not support html",
|
"your client does not support html",
|
||||||
"view this email in your browser",
|
"view this email in your browser",
|
||||||
@@ -75,6 +80,8 @@ class _HTMLTextExtractor(HTMLParser):
|
|||||||
return " ".join("".join(self._text).split())
|
return " ".join("".join(self._text).split())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _html_to_text(html: str) -> str:
|
def _html_to_text(html: str) -> str:
|
||||||
"""Convert HTML to readable plain text."""
|
"""Convert HTML to readable plain text."""
|
||||||
try:
|
try:
|
||||||
@@ -1155,7 +1162,7 @@ async def send_gmail_message(
|
|||||||
in_reply_to: Annotated[
|
in_reply_to: Annotated[
|
||||||
Optional[str],
|
Optional[str],
|
||||||
Field(
|
Field(
|
||||||
description="Optional Message-ID of the message being replied to.",
|
description="Optional RFC Message-ID of the message being replied to (e.g., '<message123@gmail.com>').",
|
||||||
),
|
),
|
||||||
] = None,
|
] = None,
|
||||||
references: Annotated[
|
references: Annotated[
|
||||||
@@ -1197,8 +1204,8 @@ async def send_gmail_message(
|
|||||||
the email will be sent from the authenticated user's primary email address.
|
the email will be sent from the authenticated user's primary email address.
|
||||||
user_google_email (str): The user's Google email address. Required for authentication.
|
user_google_email (str): The user's Google email address. Required for authentication.
|
||||||
thread_id (Optional[str]): Optional Gmail thread ID to reply within. When provided, sends a reply.
|
thread_id (Optional[str]): Optional Gmail thread ID to reply within. When provided, sends a reply.
|
||||||
in_reply_to (Optional[str]): Optional Message-ID of the message being replied to. Used for proper threading.
|
in_reply_to (Optional[str]): Optional RFC Message-ID of the message being replied to (e.g., '<message123@gmail.com>').
|
||||||
references (Optional[str]): Optional chain of Message-IDs for proper threading. Should include all previous Message-IDs.
|
references (Optional[str]): Optional chain of RFC Message-IDs for proper threading (e.g., '<msg1@gmail.com> <msg2@gmail.com>').
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
str: Confirmation message with the sent email's message ID.
|
str: Confirmation message with the sent email's message ID.
|
||||||
@@ -1362,7 +1369,7 @@ async def draft_gmail_message(
|
|||||||
in_reply_to: Annotated[
|
in_reply_to: Annotated[
|
||||||
Optional[str],
|
Optional[str],
|
||||||
Field(
|
Field(
|
||||||
description="Optional Message-ID of the message being replied to.",
|
description="Optional RFC Message-ID of the message being replied to (e.g., '<message123@gmail.com>').",
|
||||||
),
|
),
|
||||||
] = None,
|
] = None,
|
||||||
references: Annotated[
|
references: Annotated[
|
||||||
@@ -1401,8 +1408,8 @@ async def draft_gmail_message(
|
|||||||
configured in Gmail settings (Settings > Accounts > Send mail as). If not provided,
|
configured in Gmail settings (Settings > Accounts > Send mail as). If not provided,
|
||||||
the draft will be from the authenticated user's primary email address.
|
the draft will be from the authenticated user's primary email address.
|
||||||
thread_id (Optional[str]): Optional Gmail thread ID to reply within. When provided, creates a reply draft.
|
thread_id (Optional[str]): Optional Gmail thread ID to reply within. When provided, creates a reply draft.
|
||||||
in_reply_to (Optional[str]): Optional Message-ID of the message being replied to. Used for proper threading.
|
in_reply_to (Optional[str]): Optional RFC Message-ID of the message being replied to (e.g., '<message123@gmail.com>').
|
||||||
references (Optional[str]): Optional chain of Message-IDs for proper threading. Should include all previous Message-IDs.
|
references (Optional[str]): Optional chain of RFC Message-IDs for proper threading (e.g., '<msg1@gmail.com> <msg2@gmail.com>').
|
||||||
attachments (List[Dict[str, str]]): Optional list of attachments. Each dict can contain:
|
attachments (List[Dict[str, str]]): Optional list of attachments. Each dict can contain:
|
||||||
Option 1 - File path (auto-encodes):
|
Option 1 - File path (auto-encodes):
|
||||||
- 'path' (required): File path to attach
|
- 'path' (required): File path to attach
|
||||||
|
|||||||
Reference in New Issue
Block a user