diff --git a/apps/api/src/services/consensus_engine.py b/apps/api/src/services/consensus_engine.py index 5626acf4..164fee1e 100644 --- a/apps/api/src/services/consensus_engine.py +++ b/apps/api/src/services/consensus_engine.py @@ -196,22 +196,22 @@ class SREAgent(ExpertAgent): if any(kw in alert_names for kw in ["crash", "restart", "oom", "killed"]): action = "重新啟動服務以恢復穩定性" kubectl = f"kubectl rollout restart deployment/{target} -n awoooi-prod" - confidence = 0.85 + confidence = 0.0 # 🔴 規則匹配,非 AI 分析 risk = "medium" elif any(kw in alert_names for kw in ["latency", "slow", "timeout"]): action = "擴展副本數以分散負載" kubectl = f"kubectl scale deployment/{target} --replicas=3 -n awoooi-prod" - confidence = 0.80 + confidence = 0.0 # 🔴 規則匹配,非 AI 分析 risk = "low" elif any(kw in alert_names for kw in ["cpu", "memory", "resource"]): action = "調整資源限制或擴展副本" kubectl = f"kubectl scale deployment/{target} --replicas=2 -n awoooi-prod" - confidence = 0.75 + confidence = 0.0 # 🔴 規則匹配,非 AI 分析 risk = "medium" else: action = "進行安全重啟以排除未知問題" kubectl = f"kubectl rollout restart deployment/{target} -n awoooi-prod" - confidence = 0.60 + confidence = 0.0 # 🔴 規則匹配,非 AI 分析 risk = "medium" return AgentOpinion( @@ -250,11 +250,11 @@ class SecurityAgent(ExpertAgent): if security_concerns: action = "建議先隔離受影響服務,啟用 NetworkPolicy 限制" - confidence = 0.70 + confidence = 0.0 # 🔴 規則匹配,非 AI 分析 risk = "critical" else: action = "無明顯資安風險,建議 SRE 處理" - confidence = 0.85 + confidence = 0.0 # 🔴 規則匹配,非 AI 分析 risk = "low" return AgentOpinion( @@ -289,7 +289,7 @@ class CostAgent(ExpertAgent): agent_type=self.agent_type, action=action, reasoning="FinOps 分析: 使用 HPA 可在負載降低後自動縮減,相比固定擴容可節省約 40% 成本", - confidence=0.75, + confidence=0.0, # 🔴 規則匹配,非 AI 分析 risk_assessment="成本風險: low,使用 HPA 可自動調節", kubectl_command=kubectl, priority=4, @@ -313,11 +313,11 @@ class PerformanceAgent(ExpertAgent): if any(kw in alert_names for kw in ["latency", "p99", "slow"]): action = "建議增加資源限制並啟用 PodDisruptionBudget" kubectl = f"kubectl patch deployment/{target} -n awoooi-prod -p '{{\"spec\":{{\"template\":{{\"spec\":{{\"containers\":[{{\"name\":\"{target}\",\"resources\":{{\"limits\":{{\"cpu\":\"2\",\"memory\":\"2Gi\"}}}}}}]}}}}}}}}'" - confidence = 0.80 + confidence = 0.0 # 🔴 規則匹配,非 AI 分析 else: action = "當前效能指標正常,建議觀察" kubectl = None - confidence = 0.70 + confidence = 0.0 # 🔴 規則匹配,非 AI 分析 return AgentOpinion( agent_type=self.agent_type,