refactor: remove action_required/action_items/key_points, keep summary concise
This commit is contained in:
@@ -19,10 +19,6 @@ SYSTEM_PROMPT = """你是一个邮件摘要助手。请分析邮件内容并以
|
||||
"summary": "50字以内的核心摘要",
|
||||
"verification_code": "",
|
||||
"links": [{"text": "按钮文字", "url": "https://..."}],
|
||||
"priority": "high/medium/low",
|
||||
"action_required": true/false,
|
||||
"action_items": ["待办事项1", "待办事项2"],
|
||||
"key_points": ["关键要点1", "关键要点2"],
|
||||
"can_reply": true/false,
|
||||
"reply_suggestions": [
|
||||
{"text": "回复内容", "is_simple": true/false},
|
||||
@@ -36,7 +32,8 @@ SYSTEM_PROMPT = """你是一个邮件摘要助手。请分析邮件内容并以
|
||||
- category: 邮件类型。推广邮件(营销、促销、广告、 newsletter 推广等)标记为 "promotion";验证码邮件标记为 "notification";普通邮件标记为 "normal"
|
||||
- verification_code: 仅当 category 为 "notification" 且邮件包含验证码时填写,格式为「平台名称 验证码」(如「GitHub 123456」「微信 888888」)。非验证码邮件留空字符串
|
||||
- links: 从邮件正文中提取用户需要点击的链接。只提取有意义的、用户可能需要操作的链接(如确认链接、登录链接、下载链接、账单链接等),不要提取退订链接、追踪像素、邮件头中的无关链接。每条包含简短描述文字和完整 URL。最多 3 条。没有需要点击的链接时为空数组
|
||||
- 当 category 为 "promotion" 时,summary 直接写成一句话:「[发送方名称] 在推广 [推广的产品/服务/活动]」,例如「腾讯云在推广双十一云服务器折扣」。此时 priority 固定为 "low",action_required 为 false,can_reply 为 false,action_items 和 reply_suggestions 为空数组
|
||||
- summary 要简洁,把需要知道的信息浓缩成一句话,不需要分条列出
|
||||
- 当 category 为 "promotion" 时,summary 直接写成一句话:「[发送方名称] 在推广 [推广的产品/服务/活动]」,例如「腾讯云在推广双十一云服务器折扣」。此时 can_reply 为 false,reply_suggestions 为空数组
|
||||
- can_reply 为 false 表示无需回复或不适合建议回复(此时忽略 reply_suggestions)
|
||||
- is_simple 为 true 表示纯确认性回复(如"好的""收到"),用户选择后可直发
|
||||
- is_simple 为 false 表示涉及实质内容,需要用户确认再发送
|
||||
|
||||
@@ -9,9 +9,6 @@ from src.retry import retry
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_priority_icon = {"high": "🔴", "medium": "🟡", "low": "🟢"}
|
||||
|
||||
# msg_id -> email context
|
||||
_email_contexts: dict[int, dict] = {}
|
||||
# chat_id -> conversation state
|
||||
_conversations: dict[int, dict] = {}
|
||||
@@ -124,26 +121,15 @@ def _format_verification(data: dict, account_email: str = "") -> str:
|
||||
|
||||
|
||||
def _format_normal(data: dict, account_email: str = "") -> str:
|
||||
priority = data.get("priority", "medium")
|
||||
icon = _priority_icon.get(priority, "⚪")
|
||||
lines = [
|
||||
f"*📧 {_escape(data.get('subject', '邮件摘要'))}*",
|
||||
"━━━━━━━━━━━━━━━━━━",
|
||||
f"*收件人:* {_escape(data.get('recipient', '未知'))}",
|
||||
f"*发件人:* {_escape(data.get('sender', '未知'))}",
|
||||
f"*账户:* {_escape(account_email)}",
|
||||
f"*优先级:* {icon} {priority.upper()}",
|
||||
"",
|
||||
_escape(data.get("summary", "")),
|
||||
"",
|
||||
]
|
||||
if data.get("action_required"):
|
||||
lines.append("*📌 需要处理:* 是")
|
||||
for item in data.get("action_items", []):
|
||||
lines.append(f" \\- {_escape(item)}")
|
||||
lines.append("")
|
||||
for p in data.get("key_points", []):
|
||||
lines.append(f" \\- {_escape(p)}")
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user