From 73e07804341ddd7210f4d0006b895070823823a8 Mon Sep 17 00:00:00 2001 From: xxm Date: Wed, 26 Aug 2026 12:34:39 +0800 Subject: [PATCH] fix-remove-all-message-truncation --- deploy/profile-scripts/alert_helper.py | 7 ++----- deploy/profile-scripts/messenger.py | 2 +- static/index.html | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/deploy/profile-scripts/alert_helper.py b/deploy/profile-scripts/alert_helper.py index 3cc03507..ff0ac957 100644 --- a/deploy/profile-scripts/alert_helper.py +++ b/deploy/profile-scripts/alert_helper.py @@ -95,9 +95,7 @@ def notify(category, body, level=INFO): return False # 篇幅截断 lines = body.splitlines() - if len(lines) > INFO_MAX_LINES: - body = "\n".join(lines[:INFO_MAX_LINES]) + \ - f"\n…(共{len(lines)}行,详见 gateway/logs/)" + body = "\n".join(lines) # 告知压制历史 if entry.get("suppressed", 0) > 0: body += f"\n(注: 上次以来另有 {entry['suppressed']} 条同类通知已按频率策略静默)" @@ -109,8 +107,7 @@ def notify(category, body, level=INFO): _log(f"[{category}] ACTION 内容重复(5min内),静默") return False lines = body.splitlines() - if len(lines) > ACTION_MAX_LINES: - body = "\n".join(lines[:ACTION_MAX_LINES]) + f"\n…(共{len(lines)}行)" + body = "\n".join(lines) prefix = f"🚨【MoFin·{category}】" # 写入 broadcast_messages(统一消息源,告警类) diff --git a/deploy/profile-scripts/messenger.py b/deploy/profile-scripts/messenger.py index 09472c7d..8a774f8d 100644 --- a/deploy/profile-scripts/messenger.py +++ b/deploy/profile-scripts/messenger.py @@ -131,7 +131,7 @@ def send_action_recommendation(title, content, source=None): class _MessengerStdout: # 2026-08-24 事件块聚合:逐行碎片→一块一条消息(老莫:broadcast每条消息详情=摘要,无信息量) # 块边界:静默>2秒 或 满25行;atexit强制flush。xmpp实时输出不缓冲(hermes靠stdout推送)。 - MAX_BLOCK_LINES = 25 + MAX_BLOCK_LINES = 100 MAX_IDLE_SEC = 2.0 def __init__(self, orig, script): diff --git a/static/index.html b/static/index.html index 7d57ac7e..116f60c6 100644 --- a/static/index.html +++ b/static/index.html @@ -3128,7 +3128,7 @@ function loadBroadcast() { data.forEach(function(m) { var color = cat_colors[m.category] || '#6b7280'; var cat_label = cat_labels[m.category] || m.category; - var preview = m.content.length > 120 ? m.content.slice(0,120) + '...' : m.content; + var preview = m.content; var time = (m.ts||'').slice(0,16).replace('T',' '); h += '
'; h += '
';