@aalis/plugin-trigger-policy 0.16.0 → 0.17.0
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/dist/config.d.ts +118 -157
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +55 -122
- package/dist/config.js.map +1 -1
- package/dist/idle-scheduler.d.ts +11 -6
- package/dist/idle-scheduler.d.ts.map +1 -1
- package/dist/idle-scheduler.js +29 -19
- package/dist/idle-scheduler.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -36
- package/dist/index.js.map +1 -1
- package/dist/locales/en.d.ts +36 -0
- package/dist/locales/en.d.ts.map +1 -0
- package/dist/locales/en.js +36 -0
- package/dist/locales/en.js.map +1 -0
- package/dist/state.d.ts +6 -10
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +1 -3
- package/dist/state.js.map +1 -1
- package/dist/texts.d.ts +71 -0
- package/dist/texts.d.ts.map +1 -0
- package/dist/texts.js +44 -0
- package/dist/texts.js.map +1 -0
- package/package.json +18 -13
package/dist/config.d.ts
CHANGED
|
@@ -1,262 +1,223 @@
|
|
|
1
|
-
import { type ConfigOf } from '@aalis/schema-config';
|
|
1
|
+
import { type ConfigOf, type SessionFieldsOf } from '@aalis/schema-config';
|
|
2
2
|
export declare const configSchema: {
|
|
3
|
-
readonly
|
|
4
|
-
readonly
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
readonly
|
|
9
|
-
readonly
|
|
3
|
+
readonly audience: {
|
|
4
|
+
readonly session: {
|
|
5
|
+
readonly appliesTo: readonly ["room"];
|
|
6
|
+
readonly prominence: "common";
|
|
7
|
+
};
|
|
8
|
+
readonly type: "select";
|
|
9
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
10
|
+
readonly description: import("@aalis/schema-i18n").TextRef;
|
|
11
|
+
readonly default: string;
|
|
12
|
+
readonly options: {
|
|
13
|
+
label: import("@aalis/schema-i18n").TextRef;
|
|
14
|
+
value: string;
|
|
15
|
+
}[];
|
|
10
16
|
};
|
|
11
17
|
readonly intervalMode: {
|
|
12
18
|
readonly type: "select";
|
|
13
|
-
readonly label: "
|
|
19
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
14
20
|
readonly default: "both";
|
|
15
21
|
readonly options: [{
|
|
16
|
-
readonly label: "
|
|
22
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
17
23
|
readonly value: "fixed";
|
|
18
24
|
}, {
|
|
19
|
-
readonly label: "
|
|
25
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
20
26
|
readonly value: "dynamic";
|
|
21
27
|
}, {
|
|
22
|
-
readonly label: "
|
|
28
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
23
29
|
readonly value: "both";
|
|
24
30
|
}];
|
|
31
|
+
readonly session: {
|
|
32
|
+
readonly appliesTo: readonly ["room"];
|
|
33
|
+
readonly prominence: "advanced";
|
|
34
|
+
};
|
|
25
35
|
};
|
|
26
36
|
readonly triggerOnAt: {
|
|
27
37
|
readonly type: "boolean";
|
|
28
|
-
readonly label: "
|
|
38
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
29
39
|
readonly default: true;
|
|
30
|
-
readonly description: "@
|
|
40
|
+
readonly description: import("@aalis/schema-i18n").TextRef;
|
|
41
|
+
readonly session: {
|
|
42
|
+
readonly appliesTo: readonly ["room"];
|
|
43
|
+
readonly prominence: "advanced";
|
|
44
|
+
};
|
|
31
45
|
};
|
|
32
46
|
readonly triggerOnPoke: {
|
|
33
47
|
readonly type: "boolean";
|
|
34
|
-
readonly label: "
|
|
48
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
35
49
|
readonly default: true;
|
|
36
|
-
readonly description: "
|
|
50
|
+
readonly description: import("@aalis/schema-i18n").TextRef;
|
|
51
|
+
readonly session: {
|
|
52
|
+
readonly appliesTo: readonly ["room"];
|
|
53
|
+
readonly prominence: "advanced";
|
|
54
|
+
};
|
|
37
55
|
};
|
|
38
56
|
readonly triggerNames: {
|
|
39
57
|
readonly type: "string";
|
|
40
|
-
readonly label: "
|
|
58
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
41
59
|
readonly default: "";
|
|
60
|
+
readonly session: {
|
|
61
|
+
readonly appliesTo: readonly ["room"];
|
|
62
|
+
readonly prominence: "advanced";
|
|
63
|
+
};
|
|
42
64
|
};
|
|
43
65
|
readonly muteKeywords: {
|
|
44
66
|
readonly type: "string";
|
|
45
|
-
readonly label: "
|
|
67
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
46
68
|
readonly default: "";
|
|
69
|
+
readonly session: {
|
|
70
|
+
readonly appliesTo: readonly ["room"];
|
|
71
|
+
readonly prominence: "advanced";
|
|
72
|
+
};
|
|
47
73
|
};
|
|
48
74
|
readonly muteTimeSeconds: {
|
|
49
75
|
readonly type: "number";
|
|
50
|
-
readonly label: "
|
|
76
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
51
77
|
readonly default: 60;
|
|
78
|
+
readonly session: {
|
|
79
|
+
readonly appliesTo: readonly ["room"];
|
|
80
|
+
readonly prominence: "advanced";
|
|
81
|
+
};
|
|
52
82
|
};
|
|
53
83
|
readonly fixedInterval: {
|
|
54
84
|
readonly type: "number";
|
|
55
|
-
readonly label: "
|
|
85
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
56
86
|
readonly default: 5;
|
|
87
|
+
readonly session: {
|
|
88
|
+
readonly appliesTo: readonly ["room"];
|
|
89
|
+
readonly prominence: "advanced";
|
|
90
|
+
};
|
|
57
91
|
};
|
|
58
92
|
readonly activityScoreLower: {
|
|
59
93
|
readonly type: "number";
|
|
60
|
-
readonly label: "
|
|
94
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
61
95
|
readonly default: 0.3;
|
|
96
|
+
readonly session: {
|
|
97
|
+
readonly appliesTo: readonly ["room"];
|
|
98
|
+
readonly prominence: "advanced";
|
|
99
|
+
};
|
|
62
100
|
};
|
|
63
101
|
readonly activityScoreUpper: {
|
|
64
102
|
readonly type: "number";
|
|
65
|
-
readonly label: "
|
|
103
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
66
104
|
readonly default: 0.85;
|
|
105
|
+
readonly session: {
|
|
106
|
+
readonly appliesTo: readonly ["room"];
|
|
107
|
+
readonly prominence: "advanced";
|
|
108
|
+
};
|
|
67
109
|
};
|
|
68
110
|
readonly activityDecayMinutes: {
|
|
69
111
|
readonly type: "number";
|
|
70
|
-
readonly label: "
|
|
112
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
71
113
|
readonly default: 10;
|
|
114
|
+
readonly session: {
|
|
115
|
+
readonly appliesTo: readonly ["room"];
|
|
116
|
+
readonly prominence: "advanced";
|
|
117
|
+
};
|
|
72
118
|
};
|
|
73
119
|
readonly scoreDecayMinutes: {
|
|
74
120
|
readonly type: "number";
|
|
75
|
-
readonly label: "
|
|
121
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
76
122
|
readonly default: 0;
|
|
123
|
+
readonly session: {
|
|
124
|
+
readonly appliesTo: readonly ["room"];
|
|
125
|
+
readonly prominence: "advanced";
|
|
126
|
+
};
|
|
77
127
|
};
|
|
78
128
|
readonly idleTriggerScope: {
|
|
79
129
|
readonly type: "select";
|
|
80
|
-
readonly label: "
|
|
130
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
81
131
|
readonly default: "off";
|
|
82
132
|
readonly options: [{
|
|
83
|
-
readonly label: "
|
|
133
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
84
134
|
readonly value: "off";
|
|
85
135
|
}, {
|
|
86
|
-
readonly label: "
|
|
136
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
87
137
|
readonly value: "session";
|
|
88
138
|
}, {
|
|
89
|
-
readonly label: "
|
|
139
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
90
140
|
readonly value: "platform";
|
|
91
141
|
}];
|
|
142
|
+
readonly session: {
|
|
143
|
+
readonly appliesTo: readonly ["room"];
|
|
144
|
+
readonly prominence: "advanced";
|
|
145
|
+
};
|
|
92
146
|
};
|
|
93
147
|
readonly idleTriggerStrategy: {
|
|
94
148
|
readonly type: "select";
|
|
95
|
-
readonly label: "
|
|
149
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
96
150
|
readonly default: "all-quiet";
|
|
97
151
|
readonly options: [{
|
|
98
|
-
readonly label: "
|
|
152
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
99
153
|
readonly value: "all-quiet";
|
|
100
154
|
}, {
|
|
101
|
-
readonly label: "
|
|
155
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
102
156
|
readonly value: "fixed";
|
|
103
157
|
}];
|
|
104
158
|
};
|
|
105
159
|
readonly idleTriggerMinutes: {
|
|
106
160
|
readonly type: "number";
|
|
107
|
-
readonly label: "
|
|
161
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
108
162
|
readonly default: 180;
|
|
163
|
+
readonly session: {
|
|
164
|
+
readonly appliesTo: readonly ["room"];
|
|
165
|
+
readonly prominence: "advanced";
|
|
166
|
+
};
|
|
109
167
|
};
|
|
110
168
|
readonly idleTriggerStyle: {
|
|
111
169
|
readonly type: "select";
|
|
112
|
-
readonly label: "
|
|
170
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
113
171
|
readonly default: "exponential";
|
|
114
172
|
readonly options: [{
|
|
115
|
-
readonly label: "
|
|
173
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
116
174
|
readonly value: "exponential";
|
|
117
175
|
}, {
|
|
118
|
-
readonly label: "
|
|
176
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
119
177
|
readonly value: "fixed";
|
|
120
178
|
}];
|
|
179
|
+
readonly session: {
|
|
180
|
+
readonly appliesTo: readonly ["room"];
|
|
181
|
+
readonly prominence: "advanced";
|
|
182
|
+
};
|
|
121
183
|
};
|
|
122
184
|
readonly idleTriggerMaxMinutes: {
|
|
123
185
|
readonly type: "number";
|
|
124
|
-
readonly label: "
|
|
186
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
125
187
|
readonly default: 1440;
|
|
188
|
+
readonly session: {
|
|
189
|
+
readonly appliesTo: readonly ["room"];
|
|
190
|
+
readonly prominence: "advanced";
|
|
191
|
+
};
|
|
126
192
|
};
|
|
127
193
|
readonly idleTriggerJitter: {
|
|
128
194
|
readonly type: "boolean";
|
|
129
|
-
readonly label: "
|
|
195
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
130
196
|
readonly default: true;
|
|
197
|
+
readonly session: {
|
|
198
|
+
readonly appliesTo: readonly ["room"];
|
|
199
|
+
readonly prominence: "advanced";
|
|
200
|
+
};
|
|
131
201
|
};
|
|
132
202
|
readonly idleTriggerPrompt: {
|
|
133
203
|
readonly type: "string";
|
|
134
|
-
readonly label: "
|
|
204
|
+
readonly label: import("@aalis/schema-i18n").TextRef;
|
|
135
205
|
readonly default: "";
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
readonly label: "分作用域覆盖";
|
|
140
|
-
readonly description: "每项 {scope: \"platform:sessionType[:targetId]\", ...} 仅在该 scope 命中时覆盖列出的字段;字段留空(或不填)= 沿用上方默认,不会被覆盖为 0/空。写一条 override 自动启用该 scope。";
|
|
141
|
-
readonly default: [];
|
|
142
|
-
readonly items: {
|
|
143
|
-
readonly scope: {
|
|
144
|
-
readonly type: "string";
|
|
145
|
-
readonly label: "作用域";
|
|
146
|
-
readonly description: "格式 platform:sessionType[:targetId],支持 *";
|
|
147
|
-
readonly required: true;
|
|
148
|
-
};
|
|
149
|
-
readonly intervalMode: {
|
|
150
|
-
readonly type: "select";
|
|
151
|
-
readonly label: "间隔模式";
|
|
152
|
-
readonly options: [{
|
|
153
|
-
readonly label: "fixed";
|
|
154
|
-
readonly value: "fixed";
|
|
155
|
-
}, {
|
|
156
|
-
readonly label: "dynamic";
|
|
157
|
-
readonly value: "dynamic";
|
|
158
|
-
}, {
|
|
159
|
-
readonly label: "both";
|
|
160
|
-
readonly value: "both";
|
|
161
|
-
}];
|
|
162
|
-
};
|
|
163
|
-
readonly triggerOnAt: {
|
|
164
|
-
readonly type: "boolean";
|
|
165
|
-
readonly label: "检测 @ 提及";
|
|
166
|
-
};
|
|
167
|
-
readonly triggerOnPoke: {
|
|
168
|
-
readonly type: "boolean";
|
|
169
|
-
readonly label: "戳一戳直触发";
|
|
170
|
-
};
|
|
171
|
-
readonly triggerNames: {
|
|
172
|
-
readonly type: "string";
|
|
173
|
-
readonly label: "触发名别名(逗号或换行分隔)";
|
|
174
|
-
};
|
|
175
|
-
readonly muteKeywords: {
|
|
176
|
-
readonly type: "string";
|
|
177
|
-
readonly label: "禁言关键词(逗号或换行分隔)";
|
|
178
|
-
};
|
|
179
|
-
readonly muteTimeSeconds: {
|
|
180
|
-
readonly type: "number";
|
|
181
|
-
readonly label: "禁言关键词时长(秒)";
|
|
182
|
-
};
|
|
183
|
-
readonly fixedInterval: {
|
|
184
|
-
readonly type: "number";
|
|
185
|
-
readonly label: "固定间隔(每 N 条触发)";
|
|
186
|
-
};
|
|
187
|
-
readonly activityScoreLower: {
|
|
188
|
-
readonly type: "number";
|
|
189
|
-
readonly label: "活跃指数下限";
|
|
190
|
-
};
|
|
191
|
-
readonly activityScoreUpper: {
|
|
192
|
-
readonly type: "number";
|
|
193
|
-
readonly label: "活跃指数上限";
|
|
194
|
-
};
|
|
195
|
-
readonly activityDecayMinutes: {
|
|
196
|
-
readonly type: "number";
|
|
197
|
-
readonly label: "阈值衰减分钟";
|
|
198
|
-
};
|
|
199
|
-
readonly scoreDecayMinutes: {
|
|
200
|
-
readonly type: "number";
|
|
201
|
-
readonly label: "评分衰减分钟";
|
|
202
|
-
};
|
|
203
|
-
readonly idleTriggerScope: {
|
|
204
|
-
readonly type: "select";
|
|
205
|
-
readonly label: "闲置触发范围";
|
|
206
|
-
readonly options: [{
|
|
207
|
-
readonly label: "off";
|
|
208
|
-
readonly value: "off";
|
|
209
|
-
}, {
|
|
210
|
-
readonly label: "session";
|
|
211
|
-
readonly value: "session";
|
|
212
|
-
}, {
|
|
213
|
-
readonly label: "platform";
|
|
214
|
-
readonly value: "platform";
|
|
215
|
-
}];
|
|
216
|
-
};
|
|
217
|
-
readonly idleTriggerMinutes: {
|
|
218
|
-
readonly type: "number";
|
|
219
|
-
readonly label: "闲置触发分钟";
|
|
220
|
-
};
|
|
221
|
-
readonly idleTriggerStyle: {
|
|
222
|
-
readonly type: "select";
|
|
223
|
-
readonly label: "闲置触发风格";
|
|
224
|
-
readonly options: [{
|
|
225
|
-
readonly label: "exponential";
|
|
226
|
-
readonly value: "exponential";
|
|
227
|
-
}, {
|
|
228
|
-
readonly label: "fixed";
|
|
229
|
-
readonly value: "fixed";
|
|
230
|
-
}];
|
|
231
|
-
};
|
|
232
|
-
readonly idleTriggerMaxMinutes: {
|
|
233
|
-
readonly type: "number";
|
|
234
|
-
readonly label: "闲置触发上限分钟";
|
|
235
|
-
};
|
|
236
|
-
readonly idleTriggerJitter: {
|
|
237
|
-
readonly type: "boolean";
|
|
238
|
-
readonly label: "闲置触发抖动";
|
|
239
|
-
};
|
|
240
|
-
readonly idleTriggerPrompt: {
|
|
241
|
-
readonly type: "string";
|
|
242
|
-
readonly label: "闲置触发系统提示";
|
|
243
|
-
};
|
|
206
|
+
readonly session: {
|
|
207
|
+
readonly appliesTo: readonly ["room"];
|
|
208
|
+
readonly prominence: "advanced";
|
|
244
209
|
};
|
|
245
210
|
};
|
|
246
211
|
};
|
|
247
|
-
|
|
248
|
-
export type
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
export type TriggerPolicyConfig = Omit<ParsedConfig, 'triggerNames' | 'muteKeywords' | 'overrides'> & {
|
|
212
|
+
/** 插件配置(不按会话):闲置触发策略 */
|
|
213
|
+
export type TriggerPolicyConfig = ConfigOf<typeof configSchema>;
|
|
214
|
+
type SessionFields = SessionFieldsOf<typeof configSchema>;
|
|
215
|
+
/** 一个会话此刻的参数:表单文本拆成了名字列表 */
|
|
216
|
+
export type TriggerPolicySettings = Omit<SessionFields, 'triggerNames' | 'muteKeywords'> & {
|
|
253
217
|
triggerNames: string[];
|
|
254
218
|
muteKeywords: string[];
|
|
255
|
-
overrides: TriggerScopeOverride[];
|
|
256
219
|
};
|
|
257
|
-
/**
|
|
258
|
-
export declare function
|
|
259
|
-
warn(message: string): void;
|
|
260
|
-
}): TriggerPolicyConfig;
|
|
220
|
+
/** 按会话读到的参数派生:表单文本拆成名字列表,禁言时长取正整数(不是正数的取默认) */
|
|
221
|
+
export declare function normalizeSettings(fields: SessionFields): TriggerPolicySettings;
|
|
261
222
|
export {};
|
|
262
223
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,QAAQ,EAAgB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAQzF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwGvB,CAAC;AAEH,wBAAwB;AACxB,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAC;AAEhE,KAAK,aAAa,GAAG,eAAe,CAAC,OAAO,YAAY,CAAC,CAAC;AAE1D,4BAA4B;AAC5B,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,aAAa,EAAE,cAAc,GAAG,cAAc,CAAC,GAAG;IACzF,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AASF,+CAA+C;AAC/C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,qBAAqB,CAQ9E"}
|
package/dist/config.js
CHANGED
|
@@ -1,156 +1,113 @@
|
|
|
1
|
+
import { REPLY_AUDIENCE_FIELD } from '@aalis/api-gateway';
|
|
1
2
|
import { defineConfig } from '@aalis/schema-config';
|
|
3
|
+
import { t } from './texts.js';
|
|
4
|
+
/** 可按会话设的参数:只适用于房间,收在高级里 */
|
|
5
|
+
const ROOM = { appliesTo: ['room'], prominence: 'advanced' };
|
|
6
|
+
// 生效范围与判定、闲置的参数都可按会话设(平台档、平台类型档、场所、本会话),每条消息按会话现读;
|
|
7
|
+
// 闲置触发策略管的是跨会话选举的整体节奏,只在插件配置里
|
|
2
8
|
export const configSchema = defineConfig({
|
|
3
|
-
|
|
4
|
-
type: 'multiselect',
|
|
5
|
-
label: '生效作用域',
|
|
6
|
-
default: ['*:group'],
|
|
7
|
-
dynamicOptions: 'gateway-scopes',
|
|
8
|
-
allowCustom: true,
|
|
9
|
-
description: '格式 platform:sessionType,支持通配 *;onebot:group / *:group / onebot:* / *。默认 *:group;默认作用域不含 WebUI/CLI,如需纳入,在这里显式添加。',
|
|
10
|
-
},
|
|
9
|
+
audience: { ...REPLY_AUDIENCE_FIELD, session: { appliesTo: ['room'], prominence: 'common' } },
|
|
11
10
|
intervalMode: {
|
|
12
11
|
type: 'select',
|
|
13
|
-
label: '
|
|
12
|
+
label: t('intervalModeLabel'),
|
|
14
13
|
default: 'both',
|
|
15
14
|
options: [
|
|
16
|
-
{ label: '
|
|
17
|
-
{ label: '
|
|
18
|
-
{ label: '
|
|
15
|
+
{ label: t('intervalFixed'), value: 'fixed' },
|
|
16
|
+
{ label: t('intervalDynamic'), value: 'dynamic' },
|
|
17
|
+
{ label: t('intervalBoth'), value: 'both' },
|
|
19
18
|
],
|
|
19
|
+
session: ROOM,
|
|
20
20
|
},
|
|
21
21
|
triggerOnAt: {
|
|
22
22
|
type: 'boolean',
|
|
23
|
-
label: '
|
|
23
|
+
label: t('triggerOnAtLabel'),
|
|
24
24
|
default: true,
|
|
25
|
-
description: '
|
|
25
|
+
description: t('triggerOnAtDescription'),
|
|
26
|
+
session: ROOM,
|
|
26
27
|
},
|
|
27
28
|
triggerOnPoke: {
|
|
28
29
|
type: 'boolean',
|
|
29
|
-
label: '
|
|
30
|
+
label: t('triggerOnPokeLabel'),
|
|
30
31
|
default: true,
|
|
31
|
-
description: '
|
|
32
|
+
description: t('triggerOnPokeDescription'),
|
|
33
|
+
session: ROOM,
|
|
32
34
|
},
|
|
33
|
-
triggerNames: { type: 'string', label: '
|
|
34
|
-
muteKeywords: { type: 'string', label: '
|
|
35
|
+
triggerNames: { type: 'string', label: t('triggerNamesLabel'), default: '', session: ROOM },
|
|
36
|
+
muteKeywords: { type: 'string', label: t('muteKeywordsLabel'), default: '', session: ROOM },
|
|
35
37
|
muteTimeSeconds: {
|
|
36
38
|
type: 'number',
|
|
37
|
-
label: '
|
|
39
|
+
label: t('muteTimeSecondsLabel'),
|
|
38
40
|
default: 60,
|
|
41
|
+
session: ROOM,
|
|
39
42
|
},
|
|
40
43
|
fixedInterval: {
|
|
41
44
|
type: 'number',
|
|
42
|
-
label: '
|
|
45
|
+
label: t('fixedIntervalLabel'),
|
|
43
46
|
default: 5,
|
|
47
|
+
session: ROOM,
|
|
44
48
|
},
|
|
45
|
-
activityScoreLower: { type: 'number', label: '
|
|
46
|
-
activityScoreUpper: { type: 'number', label: '
|
|
49
|
+
activityScoreLower: { type: 'number', label: t('activityScoreLowerLabel'), default: 0.3, session: ROOM },
|
|
50
|
+
activityScoreUpper: { type: 'number', label: t('activityScoreUpperLabel'), default: 0.85, session: ROOM },
|
|
47
51
|
activityDecayMinutes: {
|
|
48
52
|
type: 'number',
|
|
49
|
-
label: '
|
|
53
|
+
label: t('activityDecayMinutesLabel'),
|
|
50
54
|
default: 10,
|
|
55
|
+
session: ROOM,
|
|
51
56
|
},
|
|
52
57
|
scoreDecayMinutes: {
|
|
53
58
|
type: 'number',
|
|
54
|
-
label: '
|
|
59
|
+
label: t('scoreDecayMinutesLabel'),
|
|
55
60
|
default: 0,
|
|
61
|
+
session: ROOM,
|
|
56
62
|
},
|
|
57
63
|
idleTriggerScope: {
|
|
58
64
|
type: 'select',
|
|
59
|
-
label: '
|
|
65
|
+
label: t('idleTriggerScopeLabel'),
|
|
60
66
|
default: 'off',
|
|
61
67
|
options: [
|
|
62
|
-
{ label: '
|
|
63
|
-
{ label: '
|
|
64
|
-
{ label: '
|
|
68
|
+
{ label: t('idleScopeOff'), value: 'off' },
|
|
69
|
+
{ label: t('idleScopeSession'), value: 'session' },
|
|
70
|
+
{ label: t('idleScopePlatform'), value: 'platform' },
|
|
65
71
|
],
|
|
72
|
+
session: ROOM,
|
|
66
73
|
},
|
|
67
74
|
idleTriggerStrategy: {
|
|
68
75
|
type: 'select',
|
|
69
|
-
label: '
|
|
76
|
+
label: t('idleTriggerStrategyLabel'),
|
|
70
77
|
default: 'all-quiet',
|
|
71
78
|
options: [
|
|
72
|
-
{ label: '
|
|
73
|
-
{ label: '
|
|
79
|
+
{ label: t('idleStrategyAllQuiet'), value: 'all-quiet' },
|
|
80
|
+
{ label: t('idleStrategyFixed'), value: 'fixed' },
|
|
74
81
|
],
|
|
75
82
|
},
|
|
76
83
|
idleTriggerMinutes: {
|
|
77
84
|
type: 'number',
|
|
78
|
-
label: '
|
|
85
|
+
label: t('idleTriggerMinutesLabel'),
|
|
79
86
|
default: 180,
|
|
87
|
+
session: ROOM,
|
|
80
88
|
},
|
|
81
89
|
idleTriggerStyle: {
|
|
82
90
|
type: 'select',
|
|
83
|
-
label: '
|
|
91
|
+
label: t('idleTriggerStyleLabel'),
|
|
84
92
|
default: 'exponential',
|
|
85
93
|
options: [
|
|
86
|
-
{ label: '
|
|
87
|
-
{ label: '
|
|
94
|
+
{ label: t('idleStyleExponential'), value: 'exponential' },
|
|
95
|
+
{ label: t('idleStyleFixed'), value: 'fixed' },
|
|
88
96
|
],
|
|
97
|
+
session: ROOM,
|
|
89
98
|
},
|
|
90
99
|
idleTriggerMaxMinutes: {
|
|
91
100
|
type: 'number',
|
|
92
|
-
label: '
|
|
101
|
+
label: t('idleTriggerMaxMinutesLabel'),
|
|
93
102
|
default: 1440,
|
|
103
|
+
session: ROOM,
|
|
94
104
|
},
|
|
95
|
-
idleTriggerJitter: { type: 'boolean', label: '
|
|
105
|
+
idleTriggerJitter: { type: 'boolean', label: t('idleTriggerJitterLabel'), default: true, session: ROOM },
|
|
96
106
|
idleTriggerPrompt: {
|
|
97
107
|
type: 'string',
|
|
98
|
-
label: '
|
|
108
|
+
label: t('idleTriggerPromptLabel'),
|
|
99
109
|
default: '',
|
|
100
|
-
|
|
101
|
-
overrides: {
|
|
102
|
-
type: 'array',
|
|
103
|
-
label: '分作用域覆盖',
|
|
104
|
-
description: '每项 {scope: "platform:sessionType[:targetId]", ...} 仅在该 scope 命中时覆盖列出的字段;字段留空(或不填)= 沿用上方默认,不会被覆盖为 0/空。写一条 override 自动启用该 scope。',
|
|
105
|
-
default: [],
|
|
106
|
-
items: {
|
|
107
|
-
scope: {
|
|
108
|
-
type: 'string',
|
|
109
|
-
label: '作用域',
|
|
110
|
-
description: '格式 platform:sessionType[:targetId],支持 *',
|
|
111
|
-
required: true,
|
|
112
|
-
},
|
|
113
|
-
intervalMode: {
|
|
114
|
-
type: 'select',
|
|
115
|
-
label: '间隔模式',
|
|
116
|
-
options: [
|
|
117
|
-
{ label: 'fixed', value: 'fixed' },
|
|
118
|
-
{ label: 'dynamic', value: 'dynamic' },
|
|
119
|
-
{ label: 'both', value: 'both' },
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
triggerOnAt: { type: 'boolean', label: '检测 @ 提及' },
|
|
123
|
-
triggerOnPoke: { type: 'boolean', label: '戳一戳直触发' },
|
|
124
|
-
triggerNames: { type: 'string', label: '触发名别名(逗号或换行分隔)' },
|
|
125
|
-
muteKeywords: { type: 'string', label: '禁言关键词(逗号或换行分隔)' },
|
|
126
|
-
muteTimeSeconds: { type: 'number', label: '禁言关键词时长(秒)' },
|
|
127
|
-
fixedInterval: { type: 'number', label: '固定间隔(每 N 条触发)' },
|
|
128
|
-
activityScoreLower: { type: 'number', label: '活跃指数下限' },
|
|
129
|
-
activityScoreUpper: { type: 'number', label: '活跃指数上限' },
|
|
130
|
-
activityDecayMinutes: { type: 'number', label: '阈值衰减分钟' },
|
|
131
|
-
scoreDecayMinutes: { type: 'number', label: '评分衰减分钟' },
|
|
132
|
-
idleTriggerScope: {
|
|
133
|
-
type: 'select',
|
|
134
|
-
label: '闲置触发范围',
|
|
135
|
-
options: [
|
|
136
|
-
{ label: 'off', value: 'off' },
|
|
137
|
-
{ label: 'session', value: 'session' },
|
|
138
|
-
{ label: 'platform', value: 'platform' },
|
|
139
|
-
],
|
|
140
|
-
},
|
|
141
|
-
idleTriggerMinutes: { type: 'number', label: '闲置触发分钟' },
|
|
142
|
-
idleTriggerStyle: {
|
|
143
|
-
type: 'select',
|
|
144
|
-
label: '闲置触发风格',
|
|
145
|
-
options: [
|
|
146
|
-
{ label: 'exponential', value: 'exponential' },
|
|
147
|
-
{ label: 'fixed', value: 'fixed' },
|
|
148
|
-
],
|
|
149
|
-
},
|
|
150
|
-
idleTriggerMaxMinutes: { type: 'number', label: '闲置触发上限分钟' },
|
|
151
|
-
idleTriggerJitter: { type: 'boolean', label: '闲置触发抖动' },
|
|
152
|
-
idleTriggerPrompt: { type: 'string', label: '闲置触发系统提示' },
|
|
153
|
-
},
|
|
110
|
+
session: ROOM,
|
|
154
111
|
},
|
|
155
112
|
});
|
|
156
113
|
function splitNames(value) {
|
|
@@ -159,37 +116,13 @@ function splitNames(value) {
|
|
|
159
116
|
.map(s => s.trim())
|
|
160
117
|
.filter(Boolean);
|
|
161
118
|
}
|
|
162
|
-
/**
|
|
163
|
-
export function
|
|
164
|
-
const scopes = cfg.scopes.filter(s => s.trim() !== '');
|
|
165
|
-
if (scopes.length !== cfg.scopes.length)
|
|
166
|
-
logger?.warn('配置项 scopes 含空白作用域,已忽略');
|
|
167
|
-
const overrides = [];
|
|
168
|
-
for (const item of cfg.overrides) {
|
|
169
|
-
const scope = item.scope.trim();
|
|
170
|
-
if (!scope) {
|
|
171
|
-
logger?.warn('配置项 overrides 中有一项 scope 只含空白,已忽略该项');
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
174
|
-
const { triggerNames, muteKeywords, muteTimeSeconds, idleTriggerPrompt, ...rest } = item;
|
|
175
|
-
const normalized = { ...rest, scope };
|
|
176
|
-
if (triggerNames?.trim())
|
|
177
|
-
normalized.triggerNames = splitNames(triggerNames);
|
|
178
|
-
if (muteKeywords?.trim())
|
|
179
|
-
normalized.muteKeywords = splitNames(muteKeywords);
|
|
180
|
-
if (muteTimeSeconds !== undefined && muteTimeSeconds > 0)
|
|
181
|
-
normalized.muteTimeSeconds = Math.floor(muteTimeSeconds);
|
|
182
|
-
if (idleTriggerPrompt)
|
|
183
|
-
normalized.idleTriggerPrompt = idleTriggerPrompt;
|
|
184
|
-
overrides.push(normalized);
|
|
185
|
-
}
|
|
119
|
+
/** 按会话读到的参数派生:表单文本拆成名字列表,禁言时长取正整数(不是正数的取默认) */
|
|
120
|
+
export function normalizeSettings(fields) {
|
|
186
121
|
return {
|
|
187
|
-
...
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
muteKeywords: splitNames(cfg.muteKeywords),
|
|
192
|
-
muteTimeSeconds: cfg.muteTimeSeconds > 0 ? Math.floor(cfg.muteTimeSeconds) : configSchema.muteTimeSeconds.default,
|
|
122
|
+
...fields,
|
|
123
|
+
triggerNames: splitNames(fields.triggerNames),
|
|
124
|
+
muteKeywords: splitNames(fields.muteKeywords),
|
|
125
|
+
muteTimeSeconds: fields.muteTimeSeconds > 0 ? Math.floor(fields.muteTimeSeconds) : configSchema.muteTimeSeconds.default,
|
|
193
126
|
};
|
|
194
127
|
}
|
|
195
128
|
//# sourceMappingURL=config.js.map
|