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:
@@ -244,6 +244,39 @@ class IPlaybookRepository(Protocol):
|
||||
"""更新執行統計"""
|
||||
...
|
||||
|
||||
async def find_by_source_incident(
|
||||
self,
|
||||
incident_id: str,
|
||||
) -> list[Playbook]:
|
||||
"""
|
||||
根據來源 Incident ID 找 Playbook
|
||||
|
||||
2026-03-30 Claude Code: Learning Service 信心度調整用
|
||||
尋找 source_incident_ids 包含此 incident_id 的 Playbooks
|
||||
"""
|
||||
...
|
||||
|
||||
async def adjust_confidence(
|
||||
self,
|
||||
playbook_id: str,
|
||||
delta: float,
|
||||
reason: str,
|
||||
) -> Playbook | None:
|
||||
"""
|
||||
調整 Playbook 信心度
|
||||
|
||||
2026-03-30 Claude Code: Learning Service 信心度調整用
|
||||
|
||||
Args:
|
||||
playbook_id: Playbook ID
|
||||
delta: 調整量 (+/- 0.0~1.0)
|
||||
reason: 調整原因 (審計用)
|
||||
|
||||
Returns:
|
||||
更新後的 Playbook,或 None (如果不存在)
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class ILearningRepository(Protocol):
|
||||
|
||||
Reference in New Issue
Block a user