chore: port same html arguments to draft_gmail_message

This commit is contained in:
luutuankiet
2025-10-13 12:15:18 +07:00
parent 31e6987010
commit 7ef0c2503a

View File

@@ -677,6 +677,9 @@ async def draft_gmail_message(
user_google_email: str, user_google_email: str,
subject: str = Body(..., description="Email subject."), subject: str = Body(..., description="Email subject."),
body: str = Body(..., description="Email body (plain text)."), body: str = Body(..., description="Email body (plain text)."),
body_format: Literal["plain", "html"] = Body(
"plain", description="Email body format. Use 'plain' for plaintext or 'html' for HTML content."
),
to: Optional[str] = Body(None, description="Optional recipient email address."), to: Optional[str] = Body(None, description="Optional recipient email address."),
cc: Optional[str] = Body(None, description="Optional CC email address."), cc: Optional[str] = Body(None, description="Optional CC email address."),
bcc: Optional[str] = Body(None, description="Optional BCC email address."), bcc: Optional[str] = Body(None, description="Optional BCC email address."),
@@ -691,6 +694,7 @@ async def draft_gmail_message(
user_google_email (str): The user's Google email address. Required. user_google_email (str): The user's Google email address. Required.
subject (str): Email subject. subject (str): Email subject.
body (str): Email body (plain text). body (str): Email body (plain text).
body_format (Literal['plain', 'html']): Email body format. Defaults to 'plain'.
to (Optional[str]): Optional recipient email address. Can be left empty for drafts. to (Optional[str]): Optional recipient email address. Can be left empty for drafts.
cc (Optional[str]): Optional CC email address. cc (Optional[str]): Optional CC email address.
bcc (Optional[str]): Optional BCC email address. bcc (Optional[str]): Optional BCC email address.
@@ -705,7 +709,7 @@ async def draft_gmail_message(
# Create a new draft # Create a new draft
draft_gmail_message(subject="Hello", body="Hi there!", to="user@example.com") draft_gmail_message(subject="Hello", body="Hi there!", to="user@example.com")
# Create a draft with CC and BCC # Create a plaintext draft with CC and BCC
draft_gmail_message( draft_gmail_message(
subject="Project Update", subject="Project Update",
body="Here's the latest update...", body="Here's the latest update...",
@@ -714,7 +718,17 @@ async def draft_gmail_message(
bcc="archive@example.com" bcc="archive@example.com"
) )
# Create a reply draft # Create a HTML draft with CC and BCC
draft_gmail_message(
subject="Project Update",
body="<strong>Hi there!</strong>",
body_format="html",
to="user@example.com",
cc="manager@example.com",
bcc="archive@example.com"
)
# Create a reply draft in plaintext
draft_gmail_message( draft_gmail_message(
subject="Re: Meeting tomorrow", subject="Re: Meeting tomorrow",
body="Thanks for the update!", body="Thanks for the update!",
@@ -723,6 +737,17 @@ async def draft_gmail_message(
in_reply_to="<message123@gmail.com>", in_reply_to="<message123@gmail.com>",
references="<original@gmail.com> <message123@gmail.com>" references="<original@gmail.com> <message123@gmail.com>"
) )
# Create a reply draft in HTML
draft_gmail_message(
subject="Re: Meeting tomorrow",
body="<strong>Thanks for the update!</strong>",
body_format="html,
to="user@example.com",
thread_id="thread_123",
in_reply_to="<message123@gmail.com>",
references="<original@gmail.com> <message123@gmail.com>"
)
""" """
logger.info( logger.info(
f"[draft_gmail_message] Invoked. Email: '{user_google_email}', Subject: '{subject}'" f"[draft_gmail_message] Invoked. Email: '{user_google_email}', Subject: '{subject}'"
@@ -732,6 +757,7 @@ async def draft_gmail_message(
raw_message, thread_id_final = _prepare_gmail_message( raw_message, thread_id_final = _prepare_gmail_message(
subject=subject, subject=subject,
body=body, body=body,
body_format=body_format,
to=to, to=to,
cc=cc, cc=cc,
bcc=bcc, bcc=bcc,