fix(kb): Signal 無 description 欄位,改用 alert_name + annotations
knowledge_extractor_service 兩處直接訪問 s.description: - L87 signals_text 組裝:改用 alert_name + annotations.summary/description - L198 Fallback 標題:改用 alert_name[:60] Signal model 只有 alert_name, annotations(dict),無 description 屬性。 此修復防止 KB 萃取時 AttributeError 導致草稿無法建立。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -83,8 +83,10 @@ class KnowledgeExtractorService:
|
||||
"""
|
||||
try:
|
||||
# 1. 組 Prompt
|
||||
# 2026-04-16 ogt: Signal 無 description 欄位,用 alert_name + annotations.summary
|
||||
signals_text = "\n".join(
|
||||
f"- {s.description}" for s in (incident.signals or [])
|
||||
f"- {s.alert_name}: {s.annotations.get('summary', s.annotations.get('description', ''))}"
|
||||
for s in (incident.signals or [])
|
||||
) or "(無信號記錄)"
|
||||
|
||||
prompt = _PROMPT_TEMPLATE.format(
|
||||
@@ -194,8 +196,9 @@ class KnowledgeExtractorService:
|
||||
return title[:200] # DB column max 255
|
||||
|
||||
# Fallback
|
||||
# 2026-04-16 ogt: Signal 無 description 欄位,改用 alert_name
|
||||
signals = incident.signals or []
|
||||
desc = signals[0].description[:60] if signals else "未知事件"
|
||||
desc = signals[0].alert_name[:60] if signals else "未知事件"
|
||||
return f"[AI 萃取] {incident.incident_id}: {desc}"
|
||||
|
||||
def _infer_category(self, incident) -> str:
|
||||
|
||||
Reference in New Issue
Block a user