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:
@@ -60,6 +60,7 @@ def ai_process(cfg: Config, user: UserConfig, acct_idx: int, mail: Email, tg_msg
|
|||||||
"original_recipient": mail.recipient,
|
"original_recipient": mail.recipient,
|
||||||
"original_reply_to": mail.reply_to,
|
"original_reply_to": mail.reply_to,
|
||||||
"original_cc": mail.cc,
|
"original_cc": mail.cc,
|
||||||
|
"original_subject": mail.subject,
|
||||||
"acct_idx": acct_idx,
|
"acct_idx": acct_idx,
|
||||||
"account_email": mail.account_email,
|
"account_email": mail.account_email,
|
||||||
"uid": mail.uid,
|
"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_recipient": info.get("original_recipient", ""),
|
||||||
"original_cc": info.get("original_cc", ""),
|
"original_cc": info.get("original_cc", ""),
|
||||||
"original_reply_to": info.get("original_reply_to", ""),
|
"original_reply_to": info.get("original_reply_to", ""),
|
||||||
|
"original_subject": info.get("original_subject", ""),
|
||||||
"account_email": info.get("account_email", ""),
|
"account_email": info.get("account_email", ""),
|
||||||
"account_idx": info["acct_idx"],
|
"account_idx": info["acct_idx"],
|
||||||
"sender": info["data"].get("sender", ""),
|
"sender": info["data"].get("sender", ""),
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ def _handle_callback(bot_token: str, cfg: Config, cb: dict):
|
|||||||
action = parts[0]
|
action = parts[0]
|
||||||
|
|
||||||
ctx = load_email_context(msg_id)
|
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)
|
logger.info("TG 回调: action=%s msg_id=%d subject=%s", action, msg_id, subject)
|
||||||
|
|
||||||
if action == CALLBACK_VIEW_ORIG and ctx:
|
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]
|
to_addr = parseaddr(ctx["sender"])[1]
|
||||||
if not to_addr:
|
if not to_addr:
|
||||||
to_addr = ctx["sender"]
|
to_addr = ctx["sender"]
|
||||||
subject = ctx["subject"]
|
subject = ctx.get("original_subject") or ctx["subject"]
|
||||||
|
|
||||||
# 下载 Telegram 附件到本地
|
# 下载 Telegram 附件到本地
|
||||||
local_files = []
|
local_files = []
|
||||||
|
|||||||
Reference in New Issue
Block a user