feat: 放大 AI 规格候选上限至150条 (#284)
This commit is contained in:
@@ -73,23 +73,23 @@ func TestResolveExtraDimensionSignals_额外维度必须有确定信号(t *testi
|
||||
}
|
||||
|
||||
func TestMatchSybSpecWithAI_候选白名单低置信度和人工优先(t *testing.T) {
|
||||
t.Run("100个合格候选允许调用模型", func(t *testing.T) {
|
||||
t.Run("150个合格候选允许调用模型", func(t *testing.T) {
|
||||
db := newTestDB(t)
|
||||
actor := seedAIMatchContextWithData(t, db, "SYB-AI-100", "黑色,M", collectedAIChoicesWithCount(t, 100))
|
||||
actor := seedAIMatchContextWithData(t, db, "SYB-AI-150", "黑色,M", collectedAIChoicesWithCount(t, 150))
|
||||
fake := &fakeAIModelClient{response: AIModelMatchResponse{Conclusion: "match", CandidateID: "C01", ConfidenceBPS: 9200, Reason: "候选之一规格一致"}}
|
||||
result, err := MatchSybSpecWithAI(context.Background(), db, &actor, testAIMatchSnapshot(fake), "SYB-AI-100", "")
|
||||
if err != nil || result.Outcome != "ai_saved" || fake.calls != 1 || len(fake.last.Candidates) != 100 {
|
||||
t.Fatalf("100 条候选应调用模型: result=%+v calls=%d candidate_count=%d err=%v", result, fake.calls, len(fake.last.Candidates), err)
|
||||
result, err := MatchSybSpecWithAI(context.Background(), db, &actor, testAIMatchSnapshot(fake), "SYB-AI-150", "")
|
||||
if err != nil || result.Outcome != "ai_saved" || fake.calls != 1 || len(fake.last.Candidates) != 150 {
|
||||
t.Fatalf("150 条候选应调用模型: result=%+v calls=%d candidate_count=%d err=%v", result, fake.calls, len(fake.last.Candidates), err)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("101个合格候选不调用模型也不保存映射", func(t *testing.T) {
|
||||
t.Run("151个合格候选不调用模型也不保存映射", func(t *testing.T) {
|
||||
db := newTestDB(t)
|
||||
actor := seedAIMatchContextWithData(t, db, "SYB-AI-101", "黑色,M", collectedAIChoicesWithCount(t, 101))
|
||||
actor := seedAIMatchContextWithData(t, db, "SYB-AI-151", "黑色,M", collectedAIChoicesWithCount(t, 151))
|
||||
fake := &fakeAIModelClient{err: errors.New("候选超过上限时不应调用模型")}
|
||||
result, err := MatchSybSpecWithAI(context.Background(), db, &actor, testAIMatchSnapshot(fake), "SYB-AI-101", "")
|
||||
if err != nil || result.Outcome != "rejected" || result.Message != "可购买候选超过 100 条,请先人工核对" || fake.calls != 0 {
|
||||
t.Fatalf("101 条候选应在模型调用前拒绝: result=%+v calls=%d err=%v", result, fake.calls, err)
|
||||
result, err := MatchSybSpecWithAI(context.Background(), db, &actor, testAIMatchSnapshot(fake), "SYB-AI-151", "")
|
||||
if err != nil || result.Outcome != "rejected" || result.Message != "可购买候选超过 150 条,请先人工核对" || fake.calls != 0 {
|
||||
t.Fatalf("151 条候选应在模型调用前拒绝: result=%+v calls=%d candidate_count=%d err=%v", result, fake.calls, len(fake.last.Candidates), err)
|
||||
}
|
||||
assertNoAIMapping(t, db)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user