fix: use ellipsis character instead of dots in status messages for MarkdownV2 compatibility

This commit is contained in:
2026-07-13 08:28:23 +08:00
parent 98147e6a6c
commit 26468aa43d
3 changed files with 6 additions and 8 deletions

0
app.log Normal file
View File

View File

@@ -25,12 +25,12 @@ def ai_process(cfg: Config, acct_idx: int, mail: Email, tg_msg_id: int = 0) -> O
logger.info(f" 正在摘要: {mail.subject}") logger.info(f" 正在摘要: {mail.subject}")
# 阶段1显示等待处理 # 阶段1显示等待处理
if tg_msg_id: if tg_msg_id:
edit_message(cfg.telegram, cfg.telegram.chat_id, tg_msg_id, "⏳ 等待处理...", parse_mode=None) edit_message(cfg.telegram, cfg.telegram.chat_id, tg_msg_id, "⏳ 等待处理")
else: else:
tg_msg_id = send_thinking(cfg.telegram, cfg.telegram.chat_id, "⏳ 等待处理...") tg_msg_id = send_thinking(cfg.telegram, cfg.telegram.chat_id, "⏳ 等待处理")
# 阶段2AI 处理,更新为思考中 # 阶段2AI 处理,更新为思考中
edit_message(cfg.telegram, cfg.telegram.chat_id, tg_msg_id, "🤖 AI思考中...", parse_mode=None) edit_message(cfg.telegram, cfg.telegram.chat_id, tg_msg_id, "🤖 AI思考中")
summary = summarize_email(cfg.ai, mail.recipient, mail.subject, mail.sender, mail.body, mail.account_email) summary = summarize_email(cfg.ai, mail.recipient, mail.subject, mail.sender, mail.body, mail.account_email)
summary["recipient"] = mail.recipient summary["recipient"] = mail.recipient
if "@" not in summary.get("sender", ""): if "@" not in summary.get("sender", ""):

View File

@@ -57,7 +57,7 @@ def send_text(tg_cfg: TelegramConfig, chat_id: str, text: str,
return result["result"]["message_id"] return result["result"]["message_id"]
def send_thinking(tg_cfg: TelegramConfig, chat_id: str, text: str = "💭 思考中...") -> int: def send_thinking(tg_cfg: TelegramConfig, chat_id: str, text: str = "💭 思考中") -> int:
result = _tg_req(tg_cfg, "sendMessage", { result = _tg_req(tg_cfg, "sendMessage", {
"chat_id": chat_id, "chat_id": chat_id,
"text": text, "text": text,
@@ -66,13 +66,11 @@ def send_thinking(tg_cfg: TelegramConfig, chat_id: str, text: str = "💭 思考
def edit_message(tg_cfg: TelegramConfig, chat_id: str, msg_id: int, def edit_message(tg_cfg: TelegramConfig, chat_id: str, msg_id: int,
text: str, reply_markup: dict = None, parse_mode: str = "MarkdownV2"): text: str, reply_markup: dict = None):
payload = { payload = {
"chat_id": chat_id, "message_id": msg_id, "chat_id": chat_id, "message_id": msg_id,
"text": text, "text": text, "parse_mode": "MarkdownV2",
} }
if parse_mode:
payload["parse_mode"] = parse_mode
if reply_markup: if reply_markup:
payload["reply_markup"] = reply_markup payload["reply_markup"] = reply_markup
_tg_req(tg_cfg, "editMessageText", payload) _tg_req(tg_cfg, "editMessageText", payload)