feat: show recipient & AI-generated subject in summary

- AI now generates a concise subject title (not copy original)
- AI prompt includes recipient field in JSON schema
- Telegram message shows recipient and uses AI-generated title
This commit is contained in:
2026-07-02 20:05:16 +08:00
parent a6817d3e11
commit 279f8c50e7
3 changed files with 9 additions and 6 deletions

View File

@@ -8,7 +8,8 @@ SYSTEM_PROMPT = """你是一个邮件摘要助手。请分析邮件内容并以
返回格式必须严格遵循以下 JSON schema
{
"subject": "邮件主题",
"subject": "你概括的简短标题10字以内",
"recipient": "收件邮箱地址",
"sender": "发件人",
"summary": "50字以内的核心摘要",
"priority": "high/medium/low",
@@ -17,12 +18,13 @@ SYSTEM_PROMPT = """你是一个邮件摘要助手。请分析邮件内容并以
"key_points": ["关键要点1", "关键要点2"]
}
其中 subject 字段不能照抄原邮件主题,必须是你总结生成的简短标题。
只返回 JSON不要包含任何其他文字。"""
@retry()
def summarize_email(ai_cfg: AIConfig, subject: str, sender: str, body: str) -> dict[str, Any]:
content = f"发件人: {sender}\n主题: {subject}\n正文:\n{body[:4000]}"
def summarize_email(ai_cfg: AIConfig, recipient: str, subject: str, sender: str, body: str) -> dict[str, Any]:
content = f"收件人: {recipient}\n发件人: {sender}\n主题: {subject}\n正文:\n{body[:4000]}"
payload = {
"model": ai_cfg.model,