Commit 890014d4 authored by 刘基明's avatar 刘基明

文本校验打印违规关键字fix

parent a0b5be38
......@@ -831,13 +831,13 @@ public class ThemeManager {
while (content.length() > 5000) {
b = TencentcloudUtils.textModeration(content.substring(0, 5000));
if (StringUtils.isNotBlank(b)) {
throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(),ErrorCodeConstant.CONTENT_ILLEGAL.getMsg()+":"+b);
throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(),ErrorCodeConstant.CONTENT_ILLEGAL.getMsg()+b);
}
content = content.substring(5000);
}
b = TencentcloudUtils.textModeration(content);
if (StringUtils.isNotBlank(b)) {
throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(),ErrorCodeConstant.CONTENT_ILLEGAL.getMsg()+":"+b);
throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(),ErrorCodeConstant.CONTENT_ILLEGAL.getMsg()+b);
}
......
......@@ -86,8 +86,8 @@ public class TencentcloudUtils {
try {
res = getTmsClient().TextModeration(req);
// suggestion Block 不通过
if (res.getSuggestion().equals("Block")) {
return res.getKeywords().toString();
if (res.getSuggestion().equals("Block") && res.getKeywords().length > 0) {
return ":"+res.getKeywords()[0];
}
} catch (TencentCloudSDKException e) {
log.error("调用腾文本内容安全异常");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment