@nestim/koishi-plugin-qq-group-manager 1.4.7 → 1.4.8
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/CHANGELOG.md +25 -0
- package/lib/ai/engine.js +8 -0
- package/lib/ai/state.d.ts +2 -0
- package/lib/ai/state.js +2 -0
- package/lib/ai/trigger.d.ts +10 -0
- package/lib/ai/trigger.js +32 -6
- package/lib/index.d.ts +10 -0
- package/lib/index.js +4 -0
- package/package.json +1 -1
- package/src/ai/engine.ts +7 -0
- package/src/ai/state.ts +2 -0
- package/src/ai/trigger.ts +45 -5
- package/src/index.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
本文件记录所有值得注意的变更。版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
|
4
4
|
|
|
5
|
+
## 1.4.8
|
|
6
|
+
|
|
7
|
+
### 新功能
|
|
8
|
+
|
|
9
|
+
- **伪随机触发**:随机 / 混合模式下,每次随机未命中都会把下一次的概率按步长累加,
|
|
10
|
+
加到 1 时必定回复,命中后归零。避免真随机运气差时连续很多条都不接话。
|
|
11
|
+
|
|
12
|
+
- `aiPseudoRandom`:总开关(默认开)
|
|
13
|
+
- `aiPseudoRandomStep`:每次未命中增加多少(默认 0.01 = 1%)
|
|
14
|
+
- `groupRules` 里也可以按群设置 `aiPseudoRandom` / `aiPseudoRandomStep`
|
|
15
|
+
(留空跟随全局,填 0 表示该群不涨概率)
|
|
16
|
+
|
|
17
|
+
细节:
|
|
18
|
+
|
|
19
|
+
- 只有「真正掷骰且未命中」才累加;冷却中、阈值不足、点名与点名后跟随都不算;
|
|
20
|
+
- 点名 / 跟随仍然直接回复,不消耗也不清零加成;
|
|
21
|
+
- 加成到 1 时不再掷骰,直接回复;
|
|
22
|
+
- 触发成功(随机命中)后加成归零;
|
|
23
|
+
- `[ai-trigger]` 日志新增 `prob=`(本次实际概率)与 `boost=`(当前加成),方便排查。
|
|
24
|
+
|
|
25
|
+
### 测试
|
|
26
|
+
|
|
27
|
+
- 新增 6 项:未命中累加 / 命中归零、加成到 1 必定触发且不掷骰、关闭后不累加、
|
|
28
|
+
概率为 0 但已有加成仍可累计、按群覆盖步长、按群关闭。
|
|
29
|
+
|
|
5
30
|
## 1.4.7
|
|
6
31
|
|
|
7
32
|
### 新功能
|
package/lib/ai/engine.js
CHANGED
|
@@ -774,7 +774,13 @@ class AiEngine {
|
|
|
774
774
|
mention,
|
|
775
775
|
followup,
|
|
776
776
|
rng: this.rng,
|
|
777
|
+
pseudoRandom: this.setting(session, 'aiPseudoRandom') !== false,
|
|
778
|
+
randomBoost: state.randomBoost,
|
|
779
|
+
pseudoRandomStep: Math.max(0, Number(this.setting(session, 'aiPseudoRandomStep') ?? 0.01)),
|
|
777
780
|
});
|
|
781
|
+
// 伪随机加成只由「随机掷骰」更新:冷却/阈值跳过时保持不变
|
|
782
|
+
if (typeof decision.nextBoost === 'number')
|
|
783
|
+
state.randomBoost = decision.nextBoost;
|
|
778
784
|
this.log('ai-trigger', {
|
|
779
785
|
fire: decision.fire,
|
|
780
786
|
reason: decision.reason,
|
|
@@ -782,6 +788,8 @@ class AiEngine {
|
|
|
782
788
|
threshold,
|
|
783
789
|
mention,
|
|
784
790
|
followup,
|
|
791
|
+
prob: decision.effectiveProbability,
|
|
792
|
+
boost: state.randomBoost,
|
|
785
793
|
ctx: state.records.length,
|
|
786
794
|
}, session);
|
|
787
795
|
if (!decision.fire) {
|
package/lib/ai/state.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export declare class GroupState {
|
|
|
41
41
|
lastAttemptAt: number;
|
|
42
42
|
/** 上次发「冷却中」提示的时间,用于避免 @ 刷屏时反复提示 */
|
|
43
43
|
lastCooldownNoticeAt: number;
|
|
44
|
+
/** 伪随机加成:随机未命中时累加,命中后归零 */
|
|
45
|
+
randomBoost: number;
|
|
44
46
|
inFlight: boolean;
|
|
45
47
|
followup: FollowupState | null;
|
|
46
48
|
seen: Map<string, number>;
|
package/lib/ai/state.js
CHANGED
package/lib/ai/trigger.d.ts
CHANGED
|
@@ -23,6 +23,12 @@ export interface TriggerInput {
|
|
|
23
23
|
mention: boolean;
|
|
24
24
|
followup: boolean;
|
|
25
25
|
rng: () => number;
|
|
26
|
+
/** 伪随机:随机未命中时把下一次概率往上抬,直到必定触发 */
|
|
27
|
+
pseudoRandom?: boolean;
|
|
28
|
+
/** 当前已累计的概率加成(0~1) */
|
|
29
|
+
randomBoost?: number;
|
|
30
|
+
/** 每次未命中增加多少(默认 0.01) */
|
|
31
|
+
pseudoRandomStep?: number;
|
|
26
32
|
}
|
|
27
33
|
export interface TriggerDecision {
|
|
28
34
|
fire: boolean;
|
|
@@ -30,5 +36,9 @@ export interface TriggerDecision {
|
|
|
30
36
|
reason: string;
|
|
31
37
|
/** 冷却中时距离可以再次调用模型的剩余毫秒数 */
|
|
32
38
|
remainingMs?: number;
|
|
39
|
+
/** 本次判定后应保存的伪随机加成;未发生随机掷骰时为 undefined(保持不变) */
|
|
40
|
+
nextBoost?: number;
|
|
41
|
+
/** 本次实际使用的概率(基础值 + 加成),用于日志排查 */
|
|
42
|
+
effectiveProbability?: number;
|
|
33
43
|
}
|
|
34
44
|
export declare function decideTrigger(input: TriggerInput): TriggerDecision;
|
package/lib/ai/trigger.js
CHANGED
|
@@ -42,15 +42,41 @@ function decideTrigger(input) {
|
|
|
42
42
|
reason: `below-threshold(${input.counter}/${Math.max(1, input.threshold)})`,
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
// ---------- 4)
|
|
45
|
+
// ---------- 4) 概率(支持伪随机:连续未命中会逐步抬高概率) ----------
|
|
46
46
|
const needRandom = input.mode === 'random' || input.mode === 'hybrid';
|
|
47
47
|
if (needRandom) {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
const base = Math.max(0, Math.min(1, Number(input.probability) || 0));
|
|
49
|
+
const boost = Math.max(0, Number(input.randomBoost) || 0);
|
|
50
|
+
const effective = Math.min(1, base + boost);
|
|
51
|
+
const round4 = (value) => Math.round(value * 10000) / 10000;
|
|
52
|
+
if (effective <= 0) {
|
|
53
|
+
return {
|
|
54
|
+
fire: false,
|
|
55
|
+
forced: false,
|
|
56
|
+
reason: 'random-disabled',
|
|
57
|
+
nextBoost: round4(boost),
|
|
58
|
+
effectiveProbability: 0,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// 加成到 1 时必定触发,不再消耗随机数
|
|
62
|
+
if (effective >= 1 || input.rng() < effective) {
|
|
63
|
+
return {
|
|
64
|
+
fire: true,
|
|
65
|
+
forced: false,
|
|
66
|
+
reason: `trigger(${input.mode})`,
|
|
67
|
+
nextBoost: 0,
|
|
68
|
+
effectiveProbability: round4(effective),
|
|
69
|
+
};
|
|
53
70
|
}
|
|
71
|
+
const step = Math.max(0, Number(input.pseudoRandomStep) || 0);
|
|
72
|
+
const nextBoost = input.pseudoRandom ? Math.min(1, round4(boost + step)) : round4(boost);
|
|
73
|
+
return {
|
|
74
|
+
fire: false,
|
|
75
|
+
forced: false,
|
|
76
|
+
reason: `random-miss(${effective.toFixed(2)})`,
|
|
77
|
+
nextBoost,
|
|
78
|
+
effectiveProbability: round4(effective),
|
|
79
|
+
};
|
|
54
80
|
}
|
|
55
81
|
return { fire: true, forced: false, reason: `trigger(${input.mode})` };
|
|
56
82
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
27
27
|
enableAiReply: Schema<boolean, boolean>;
|
|
28
28
|
aiMessageThreshold: Schema<number, number>;
|
|
29
29
|
aiRandomReplyProbability: Schema<number, number>;
|
|
30
|
+
aiPseudoRandom: Schema<boolean, boolean>;
|
|
31
|
+
aiPseudoRandomStep: Schema<number, number>;
|
|
30
32
|
aiMinReplyIntervalSeconds: Schema<number, number>;
|
|
31
33
|
aiCooldownNotice: Schema<boolean, boolean>;
|
|
32
34
|
bannedWords: Schema<string[], string[]>;
|
|
@@ -50,6 +52,8 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
50
52
|
enableAiReply: Schema<boolean, boolean>;
|
|
51
53
|
aiMessageThreshold: Schema<number, number>;
|
|
52
54
|
aiRandomReplyProbability: Schema<number, number>;
|
|
55
|
+
aiPseudoRandom: Schema<boolean, boolean>;
|
|
56
|
+
aiPseudoRandomStep: Schema<number, number>;
|
|
53
57
|
aiMinReplyIntervalSeconds: Schema<number, number>;
|
|
54
58
|
aiCooldownNotice: Schema<boolean, boolean>;
|
|
55
59
|
bannedWords: Schema<string[], string[]>;
|
|
@@ -165,6 +169,8 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
165
169
|
aiReplyMode: Schema<"threshold" | "random" | "hybrid", "threshold" | "random" | "hybrid">;
|
|
166
170
|
aiMessageThreshold: Schema<number, number>;
|
|
167
171
|
aiRandomReplyProbability: Schema<number, number>;
|
|
172
|
+
aiPseudoRandom: Schema<boolean, boolean>;
|
|
173
|
+
aiPseudoRandomStep: Schema<number, number>;
|
|
168
174
|
aiMinReplyIntervalSeconds: Schema<number, number>;
|
|
169
175
|
aiContextWindow: Schema<number, number>;
|
|
170
176
|
aiContextMaxChars: Schema<number, number>;
|
|
@@ -237,6 +243,8 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
237
243
|
enableAiReply: Schema<boolean, boolean>;
|
|
238
244
|
aiMessageThreshold: Schema<number, number>;
|
|
239
245
|
aiRandomReplyProbability: Schema<number, number>;
|
|
246
|
+
aiPseudoRandom: Schema<boolean, boolean>;
|
|
247
|
+
aiPseudoRandomStep: Schema<number, number>;
|
|
240
248
|
aiMinReplyIntervalSeconds: Schema<number, number>;
|
|
241
249
|
aiCooldownNotice: Schema<boolean, boolean>;
|
|
242
250
|
bannedWords: Schema<string[], string[]>;
|
|
@@ -339,6 +347,8 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
339
347
|
aiReplyMode: "threshold" | "random" | "hybrid";
|
|
340
348
|
aiMessageThreshold: number;
|
|
341
349
|
aiRandomReplyProbability: number;
|
|
350
|
+
aiPseudoRandom: boolean;
|
|
351
|
+
aiPseudoRandomStep: number;
|
|
342
352
|
aiMinReplyIntervalSeconds: number;
|
|
343
353
|
aiContextWindow: number;
|
|
344
354
|
aiContextMaxChars: number;
|
package/lib/index.js
CHANGED
|
@@ -37,6 +37,8 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
37
37
|
enableAiReply: koishi_1.Schema.boolean().description('该群是否启用 AI 回复(留空则跟随全局设置)。'),
|
|
38
38
|
aiMessageThreshold: koishi_1.Schema.natural().description('该群触发的消息数阈值(留空跟随全局 aiMessageThreshold)。'),
|
|
39
39
|
aiRandomReplyProbability: koishi_1.Schema.percent().description('该群随机触发概率(0~1,控制台按百分比显示;留空跟随全局)。'),
|
|
40
|
+
aiPseudoRandom: koishi_1.Schema.boolean().description('该群是否启用伪随机(连续未命中逐步提高概率;留空跟随全局)。'),
|
|
41
|
+
aiPseudoRandomStep: koishi_1.Schema.number().min(0).max(1).step(0.001).description('该群伪随机每次未命中增加的概率(留空跟随全局)。'),
|
|
40
42
|
aiMinReplyIntervalSeconds: koishi_1.Schema.natural().description('该群模型调用冷却(秒;留空跟随全局 aiMinReplyIntervalSeconds)。'),
|
|
41
43
|
aiCooldownNotice: koishi_1.Schema.boolean().description('该群被 @ 但处于冷却时是否提示还剩多久(留空跟随全局)。'),
|
|
42
44
|
bannedWords: koishi_1.Schema.array(String).role('table').default([]).description('该群专属违禁词列表(同样支持“关键词|分值”与顺序模糊匹配)。'),
|
|
@@ -153,6 +155,8 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
153
155
|
]).role('radio').default('hybrid').description('AI 触发策略:threshold 只看消息数、random 只看概率、hybrid 两者都要满足。@点名与点名后跟随会越过这些闸门。是否真正接话由模型在回复时用 <pass/> 自行决定。'),
|
|
154
156
|
aiMessageThreshold: koishi_1.Schema.natural().default(16).description('阈值触发所需累计消息数。threshold / hybrid 模式下未达此数一律不触发;计数器在模型给出回复或主动放弃后清零。'),
|
|
155
157
|
aiRandomReplyProbability: koishi_1.Schema.percent().default(0.08).description('随机触发概率(每条消息掷一次骰)。random / hybrid 模式下未掷中直接跳过,不会调用 AI 接口。填 0 等同于关闭随机触发。'),
|
|
158
|
+
aiPseudoRandom: koishi_1.Schema.boolean().default(true).description('伪随机:随机触发没命中时,下一次概率按步长累加(命中后归零),加到 1 时必定回复,避免真随机长期不触发。'),
|
|
159
|
+
aiPseudoRandomStep: koishi_1.Schema.number().min(0).max(1).step(0.001).default(0.01).description('伪随机每次未命中增加的概率(默认 0.01 = 1%)。只在真正掷骰且未命中时累加,冷却/阈值跳过不算。'),
|
|
156
160
|
aiMinReplyIntervalSeconds: koishi_1.Schema.natural().default(45).description('同一群两次真正调用模型的最短间隔(秒)。'),
|
|
157
161
|
aiContextWindow: koishi_1.Schema.natural().default(30).description('参与推理的最近消息条数(建议 20~40;太小会导致模型看不到前文)。'),
|
|
158
162
|
aiContextMaxChars: koishi_1.Schema.natural().min(0).max(20000).default(0).description('历史上下文的字数上限:超过后从最旧的消息开始丢(至少保留最近 4 条)。0 = 不限。想省 token 可设 2500~3500。'),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestim/koishi-plugin-qq-group-manager",
|
|
3
3
|
"description": "Koishi QQ群管理插件(OneBot/LLOneBot):群管命令、权限校验、图片菜单、状态卡片、复读、AI群聊回复、记忆库、识图与自动管控(禁言/踢人)。",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.8",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
package/src/ai/engine.ts
CHANGED
|
@@ -851,7 +851,12 @@ export class AiEngine {
|
|
|
851
851
|
mention,
|
|
852
852
|
followup,
|
|
853
853
|
rng: this.rng,
|
|
854
|
+
pseudoRandom: this.setting(session, 'aiPseudoRandom') !== false,
|
|
855
|
+
randomBoost: state.randomBoost,
|
|
856
|
+
pseudoRandomStep: Math.max(0, Number(this.setting(session, 'aiPseudoRandomStep') ?? 0.01)),
|
|
854
857
|
});
|
|
858
|
+
// 伪随机加成只由「随机掷骰」更新:冷却/阈值跳过时保持不变
|
|
859
|
+
if (typeof decision.nextBoost === 'number') state.randomBoost = decision.nextBoost;
|
|
855
860
|
|
|
856
861
|
this.log('ai-trigger', {
|
|
857
862
|
fire: decision.fire,
|
|
@@ -860,6 +865,8 @@ export class AiEngine {
|
|
|
860
865
|
threshold,
|
|
861
866
|
mention,
|
|
862
867
|
followup,
|
|
868
|
+
prob: decision.effectiveProbability,
|
|
869
|
+
boost: state.randomBoost,
|
|
863
870
|
ctx: state.records.length,
|
|
864
871
|
}, session);
|
|
865
872
|
if (!decision.fire) {
|
package/src/ai/state.ts
CHANGED
|
@@ -45,6 +45,8 @@ export class GroupState {
|
|
|
45
45
|
lastAttemptAt = 0;
|
|
46
46
|
/** 上次发「冷却中」提示的时间,用于避免 @ 刷屏时反复提示 */
|
|
47
47
|
lastCooldownNoticeAt = 0;
|
|
48
|
+
/** 伪随机加成:随机未命中时累加,命中后归零 */
|
|
49
|
+
randomBoost = 0;
|
|
48
50
|
inFlight = false;
|
|
49
51
|
followup: FollowupState | null = null;
|
|
50
52
|
seen = new Map<string, number>();
|
package/src/ai/trigger.ts
CHANGED
|
@@ -24,6 +24,12 @@ export interface TriggerInput {
|
|
|
24
24
|
mention: boolean;
|
|
25
25
|
followup: boolean;
|
|
26
26
|
rng: () => number;
|
|
27
|
+
/** 伪随机:随机未命中时把下一次概率往上抬,直到必定触发 */
|
|
28
|
+
pseudoRandom?: boolean;
|
|
29
|
+
/** 当前已累计的概率加成(0~1) */
|
|
30
|
+
randomBoost?: number;
|
|
31
|
+
/** 每次未命中增加多少(默认 0.01) */
|
|
32
|
+
pseudoRandomStep?: number;
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
export interface TriggerDecision {
|
|
@@ -32,6 +38,10 @@ export interface TriggerDecision {
|
|
|
32
38
|
reason: string;
|
|
33
39
|
/** 冷却中时距离可以再次调用模型的剩余毫秒数 */
|
|
34
40
|
remainingMs?: number;
|
|
41
|
+
/** 本次判定后应保存的伪随机加成;未发生随机掷骰时为 undefined(保持不变) */
|
|
42
|
+
nextBoost?: number;
|
|
43
|
+
/** 本次实际使用的概率(基础值 + 加成),用于日志排查 */
|
|
44
|
+
effectiveProbability?: number;
|
|
35
45
|
}
|
|
36
46
|
|
|
37
47
|
export function decideTrigger(input: TriggerInput): TriggerDecision {
|
|
@@ -66,14 +76,44 @@ export function decideTrigger(input: TriggerInput): TriggerDecision {
|
|
|
66
76
|
};
|
|
67
77
|
}
|
|
68
78
|
|
|
69
|
-
// ---------- 4)
|
|
79
|
+
// ---------- 4) 概率(支持伪随机:连续未命中会逐步抬高概率) ----------
|
|
70
80
|
const needRandom = input.mode === 'random' || input.mode === 'hybrid';
|
|
71
81
|
if (needRandom) {
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
const base = Math.max(0, Math.min(1, Number(input.probability) || 0));
|
|
83
|
+
const boost = Math.max(0, Number(input.randomBoost) || 0);
|
|
84
|
+
const effective = Math.min(1, base + boost);
|
|
85
|
+
const round4 = (value: number) => Math.round(value * 10000) / 10000;
|
|
86
|
+
|
|
87
|
+
if (effective <= 0) {
|
|
88
|
+
return {
|
|
89
|
+
fire: false,
|
|
90
|
+
forced: false,
|
|
91
|
+
reason: 'random-disabled',
|
|
92
|
+
nextBoost: round4(boost),
|
|
93
|
+
effectiveProbability: 0,
|
|
94
|
+
};
|
|
76
95
|
}
|
|
96
|
+
|
|
97
|
+
// 加成到 1 时必定触发,不再消耗随机数
|
|
98
|
+
if (effective >= 1 || input.rng() < effective) {
|
|
99
|
+
return {
|
|
100
|
+
fire: true,
|
|
101
|
+
forced: false,
|
|
102
|
+
reason: `trigger(${input.mode})`,
|
|
103
|
+
nextBoost: 0,
|
|
104
|
+
effectiveProbability: round4(effective),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const step = Math.max(0, Number(input.pseudoRandomStep) || 0);
|
|
109
|
+
const nextBoost = input.pseudoRandom ? Math.min(1, round4(boost + step)) : round4(boost);
|
|
110
|
+
return {
|
|
111
|
+
fire: false,
|
|
112
|
+
forced: false,
|
|
113
|
+
reason: `random-miss(${effective.toFixed(2)})`,
|
|
114
|
+
nextBoost,
|
|
115
|
+
effectiveProbability: round4(effective),
|
|
116
|
+
};
|
|
77
117
|
}
|
|
78
118
|
|
|
79
119
|
return { fire: true, forced: false, reason: `trigger(${input.mode})` };
|
package/src/index.ts
CHANGED
|
@@ -34,6 +34,8 @@ export const Config = Schema.intersect([
|
|
|
34
34
|
enableAiReply: Schema.boolean().description('该群是否启用 AI 回复(留空则跟随全局设置)。'),
|
|
35
35
|
aiMessageThreshold: Schema.natural().description('该群触发的消息数阈值(留空跟随全局 aiMessageThreshold)。'),
|
|
36
36
|
aiRandomReplyProbability: Schema.percent().description('该群随机触发概率(0~1,控制台按百分比显示;留空跟随全局)。'),
|
|
37
|
+
aiPseudoRandom: Schema.boolean().description('该群是否启用伪随机(连续未命中逐步提高概率;留空跟随全局)。'),
|
|
38
|
+
aiPseudoRandomStep: Schema.number().min(0).max(1).step(0.001).description('该群伪随机每次未命中增加的概率(留空跟随全局)。'),
|
|
37
39
|
aiMinReplyIntervalSeconds: Schema.natural().description('该群模型调用冷却(秒;留空跟随全局 aiMinReplyIntervalSeconds)。'),
|
|
38
40
|
aiCooldownNotice: Schema.boolean().description('该群被 @ 但处于冷却时是否提示还剩多久(留空跟随全局)。'),
|
|
39
41
|
bannedWords: Schema.array(String).role('table').default([]).description('该群专属违禁词列表(同样支持“关键词|分值”与顺序模糊匹配)。'),
|
|
@@ -150,6 +152,8 @@ export const Config = Schema.intersect([
|
|
|
150
152
|
]).role('radio').default('hybrid').description('AI 触发策略:threshold 只看消息数、random 只看概率、hybrid 两者都要满足。@点名与点名后跟随会越过这些闸门。是否真正接话由模型在回复时用 <pass/> 自行决定。'),
|
|
151
153
|
aiMessageThreshold: Schema.natural().default(16).description('阈值触发所需累计消息数。threshold / hybrid 模式下未达此数一律不触发;计数器在模型给出回复或主动放弃后清零。'),
|
|
152
154
|
aiRandomReplyProbability: Schema.percent().default(0.08).description('随机触发概率(每条消息掷一次骰)。random / hybrid 模式下未掷中直接跳过,不会调用 AI 接口。填 0 等同于关闭随机触发。'),
|
|
155
|
+
aiPseudoRandom: Schema.boolean().default(true).description('伪随机:随机触发没命中时,下一次概率按步长累加(命中后归零),加到 1 时必定回复,避免真随机长期不触发。'),
|
|
156
|
+
aiPseudoRandomStep: Schema.number().min(0).max(1).step(0.001).default(0.01).description('伪随机每次未命中增加的概率(默认 0.01 = 1%)。只在真正掷骰且未命中时累加,冷却/阈值跳过不算。'),
|
|
153
157
|
aiMinReplyIntervalSeconds: Schema.natural().default(45).description('同一群两次真正调用模型的最短间隔(秒)。'),
|
|
154
158
|
aiContextWindow: Schema.natural().default(30).description('参与推理的最近消息条数(建议 20~40;太小会导致模型看不到前文)。'),
|
|
155
159
|
aiContextMaxChars: Schema.natural().min(0).max(20000).default(0).description('历史上下文的字数上限:超过后从最旧的消息开始丢(至少保留最近 4 条)。0 = 不限。想省 token 可设 2500~3500。'),
|