fix(ai): 移除 confidence 預設值,強制 LLM 真實計算
變更: 1. models/ai.py: confidence 改為 REQUIRED (移除 default=0.8) 2. openclaw.py: 如果 LLM 沒輸出 confidence,設為 0.5 + COLLAB 根本原因: - 原本 Pydantic default=0.8 導致信心分數永遠是 80% - 現在強制 LLM 必須計算真實信心分數 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -996,6 +996,17 @@ class OpenClawService:
|
||||
if "suggested_action" not in data:
|
||||
data["suggested_action"] = "NO_ACTION"
|
||||
|
||||
# Step 2.5: 2026-03-29 ogt - 強制 confidence 必須由 LLM 輸出
|
||||
# 如果 LLM 沒有輸出 confidence,強制設為 0.5 並標記為 COLLAB
|
||||
if "confidence" not in data or not isinstance(data["confidence"], (int, float)):
|
||||
logger.warning(
|
||||
"llm_missing_confidence",
|
||||
raw_confidence=data.get("confidence"),
|
||||
forcing_collab=True,
|
||||
)
|
||||
data["confidence"] = 0.5 # 低信心分數
|
||||
data["primary_responsibility"] = "COLLAB" # 強制協作處理
|
||||
|
||||
# Step 3: 使用 Pydantic 驗證 (會自動正規化 risk_level, data_impact 等)
|
||||
decision = OpenClawDecision(**data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user