From fe24a07d155bff0211c2054e271c9e4eebf65d61 Mon Sep 17 00:00:00 2001 From: Zichao Lin Date: Fri, 17 Jul 2026 18:36:53 +0800 Subject: [PATCH] fix: parse_mode always MarkdownV2, add MEMORY.md with project rules --- MEMORY.md | 5 +++++ src/tg_bot.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 MEMORY.md diff --git a/MEMORY.md b/MEMORY.md new file mode 100644 index 0000000..d270a36 --- /dev/null +++ b/MEMORY.md @@ -0,0 +1,5 @@ +# AI Mail Bot - 记忆 + +## 固定规则 + +- **Telegram parse_mode 永远为 MarkdownV2**,不传 None。需要发纯文本时,用 Markdown 转义包装,而不是去掉 parse_mode。 diff --git a/src/tg_bot.py b/src/tg_bot.py index b9abb40..8c0c369 100644 --- a/src/tg_bot.py +++ b/src/tg_bot.py @@ -367,7 +367,7 @@ def _handle_callback(tg_cfg: TelegramConfig, cfg: Config, cb: dict): # AI 处理中 _tg_req(tg_cfg, "editMessageText", { "chat_id": chat_id, "message_id": msg_id, - "text": "🤖 AI思考中...", + "text": "🤖 *AI思考中…*", "parse_mode": "MarkdownV2", }) # 丢到 AI 线程池处理,不阻塞按钮轮询 _ai_pool.submit(_do_regen, cfg, chat_id, msg_id, ctx, conv) @@ -400,7 +400,7 @@ def _handle_callback(tg_cfg: TelegramConfig, cfg: Config, cb: dict): elif action == CALLBACK_PROMO_DETAIL and ctx: _tg_req(tg_cfg, "editMessageText", { "chat_id": chat_id, "message_id": msg_id, - "text": "🤖 AI思考中...", "parse_mode": None, + "text": "🤖 *AI思考中…*", "parse_mode": "MarkdownV2", }) try: details = expand_promo_detail(