AI识别 增加标题检测
This commit is contained in:
1 parent
be76e62ddd
commit
3f11ae23bd
2 files changed
+17
-1
No files matched your search
@@ -37,7 +37,8 @@ public sealed class ComplianceResult
|
||||
public string Error { get; internal set; }
|
||||
public string Status => Error != null ? "失败,可重试" : Hits.Length == 0 ? "安全" : "有风险";
|
||||
public string Summary => Error != null ? "失败:" + Error :
|
||||
Hits.Length == 0 ? Status : $"有风险:第 {HitImageNumber} 张图片命中关键词:{string.Join(",", Hits)}";
|
||||
Hits.Length == 0 ? Status : $"有风险:{HitSource}命中关键词:{string.Join(",", Hits)}";
|
||||
private string HitSource => HitImageNumber == 0 ? "标题" : $"第 {HitImageNumber} 张图片";
|
||||
}
|
||||
|
||||
public sealed class ComplianceBatchResult
|
||||
@@ -217,6 +218,12 @@ public static class GoodsComplianceService
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
if (string.IsNullOrWhiteSpace(product?.ProductId)) throw new InvalidDataException("缺少商品 ID。");
|
||||
result.Hits = Matches(product.Title ?? string.Empty, words);
|
||||
if (result.Hits.Length > 0)
|
||||
{
|
||||
result.Text = product.Title;
|
||||
return result;
|
||||
}
|
||||
var urls = SelectImages(product.MainImages, options.MainCount)
|
||||
.Concat(SelectImages(product.DetailImages, options.DetailCount));
|
||||
if (options.IncludeSku) urls = urls.Concat(SelectImages(product.Skus?.Select(s => s?.ImageUrl), null));
|
||||
|
||||
Reference in new issue
Block a user