fix(telegram): 啟用 Polling + 修正 InfraAlertMessage 格式
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 6m52s

1. TELEGRAM_ENABLE_POLLING: false→true
   - clawbot-v5 已停止 polling (STANDBY_MODE)
   - AWOOOI API 接管,統帥可與 OpenClaw/NemoClaw 雙 AI 對話

2. InfraAlertMessage.format() 加入 note 欄位
   - NIM 慢屬正常不再顯示「自動修復失敗」
   - 改為 💡 資訊性提示

3. NIM 探測端點改為 /v1/models (輕量,不觸發計費)
   timeout: 10s → 25s (NIM 免費 tier 冷啟動)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-03 16:43:40 +08:00
parent 15aabd6ac5
commit ff5a77f7a9
2 changed files with 15 additions and 13 deletions

View File

@@ -1000,25 +1000,28 @@ class InfraAlertMessage:
按鈕: 無 (資訊型告警)
"""
component: str # 元件名稱 (e.g., "Nemotron NIM")
status: str # 狀態描述 (e.g., "⚠️ 超時 (>10s)")
status: str # 狀態描述 (e.g., "⚠️ 超時 (>25s)")
impact: str # 影響說明
auto_fixed: bool = False # 是否已自動修復
fix_action: str = "" # 執行的修復動作
fix_action: str = "" # 執行的修復動作 (auto_fixed=True 時顯示)
note: str = "" # 附加說明 (info_only 情境用,不顯示修復區塊)
def format(self) -> str:
"""格式化為 Telegram HTML"""
fix_block = ""
if self.auto_fixed:
fix_block = f"━━━━━━━━━━━━━━━━━━━\n✅ <b>已自動修復</b>\n {html.escape(self.fix_action[:100])}\n"
# 有 note 表示「資訊性提示」,不顯示修復區塊
if self.note:
footer = f"━━━━━━━━━━━━━━━━━━━\n💡 {html.escape(self.note[:150])}\n"
elif self.auto_fixed:
footer = f"━━━━━━━━━━━━━━━━━━━\n✅ <b>已自動修復</b>\n{html.escape(self.fix_action[:100])}\n"
else:
fix_block = f"━━━━━━━━━━━━━━━━━━━\n <b>自動修復失敗</b>\n{html.escape(self.fix_action[:100] or '無可用修復方案')}\n"
footer = f"━━━━━━━━━━━━━━━━━━━\n⚠️ <b>需要關注</b>\n{html.escape(self.fix_action[:100] or '請確認元件狀態')}\n"
return (
f"🚨 <b>基礎設施異常</b>\n"
f"━━━━━━━━━━━━━━━━━━━\n"
f"⚙️ <b>{html.escape(self.component)}</b>: {html.escape(self.status)}\n"
f"📛 影響: {html.escape(self.impact[:150])}\n"
f"{fix_block}"
f"{footer}"
)[:900]
@@ -3028,9 +3031,8 @@ class TelegramGateway:
alert = InfraAlertMessage(
component="Nemotron NIM (NVIDIA API)",
status=nemo_status,
impact="NIM 回應慢於探測 timeoutincident 分析可能延遲",
auto_fixed=False,
fix_action="無需自動修復NIM 免費 tier 延遲 11-45s 屬正常範圍",
impact="NIM 免費 tier 回應慢 (11-45s)@nemo 對話可能需等待",
note="NIM 慢屬正常 — 免費 tier 特性,非故障。如需快速回應請用 @openclaw",
)
await self.send_notification(alert.format(), parse_mode="HTML")
logger.warning("nemotron_health_slow_alert", status=nemo_status)

View File

@@ -67,9 +67,9 @@ data:
# ============================================================================
SHADOW_MODE_ENABLED: "false"
SHADOW_MODE_LOG_ONLY: "false"
# 2026-04-01 ogt: 改回 false — OpenClaw(188) 是唯一 Polling 實例K8s 只發送訊息
# 舊設計「K8s 接管」已廢棄,兩個 polling 造成 409 Conflict
TELEGRAM_ENABLE_POLLING: "false"
# 2026-04-03 ogt: 改為 true — clawbot-v5 已設 STANDBY_MODEAWOOOI API 接管 Polling
# Phase 22.6: 統帥需要直接在同一 Bot 與 OpenClaw/NemoClaw 雙 AI 對話
TELEGRAM_ENABLE_POLLING: "true"
# 快取 TTL (秒)
CACHE_TTL_DASHBOARD: "300"