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

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

parent a0b5be38
...@@ -831,13 +831,13 @@ public class ThemeManager { ...@@ -831,13 +831,13 @@ public class ThemeManager {
while (content.length() > 5000) { while (content.length() > 5000) {
b = TencentcloudUtils.textModeration(content.substring(0, 5000)); b = TencentcloudUtils.textModeration(content.substring(0, 5000));
if (StringUtils.isNotBlank(b)) { 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); content = content.substring(5000);
} }
b = TencentcloudUtils.textModeration(content); b = TencentcloudUtils.textModeration(content);
if (StringUtils.isNotBlank(b)) { 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 { ...@@ -86,8 +86,8 @@ public class TencentcloudUtils {
try { try {
res = getTmsClient().TextModeration(req); res = getTmsClient().TextModeration(req);
// suggestion Block 不通过 // suggestion Block 不通过
if (res.getSuggestion().equals("Block")) { if (res.getSuggestion().equals("Block") && res.getKeywords().length > 0) {
return res.getKeywords().toString(); return ":"+res.getKeywords()[0];
} }
} catch (TencentCloudSDKException e) { } catch (TencentCloudSDKException e) {
log.error("调用腾文本内容安全异常"); 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