AI识别 增加标题检测

This commit is contained in:
chfei committed 2026-11-09 10:50:48 +08:00
1 parent be76e62ddd
commit 3f11ae23bd
2 files changed
+17 -1

No files matched your search

+9
View File
@@ -50,6 +50,15 @@ internal static class GoodsComplianceSmoke
Check(words.Length == 5);
Check(GoodsComplianceService.Matches("ABC广告", words).SequenceEqual(new[] { "广告", "abc" }));
Check(GoodsComplianceService.Matches("普通商品", words).Length == 0);
// Exercise detection without calling the reporting API.
var detect = typeof(GoodsComplianceService).GetMethod("DetectProductAsync",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
var titleHit = ((System.Threading.Tasks.Task<ComplianceResult>)detect.Invoke(null, new object[]
{
new Product { ProductId = "title", Title = "ABC广告" }, new ComplianceOptions(), words, null,
System.Threading.CancellationToken.None
})).GetAwaiter().GetResult();
Check(titleHit.Status == "有风险" && titleHit.Summary == "有风险:标题命中关键词:广告,abc");
var invalidImage = new Product { ProductId = "bad-image", MainImages = new List<string> { "file:///image.jpg" } };
var statuses = new List<string>();
GoodsComplianceService.DetectSelectedAsync(new[] { cloud }, item => invalidImage,