feat(telegram): 接通 Phase 22 Nemotron 雙軌顯示 (ADR-044)
根本原因: format_with_nemotron() 已實作但從未被呼叫 - send_approval_card() 新增 nemotron_enabled/tools/validation/latency 參數 - TelegramMessage 建構時傳入 nemotron 欄位 - nemotron_enabled=true 時自動使用 format_with_nemotron() 格式 - _push_decision_to_telegram() 從 proposal_data 提取並傳遞 nemotron 資料 效果: Telegram 同時顯示 OpenClaw 仲裁 + Nemotron 執行方案雙區塊 2026-04-02 ogt: Phase 22 最後一哩路 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -111,6 +111,12 @@ async def _push_decision_to_telegram(
|
||||
source = proposal_data.get("source", "unknown")
|
||||
ai_provider = proposal_data.get("provider", "") # 2026-03-29 ogt: AI 模型來源
|
||||
|
||||
# 2026-04-02 ogt: Phase 22 Nemotron 協作資料
|
||||
nemotron_enabled = proposal_data.get("nemotron_enabled", False)
|
||||
nemotron_tools = proposal_data.get("nemotron_tools")
|
||||
nemotron_validation = proposal_data.get("nemotron_validation", "")
|
||||
nemotron_latency_ms = proposal_data.get("nemotron_latency_ms", 0.0)
|
||||
|
||||
# 建立 approval_id (使用 incident_id 作為追蹤)
|
||||
# 2026-03-27 ogt: 修復 INC-INC-INC- 重複前綴 bug
|
||||
approval_id = incident.incident_id # 已經是 INC-xxx 格式
|
||||
@@ -126,6 +132,11 @@ async def _push_decision_to_telegram(
|
||||
confidence=confidence,
|
||||
namespace=incident.signals[0].labels.get("namespace", "default") if incident.signals else "default",
|
||||
ai_provider=ai_provider, # 2026-03-29 ogt: 顯示 AI 模型來源
|
||||
# 2026-04-02 ogt: Phase 22 Nemotron 協作 (ADR-044)
|
||||
nemotron_enabled=nemotron_enabled,
|
||||
nemotron_tools=nemotron_tools,
|
||||
nemotron_validation=nemotron_validation,
|
||||
nemotron_latency_ms=nemotron_latency_ms,
|
||||
)
|
||||
|
||||
# 🔴 發送成功後設置去重 key (TTL 10 分鐘)
|
||||
|
||||
@@ -1230,6 +1230,11 @@ class TelegramGateway:
|
||||
anomaly_frequency: dict | None = None,
|
||||
# 2026-03-29 ogt: AI Provider 來源顯示
|
||||
ai_provider: str = "",
|
||||
# 2026-04-02 ogt: Phase 22 Nemotron 協作 (ADR-044)
|
||||
nemotron_enabled: bool = False,
|
||||
nemotron_tools: list[dict] | None = None,
|
||||
nemotron_validation: str = "",
|
||||
nemotron_latency_ms: float = 0.0,
|
||||
) -> dict:
|
||||
"""
|
||||
推送待簽核卡片到 Telegram (v7.0 含 SignOz 整合)
|
||||
@@ -1292,10 +1297,15 @@ class TelegramGateway:
|
||||
anomaly_frequency=anomaly_frequency,
|
||||
# 2026-03-29 ogt: AI Provider 來源顯示
|
||||
ai_provider=ai_provider,
|
||||
# 2026-04-02 ogt: Phase 22 Nemotron 協作 (ADR-044)
|
||||
nemotron_enabled=nemotron_enabled,
|
||||
nemotron_tools=nemotron_tools,
|
||||
nemotron_validation=nemotron_validation,
|
||||
nemotron_latency_ms=nemotron_latency_ms,
|
||||
)
|
||||
|
||||
# 格式化訊息
|
||||
text = message.format()
|
||||
# 格式化訊息 — Phase 22: 如果 Nemotron 啟用,使用雙軌格式
|
||||
text = message.format_with_nemotron() if nemotron_enabled else message.format()
|
||||
|
||||
# 建立按鈕 (含自動調優)
|
||||
keyboard = self._build_inline_keyboard(
|
||||
@@ -2289,9 +2299,12 @@ class TelegramGateway:
|
||||
if dc.probable_root_causes:
|
||||
lines.append(f"🔍 根因: {html.escape(dc.probable_root_causes[0][:100])}")
|
||||
|
||||
# 2026-04-02 Claude Code: 修正時區 — 必須轉台北時區 (feedback_timezone_taipei.md)
|
||||
from zoneinfo import ZoneInfo
|
||||
created_taipei = incident.created_at.astimezone(ZoneInfo("Asia/Taipei")) if incident.created_at else incident.created_at
|
||||
lines += [
|
||||
f"",
|
||||
f"🕐 <b>建立:</b> {incident.created_at.strftime('%m/%d %H:%M')}",
|
||||
f"🕐 <b>建立:</b> {created_taipei.strftime('%m/%d %H:%M') if created_taipei else 'N/A'}",
|
||||
]
|
||||
|
||||
if incident.frequency_stats:
|
||||
|
||||
Reference in New Issue
Block a user