feat(qaops): 接入独立只读问答查询与治理覆盖复检

This commit is contained in:
姚章浩
2026-10-17 09:04:19 +08:00
parent c1d49adb62
commit fd04bf7886
42 changed files with 4479 additions and 5 deletions
+26
View File
@@ -0,0 +1,26 @@
package dobotaiops
import "testing"
func TestCoverageRuleUsesExactSubstringWithoutInventingPositiveCoverage(t *testing.T) {
for _, tc := range []struct {
answer string
uncovered bool
}{
{"当前暂无已发布的权威知识,暂不建议操作。", true},
{"根据引用资料:当前暂无已发布。请联系技术支持。", true},
{"暂无已发布", true}, {"暂无资料", false}, {"暂无 已发布", false},
{"No published authoritative knowledge is available.", false}, {"已有知识可以参考。", false}, {"", false},
} {
result := CheckAnswerCoverage(tc.answer)
if (result.Verdict == "uncovered") != tc.uncovered {
t.Fatalf("exact substring rule mismatch: %+v", result)
}
if !tc.uncovered && (result.Verdict != "" || result.State != "pending") {
t.Fatal("absence of marker must not imply covered or evaluated")
}
if result.RuleVersion == "" {
t.Fatal("rule result must retain version")
}
}
}