fix(telegram): 修復 Telegram 卡片 description 顯示 debug garbage
Some checks failed
CD Pipeline / build-and-deploy (push) Failing after 3m12s
Some checks failed
CD Pipeline / build-and-deploy (push) Failing after 3m12s
問題:description = debate_summary[:500],用戶看到的是內部審計文字 修復:從 diagnosis.top_hypothesis + action_plan.top_candidate 組出人類可讀摘要 格式:「根因:[描述](信心 X%);方案:[動作]」 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -983,16 +983,31 @@ def _package_to_proposal_data(package: Any) -> dict[str, Any]:
|
||||
else:
|
||||
risk_level = "high"
|
||||
|
||||
# 組出人類可讀的 description(Telegram 卡片顯示用)
|
||||
# 2026-04-16 ogt + Claude Sonnet 4.6: 修復 description=debate_summary garbage
|
||||
diag = getattr(package, "diagnosis", None)
|
||||
plan = getattr(package, "action_plan", None)
|
||||
desc_parts = []
|
||||
if diag and getattr(diag, "top_hypothesis", None):
|
||||
h = diag.top_hypothesis
|
||||
desc_parts.append(f"根因:{h.description[:150]}(信心 {h.confidence:.0%})")
|
||||
if plan and getattr(plan, "top_candidate", None):
|
||||
c = plan.top_candidate
|
||||
desc_parts.append(f"方案:{c.action[:100]}")
|
||||
if package.blocked_reason:
|
||||
desc_parts.append(f"備注:{package.blocked_reason[:100]}")
|
||||
description = ";".join(desc_parts) if desc_parts else (action[:200] if action else "待分析")
|
||||
|
||||
return {
|
||||
"action": action,
|
||||
"kubectl_command": action if action.startswith("kubectl") else "",
|
||||
"description": package.debate_summary[:500] if package.debate_summary else "",
|
||||
"description": description,
|
||||
"reasoning": package.debate_summary[:1000] if package.debate_summary else "",
|
||||
"confidence": confidence,
|
||||
"risk_level": risk_level,
|
||||
"source": "phase2_agent_debate",
|
||||
"requires_human_review": package.requires_human_approval,
|
||||
# Phase 2 診斷摘要(供 Telegram 卡片顯示)
|
||||
# Phase 2 診斷摘要(供 Audit Trail / 學習閉環,不直接顯示給用戶)
|
||||
"debate_summary": package.debate_summary or "",
|
||||
"all_agents_degraded": package.all_agents_degraded,
|
||||
"blocked_reason": package.blocked_reason or "",
|
||||
|
||||
Reference in New Issue
Block a user