style: restructure email formats with 收件账户 and app_name for verification
This commit is contained in:
@@ -18,6 +18,7 @@ SYSTEM_PROMPT = """你是一个邮件摘要助手。请分析邮件内容并以
|
|||||||
"category": "normal/promotion/notification",
|
"category": "normal/promotion/notification",
|
||||||
"summary": "50字以内的核心摘要",
|
"summary": "50字以内的核心摘要",
|
||||||
"verification_code": "",
|
"verification_code": "",
|
||||||
|
"app_name": "",
|
||||||
"links": [{"text": "按钮文字", "url": "https://..."}],
|
"links": [{"text": "按钮文字", "url": "https://..."}],
|
||||||
"can_reply": true/false,
|
"can_reply": true/false,
|
||||||
"reply_suggestions": [
|
"reply_suggestions": [
|
||||||
@@ -30,7 +31,8 @@ SYSTEM_PROMPT = """你是一个邮件摘要助手。请分析邮件内容并以
|
|||||||
其中:
|
其中:
|
||||||
- subject 不能照抄原邮件主题,必须是你总结生成的简短标题
|
- subject 不能照抄原邮件主题,必须是你总结生成的简短标题
|
||||||
- category: 邮件类型。推广邮件(营销、促销、广告、 newsletter 推广等)标记为 "promotion";验证码邮件标记为 "notification";普通邮件标记为 "normal"
|
- category: 邮件类型。推广邮件(营销、促销、广告、 newsletter 推广等)标记为 "promotion";验证码邮件标记为 "notification";普通邮件标记为 "normal"
|
||||||
- verification_code: 仅当 category 为 "notification" 且邮件包含验证码时填写,格式为「平台名称 验证码」(如「GitHub 123456」「微信 888888」)。非验证码邮件留空字符串
|
- verification_code: 仅当 category 为 "notification" 且邮件包含验证码时填写,只填纯数字验证码(如「123456」「888888」),不包含平台名。非验证码邮件留空字符串
|
||||||
|
- app_name: 仅当 category 为 "notification" 且邮件包含验证码时填写,填写发送验证码的应用/平台名称(如「GitHub」「微信」「Kraken」)。非验证码邮件留空字符串
|
||||||
- links: 从邮件正文中提取用户需要点击的链接。只提取有意义的、用户可能需要操作的链接(如确认链接、登录链接、下载链接、账单链接等),不要提取退订链接、追踪像素、邮件头中的无关链接。每条包含简短描述文字和完整 URL。最多 3 条。没有需要点击的链接时为空数组
|
- links: 从邮件正文中提取用户需要点击的链接。只提取有意义的、用户可能需要操作的链接(如确认链接、登录链接、下载链接、账单链接等),不要提取退订链接、追踪像素、邮件头中的无关链接。每条包含简短描述文字和完整 URL。最多 3 条。没有需要点击的链接时为空数组
|
||||||
- summary 要简洁,把需要知道的信息浓缩成一句话,不需要分条列出
|
- summary 要简洁,把需要知道的信息浓缩成一句话,不需要分条列出
|
||||||
- 当 category 为 "promotion" 时,summary 直接写成一句话:「[发送方名称] 在推广 [推广的产品/服务/活动]」,例如「腾讯云在推广双十一云服务器折扣」。此时 can_reply 为 false,reply_suggestions 为空数组
|
- 当 category 为 "promotion" 时,summary 直接写成一句话:「[发送方名称] 在推广 [推广的产品/服务/活动]」,例如「腾讯云在推广双十一云服务器折扣」。此时 can_reply 为 false,reply_suggestions 为空数组
|
||||||
|
|||||||
@@ -105,19 +105,22 @@ def _format_promotion(data: dict, account_email: str = "") -> str:
|
|||||||
lines = [
|
lines = [
|
||||||
f"📢 *推广*",
|
f"📢 *推广*",
|
||||||
f"━━━━━━━━━━━━━━━━━━",
|
f"━━━━━━━━━━━━━━━━━━",
|
||||||
|
f"*收件账户:* {_escape(account_email)}",
|
||||||
|
"",
|
||||||
f"{_escape(summary)}",
|
f"{_escape(summary)}",
|
||||||
f"账户: {_escape(account_email)}",
|
|
||||||
]
|
]
|
||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
def _format_verification(data: dict, account_email: str = "") -> str:
|
def _format_verification(data: dict, account_email: str = "") -> str:
|
||||||
code = data.get("verification_code", "")
|
code = data.get("verification_code", "")
|
||||||
|
app = data.get("app_name", "")
|
||||||
lines = [
|
lines = [
|
||||||
f"🔑 *验证码*",
|
f"🔑 *验证码*",
|
||||||
f"━━━━━━━━━━━━━━━━━━",
|
f"━━━━━━━━━━━━━━━━━━",
|
||||||
f"`{_escape(code)}`",
|
f"*收件账户:* {_escape(account_email)}",
|
||||||
f"账户: {_escape(account_email)}",
|
f"*应用:* {_escape(app)}",
|
||||||
|
f"*验证码:* `{_escape(code)}`",
|
||||||
]
|
]
|
||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
|
|
||||||
@@ -126,9 +129,9 @@ def _format_normal(data: dict, account_email: str = "") -> str:
|
|||||||
lines = [
|
lines = [
|
||||||
f"📧 *{_escape(data.get('subject', '邮件摘要'))}*",
|
f"📧 *{_escape(data.get('subject', '邮件摘要'))}*",
|
||||||
f"━━━━━━━━━━━━━━━━━━",
|
f"━━━━━━━━━━━━━━━━━━",
|
||||||
|
f"*收件账户:* {_escape(account_email)}",
|
||||||
f"*收件人:* {_escape(data.get('recipient', '未知'))}",
|
f"*收件人:* {_escape(data.get('recipient', '未知'))}",
|
||||||
f"*发件人:* {_escape(data.get('sender', '未知'))}",
|
f"*发件人:* {_escape(data.get('sender', '未知'))}",
|
||||||
f"*账户:* {_escape(account_email)}",
|
|
||||||
"",
|
"",
|
||||||
_escape(data.get("summary", "")),
|
_escape(data.get("summary", "")),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user