fix: use original email subject for reply, not AI-extracted title Reply emails should use the original subject from IMAP header (e.g. 'Re: [original]'), not the AI-generated Chinese summary title.

This commit is contained in:
2026-07-22 13:28:36 +08:00
parent b18dcb0527
commit e0c2110c09
2 changed files with 4 additions and 2 deletions

View File

@@ -60,6 +60,7 @@ def ai_process(cfg: Config, user: UserConfig, acct_idx: int, mail: Email, tg_msg
"original_recipient": mail.recipient,
"original_reply_to": mail.reply_to,
"original_cc": mail.cc,
"original_subject": mail.subject,
"acct_idx": acct_idx,
"account_email": mail.account_email,
"uid": mail.uid,
@@ -89,6 +90,7 @@ def tg_send_and_mark(cfg: Config, user: UserConfig, info: dict):
"original_recipient": info.get("original_recipient", ""),
"original_cc": info.get("original_cc", ""),
"original_reply_to": info.get("original_reply_to", ""),
"original_subject": info.get("original_subject", ""),
"account_email": info.get("account_email", ""),
"account_idx": info["acct_idx"],
"sender": info["data"].get("sender", ""),

View File

@@ -360,7 +360,7 @@ def _handle_callback(bot_token: str, cfg: Config, cb: dict):
action = parts[0]
ctx = load_email_context(msg_id)
subject = ctx["subject"] if ctx else "?"
subject = ctx.get("original_subject") or ctx["subject"] if ctx else "?"
logger.info("TG 回调: action=%s msg_id=%d subject=%s", action, msg_id, subject)
if action == CALLBACK_VIEW_ORIG and ctx:
@@ -725,7 +725,7 @@ def _do_send_reply(bot_token: str, cfg: Config,
to_addr = parseaddr(ctx["sender"])[1]
if not to_addr:
to_addr = ctx["sender"]
subject = ctx["subject"]
subject = ctx.get("original_subject") or ctx["subject"]
# 下载 Telegram 附件到本地
local_files = []