@zhin.js/plugin-content-moderation 1.1.9 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -35
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -10,45 +10,48 @@ pnpm exec zhin install @zhin.js/plugin-content-moderation
|
|
|
10
10
|
|
|
11
11
|
## 配置
|
|
12
12
|
|
|
13
|
-
在应用目录运行安装命令,会安装依赖并挂载到 `
|
|
13
|
+
在应用目录运行安装命令,会安装依赖并挂载到 主配置 `plugins` 映射,实例名为 `content-moderation`。在 `zhin.config.yml` 的实例节点修改配置:
|
|
14
14
|
|
|
15
15
|
```yaml
|
|
16
|
+
configVersion: 2
|
|
16
17
|
plugins:
|
|
17
|
-
content-moderation:
|
|
18
|
+
content-moderation: "@zhin.js/plugin-content-moderation"
|
|
19
|
+
content-moderation:
|
|
20
|
+
enabled: true
|
|
21
|
+
onError: open # 源失败默认:open | closed
|
|
22
|
+
maskChar: "*"
|
|
23
|
+
replyTemplate: "消息含不当内容,已拦截。"
|
|
24
|
+
masters: [] # 额外 master userId(兜底)
|
|
25
|
+
inbound:
|
|
18
26
|
enabled: true
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
bypassMasters: true
|
|
28
|
+
whitelist:
|
|
29
|
+
userIds: []
|
|
30
|
+
conversationIds: []
|
|
31
|
+
outbound:
|
|
32
|
+
enabled: true
|
|
33
|
+
bypass: false # true 才跳过出站审查
|
|
34
|
+
actions:
|
|
35
|
+
# 可整表覆盖;缺省偏严
|
|
36
|
+
pass: allow
|
|
37
|
+
low: log
|
|
38
|
+
medium: redact
|
|
39
|
+
high: drop
|
|
40
|
+
critical: [ drop, recall ]
|
|
41
|
+
sources:
|
|
42
|
+
- id: local
|
|
43
|
+
type: local
|
|
30
44
|
enabled: true
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
enabled: true
|
|
42
|
-
includeBuiltin: true # 默认 true:合并内置分级词库
|
|
43
|
-
defaultSeverity: high # 未标注分级的自定义词默认等级(兼容旧字段 severity)
|
|
44
|
-
words:
|
|
45
|
-
- 自定义敏感词 # → defaultSeverity
|
|
46
|
-
- word: 擦边广告
|
|
47
|
-
severity: low
|
|
48
|
-
- word: 诈骗话术
|
|
49
|
-
severity: high
|
|
50
|
-
# wordFiles: ["./data/bad-words.txt"]
|
|
51
|
-
# 词库文件行:word / severity:word / word|severity
|
|
45
|
+
includeBuiltin: true # 默认 true:合并内置分级词库
|
|
46
|
+
defaultSeverity: high # 未标注分级的自定义词默认等级(兼容旧字段 severity)
|
|
47
|
+
words:
|
|
48
|
+
- 自定义敏感词 # → defaultSeverity
|
|
49
|
+
- word: 擦边广告
|
|
50
|
+
severity: low
|
|
51
|
+
- word: 诈骗话术
|
|
52
|
+
severity: high
|
|
53
|
+
# wordFiles: ["./data/bad-words.txt"]
|
|
54
|
+
# 词库文件行:word / severity:word / word|severity
|
|
52
55
|
# - id: http-1
|
|
53
56
|
# type: http
|
|
54
57
|
# url: "https://example.com/moderate"
|
|
@@ -97,7 +100,7 @@ plugins:
|
|
|
97
100
|
| `critical` | `[drop, recall]` | 入站丢弃并尽量撤回;出站不发(`recall` 忽略) |
|
|
98
101
|
|
|
99
102
|
|
|
100
|
-
示例:入站 medium 想「提示但仍放行」,在 `
|
|
103
|
+
示例:入站 medium 想「提示但仍放行」,在 `content-moderation.actions` 中修改:
|
|
101
104
|
|
|
102
105
|
```yaml
|
|
103
106
|
actions:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/plugin-content-moderation",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"description": "Content moderation plugin for Zhin.js — inbound/outbound multi-source scanning (Plugin Runtime)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
},
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@zhin.js/core": "1.1.
|
|
40
|
+
"@zhin.js/core": "1.1.46",
|
|
41
41
|
"@zhin.js/logger": "1.1.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"typescript": "^6.0.3",
|
|
45
45
|
"vitest": "^4.1.10",
|
|
46
|
-
"zhin.js": "1.1.
|
|
46
|
+
"zhin.js": "1.1.11"
|
|
47
47
|
},
|
|
48
48
|
"repository": {
|
|
49
49
|
"type": "git",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"plugins": []
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@zhin.js/middleware": "^1.1.
|
|
76
|
-
"zhin.js": "^1.1.
|
|
75
|
+
"@zhin.js/middleware": "^1.1.7",
|
|
76
|
+
"zhin.js": "^1.1.11"
|
|
77
77
|
},
|
|
78
78
|
"peerDependenciesMeta": {
|
|
79
79
|
"@zhin.js/middleware": {
|