fix(diagnostician): 修復 'AI 深度診斷' 垃圾根因顯示
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
根因三層鏈: 1. openclaw.call(prompt) 不傳 context 2. OPENCLAW_NEMO fallback 把 prompt[:500](系統說明文字)當 signal description 3. Nemo LLM 回傳 action_title="調查 AWOOOI SRE 系統的偵探 Agent"(任務描述) 4. _extract_hypotheses() 用 action_title 作為根因假設描述 → Telegram 顯示垃圾 修復: - openclaw.call() 新增 alert_context 可選參數,透傳給 _call_with_fallback - diagnostician._analyze() 建立 alert_context(incident_id + evidence_summary as signal) → nemo 使用結構化 API 收到真實感應器資料而非系統說明文字 - _extract_hypotheses() nemo 格式轉換:優先用 reasoning(為什麼)作為假設描述 而非 action_title(做什麼)— reasoning 更接近根因分析 2026-04-16 ogt + Claude Sonnet 4.6 (台北時區) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -810,7 +810,11 @@ class OpenClawService:
|
||||
# Public LLM Interface (ILLMProvider Protocol)
|
||||
# =========================================================================
|
||||
|
||||
async def call(self, prompt: str) -> tuple[str, str, bool]:
|
||||
async def call(
|
||||
self,
|
||||
prompt: str,
|
||||
alert_context: dict | None = None,
|
||||
) -> tuple[str, str, bool]:
|
||||
"""
|
||||
呼叫 LLM (ILLMProvider Protocol 實作)
|
||||
|
||||
@@ -818,14 +822,20 @@ class OpenClawService:
|
||||
|
||||
Args:
|
||||
prompt: 完整的 prompt
|
||||
alert_context: 可選的告警上下文(含 incident_id/signals,
|
||||
供 OPENCLAW_NEMO provider 使用結構化 API)
|
||||
|
||||
Returns:
|
||||
(response, provider, success)
|
||||
|
||||
2026-04-16 ogt + Claude Sonnet 4.6: 修復 — _call_with_fallback 回傳 5 值,
|
||||
call() 回傳 3 值,避免呼叫端 (diagnostician_agent:107) ValueError
|
||||
2026-04-16 ogt + Claude Sonnet 4.6: 加入 alert_context — 讓 diagnostician
|
||||
能傳 snapshot 結構化資料給 OPENCLAW_NEMO,避免 prompt 被截斷為 garbage
|
||||
"""
|
||||
response, provider, success, _tokens, _cost = await self._call_with_fallback(prompt)
|
||||
response, provider, success, _tokens, _cost = await self._call_with_fallback(
|
||||
prompt, alert_context=alert_context
|
||||
)
|
||||
return response, provider, success
|
||||
|
||||
# =========================================================================
|
||||
|
||||
Reference in New Issue
Block a user