feat: 修复 AI 风险语义并隔离 Mock 数据

This commit is contained in:
weijuesen
2026-08-14 01:16:50 +08:00
parent 839ba91354
commit 74d1948d68
29 changed files with 650 additions and 113 deletions
@@ -13,6 +13,7 @@ func TestCrossValidate(t *testing.T) {
{"AI健康+LAMP阴性 一致", "healthy", "negative", true},
{"AI异常+LAMP阴性 不一致", "sick", "negative", false},
{"AI健康+LAMP阳性 不一致", "healthy", "positive", false},
{"AI未知+LAMP阳性 不一致", "unknown", "positive", false},
{"LAMP无效 不一致", "sick", "invalid", false},
{"无AI记录 不一致", "", "positive", false},
}
@@ -28,8 +29,8 @@ func TestCrossValidate(t *testing.T) {
}
func TestAIClassFromDetections(t *testing.T) {
if got := AIClassFromDetections(nil); got != "" {
t.Errorf("空检测应为,实际 %s", got)
if got := AIClassFromDetections(nil); got != "unknown" {
t.Errorf("空检测应为 unknown,实际 %s", got)
}
if got := AIClassFromDetections([]AIDetection{{ClassName: "healthy", Confidence: 0.9}}); got != "healthy" {
t.Errorf("全健康应为 healthy,实际 %s", got)
@@ -37,4 +38,7 @@ func TestAIClassFromDetections(t *testing.T) {
if got := AIClassFromDetections([]AIDetection{{ClassName: "healthy"}, {ClassName: "sick", Confidence: 0.6}}); got != "sick" {
t.Errorf("含 sick 应为 sick,实际 %s", got)
}
if got := AIClassFromDetections([]AIDetection{{ClassName: "unknown", Confidence: 0.6}}); got != "unknown" {
t.Errorf("unknown 应为 unknown,实际 %s", got)
}
}