Skip to content

Commit 52ad5bd

Browse files
author
Kerwin
committed
fix: baidu audit not working (Closes #36)
1 parent 8afc235 commit 52ad5bd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

service/src/utils/textAudit.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ export class BaiduTextAuditService implements TextAuditService {
4040
// https://ai.baidu.com/ai-doc/ANTIPORN/Nk3h6xbb2#%E7%BB%86%E5%88%86%E6%A0%87%E7%AD%BE%E5%AF%B9%E7%85%A7%E8%A1%A8
4141

4242
// 3 仅政治
43-
const safe = data.data.filter(d => d.subType === 3).length <= 0
44-
if (!safe || !this.options.label)
45-
return safe
43+
const sensitive = data.data.filter(d => d.subType === 3).length > 0
44+
if (sensitive || !this.options.label)
45+
return sensitive
4646
const str = JSON.stringify(data)
4747
for (const l of this.options.label.split(',')) {
48-
if (str.indexOf(l))
48+
if (str.includes(l))
4949
return true
5050
}
5151
return false

0 commit comments

Comments
 (0)