fix(display): 規則匹配改顯示 ✅ 取代 🔴 0% + 修復 LLM 字串 confidence 解析
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
- telegram_gateway.py: confidence==0 (規則匹配/Expert fallback) 不再顯示 「🔴 0%」,改顯示「⚙️ 規則匹配 ✅」,兩個 card 類型都修正 - openclaw.py: NIM/Ollama 有時回傳字串 "0.85" 而非 float,導致 isinstance(str, int|float)=False → confidence 被強制設 0.0。 現在先嘗試 float() 解析,解析失敗才 fallback 0.0 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1158,6 +1158,12 @@ class OpenClawService:
|
||||
|
||||
# Step 2.5: 2026-04-01 Claude Code - 斷片補全 (信心度必須誠實)
|
||||
# 🔴 禁止填入假信心度!截斷 = 0.0,讓 auto-approve 正確判斷
|
||||
# 2026-04-12 ogt: NIM/Ollama 有時回傳字串 "0.85",先嘗試 parse 再判斷
|
||||
if "confidence" in data and isinstance(data["confidence"], str):
|
||||
try:
|
||||
data["confidence"] = float(data["confidence"])
|
||||
except (ValueError, TypeError):
|
||||
data.pop("confidence", None)
|
||||
if "confidence" not in data or not isinstance(data["confidence"], int | float):
|
||||
data["confidence"] = 0.0 # 截斷/缺失 → 0.0,不可偽造
|
||||
if "risk_level" not in data:
|
||||
|
||||
Reference in New Issue
Block a user