From 1d70fe2491c0ad1f55bb58d2f71f9b2a3a4324d6 Mon Sep 17 00:00:00 2001 From: Zichao Lin Date: Fri, 17 Jul 2026 20:56:59 +0800 Subject: [PATCH] fix: pass links/is_promotion to _summary_keyboard in cancel and send_reply handlers --- src/tg_bot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tg_bot.py b/src/tg_bot.py index 2d918fe..3ca50bb 100644 --- a/src/tg_bot.py +++ b/src/tg_bot.py @@ -404,10 +404,12 @@ def _handle_callback(tg_cfg: TelegramConfig, cfg: Config, cb: dict): send_text(tg_cfg, str(chat_id), f"✅ 回复已发送") delete_conversation(chat_id) can_reply = ctx.get("can_reply", True) + is_promotion = ctx.get("summary_data", {}).get("category") == "promotion" + links = ctx.get("summary_data", {}).get("links", []) _tg_req(tg_cfg, "editMessageText", { "chat_id": chat_id, "message_id": msg_id, "text": ctx["summary_text"], "parse_mode": "MarkdownV2", - "reply_markup": _summary_keyboard(can_reply), + "reply_markup": _summary_keyboard(can_reply, is_promotion, links), }) elif action == CALLBACK_SELECT_REPLY and ctx: @@ -475,10 +477,12 @@ def _handle_callback(tg_cfg: TelegramConfig, cfg: Config, cb: dict): ctx["summary_data"]["reply_suggestions"] = [] save_email_context(msg_id, ctx) can_reply = ctx.get("can_reply", True) + is_promotion = ctx.get("summary_data", {}).get("category") == "promotion" + links = ctx.get("summary_data", {}).get("links", []) _tg_req(tg_cfg, "editMessageText", { "chat_id": chat_id, "message_id": msg_id, "text": ctx["summary_text"], "parse_mode": "MarkdownV2", - "reply_markup": _summary_keyboard(can_reply), + "reply_markup": _summary_keyboard(can_reply, is_promotion, links), }) logger.info(" 取消, 恢复摘要视图") else: