feat(learning): 實作 Playbook 信心度調整機制 (ADR-030)
- 新增 _promote_playbook: 高評分提升信心度 +0.1 - 新增 _demote_playbook: 低評分降低信心度 -0.15 - 新增 find_by_source_incident: 按 incident_id 查詢 Playbook - 新增 adjust_confidence: 信心度調整 + 狀態自動轉換 - 新增 Playbook.failure_rate 屬性 自動狀態轉換: - ai_confidence >= 0.9 + DRAFT → 自動 APPROVED - ai_confidence < 0.3 + failure_rate > 50% → 自動 DEPRECATED 測試: 13 案例全部通過 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -208,6 +208,12 @@ class Playbook(BaseModel):
|
||||
total = self.success_count + self.failure_count
|
||||
return self.success_count / total if total > 0 else 0.0
|
||||
|
||||
@property
|
||||
def failure_rate(self) -> float:
|
||||
"""失敗率 (2026-03-30 Claude Code: Learning Service 信心度調整用)"""
|
||||
total = self.success_count + self.failure_count
|
||||
return self.failure_count / total if total > 0 else 0.0
|
||||
|
||||
@property
|
||||
def is_high_quality(self) -> bool:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user