@nestim/koishi-plugin-qq-group-manager 1.4.8 → 1.4.10
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 +57 -0
- package/lib/ai/engine.d.ts +24 -4
- package/lib/ai/engine.js +248 -35
- package/lib/ai/learn.d.ts +8 -0
- package/lib/ai/learn.js +15 -0
- package/lib/ai/prompt.d.ts +0 -5
- package/lib/ai/prompt.js +0 -13
- package/lib/ai/provider.d.ts +2 -0
- package/lib/ai/provider.js +14 -2
- package/lib/ai/state.d.ts +4 -1
- package/lib/ai/state.js +8 -1
- package/lib/ai/trigger.d.ts +0 -3
- package/lib/index.d.ts +2 -24
- package/lib/index.js +2 -19
- package/lib/service.js +2 -1
- package/package.json +1 -1
- package/readme.md +20 -11
- package/src/ai/engine.ts +232 -36
- package/src/ai/learn.ts +16 -0
- package/src/ai/prompt.ts +0 -16
- package/src/ai/provider.ts +16 -2
- package/src/ai/state.ts +10 -1
- package/src/ai/trigger.ts +0 -3
- package/src/index.ts +2 -19
- package/src/service.js +2 -1
package/lib/ai/state.js
CHANGED
|
@@ -13,7 +13,6 @@ class GroupState {
|
|
|
13
13
|
records = [];
|
|
14
14
|
/** 自上次"完整考虑"(真正调用了模型)以来累计的消息数 */
|
|
15
15
|
counter = 0;
|
|
16
|
-
lastReplyAt = 0;
|
|
17
16
|
lastAttemptAt = 0;
|
|
18
17
|
/** 上次发「冷却中」提示的时间,用于避免 @ 刷屏时反复提示 */
|
|
19
18
|
lastCooldownNoticeAt = 0;
|
|
@@ -62,6 +61,14 @@ class AiState {
|
|
|
62
61
|
peek(key) {
|
|
63
62
|
return this.groups.get(key);
|
|
64
63
|
}
|
|
64
|
+
/** 持久化用:遍历所有会话状态 */
|
|
65
|
+
entries() {
|
|
66
|
+
return [...this.groups.entries()];
|
|
67
|
+
}
|
|
68
|
+
/** 持久化用:恢复一个会话状态 */
|
|
69
|
+
set(key, state) {
|
|
70
|
+
this.groups.set(key, state);
|
|
71
|
+
}
|
|
65
72
|
clear() {
|
|
66
73
|
this.groups.clear();
|
|
67
74
|
}
|
package/lib/ai/trigger.d.ts
CHANGED
|
@@ -16,9 +16,6 @@ export interface TriggerInput {
|
|
|
16
16
|
now: number;
|
|
17
17
|
lastAttemptAt: number;
|
|
18
18
|
minIntervalMs: number;
|
|
19
|
-
/** 兼容字段:旧版按“上次回复”计算的 @ 冷却,已合并进 minIntervalMs */
|
|
20
|
-
lastReplyAt?: number;
|
|
21
|
-
mentionCooldownMs?: number;
|
|
22
19
|
inFlight: boolean;
|
|
23
20
|
mention: boolean;
|
|
24
21
|
followup: boolean;
|
package/lib/index.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
12
12
|
cmdCustom: Schema<string, string>;
|
|
13
13
|
cmdVersion: Schema<string, string>;
|
|
14
14
|
platformFilter: Schema<string[], string[]>;
|
|
15
|
-
responseStyle: Schema<"plain" | "meow", "plain" | "meow">;
|
|
16
15
|
dryRun: Schema<boolean, boolean>;
|
|
17
16
|
}> | Schemastery.ObjectS<{
|
|
18
17
|
bannedWords: Schema<string[], string[]>;
|
|
@@ -147,7 +146,6 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
147
146
|
aiBaseUrl: Schema<string, string>;
|
|
148
147
|
aiModel: Schema<string, string>;
|
|
149
148
|
aiAgentName: Schema<string, string>;
|
|
150
|
-
aiMentionCooldownSeconds: Schema<number, number>;
|
|
151
149
|
aiCooldownNotice: Schema<boolean, boolean>;
|
|
152
150
|
aiCooldownNoticeText: Schema<string, string>;
|
|
153
151
|
aiCooldownNoticeIntervalSeconds: Schema<number, number>;
|
|
@@ -173,6 +171,7 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
173
171
|
aiPseudoRandomStep: Schema<number, number>;
|
|
174
172
|
aiMinReplyIntervalSeconds: Schema<number, number>;
|
|
175
173
|
aiContextWindow: Schema<number, number>;
|
|
174
|
+
persistAiState: Schema<boolean, boolean>;
|
|
176
175
|
aiContextMaxChars: Schema<number, number>;
|
|
177
176
|
aiStyleMaxChars: Schema<number, number>;
|
|
178
177
|
aiTemperature: Schema<number, number>;
|
|
@@ -182,7 +181,6 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
182
181
|
aiQuoteReplyProbability: Schema<number, number>;
|
|
183
182
|
aiReadForwardMessage: Schema<boolean, boolean>;
|
|
184
183
|
aiForwardMaxNodes: Schema<number, number>;
|
|
185
|
-
aiReplyDecision: Schema<"two-stage" | "single", "two-stage" | "single">;
|
|
186
184
|
aiEnableImageRecognition: Schema<boolean, boolean>;
|
|
187
185
|
aiImageMaxCount: Schema<number, number>;
|
|
188
186
|
aiImageBudgetMs: Schema<number, number>;
|
|
@@ -194,19 +192,10 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
194
192
|
aiWebSearchCacheMinutes: Schema<number, number>;
|
|
195
193
|
aiRequestTimeoutSeconds: Schema<number, number>;
|
|
196
194
|
aiDebugPrompt: Schema<boolean, boolean>;
|
|
197
|
-
aiIgnoreCommandMessage: Schema<boolean, boolean>;
|
|
198
195
|
aiEnableDirectMentionTrigger: Schema<boolean, boolean>;
|
|
199
196
|
aiEnableFollowupAfterMention: Schema<boolean, boolean>;
|
|
200
197
|
aiFollowupWindowSeconds: Schema<number, number>;
|
|
201
198
|
aiFollowupMaxTurns: Schema<number, number>;
|
|
202
|
-
aiOwnerPlatform: Schema<string, string>;
|
|
203
|
-
aiOwnerUserId: Schema<string, string>;
|
|
204
|
-
aiHomePlatform: Schema<string, string>;
|
|
205
|
-
aiHomeUserId: Schema<string, string>;
|
|
206
|
-
aiInterestMinScore: Schema<number, number>;
|
|
207
|
-
aiInterestContextWindow: Schema<number, number>;
|
|
208
|
-
aiInterestModel: Schema<string, string>;
|
|
209
|
-
aiInterestMaxTokens: Schema<number, number>;
|
|
210
199
|
}> | Schemastery.ObjectS<{
|
|
211
200
|
allowedUserIds: Schema<string[], string[]>;
|
|
212
201
|
allowGroupOwner: Schema<boolean, boolean>;
|
|
@@ -228,7 +217,6 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
228
217
|
cmdCustom: string;
|
|
229
218
|
cmdVersion: string;
|
|
230
219
|
platformFilter: string[];
|
|
231
|
-
responseStyle: "plain" | "meow";
|
|
232
220
|
dryRun: boolean;
|
|
233
221
|
} & import("koishi").Dict & {
|
|
234
222
|
bannedWords: string[];
|
|
@@ -329,7 +317,6 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
329
317
|
aiBaseUrl: string;
|
|
330
318
|
aiModel: string;
|
|
331
319
|
aiAgentName: string;
|
|
332
|
-
aiMentionCooldownSeconds: number;
|
|
333
320
|
aiCooldownNotice: boolean;
|
|
334
321
|
aiCooldownNoticeText: string;
|
|
335
322
|
aiCooldownNoticeIntervalSeconds: number;
|
|
@@ -351,6 +338,7 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
351
338
|
aiPseudoRandomStep: number;
|
|
352
339
|
aiMinReplyIntervalSeconds: number;
|
|
353
340
|
aiContextWindow: number;
|
|
341
|
+
persistAiState: boolean;
|
|
354
342
|
aiContextMaxChars: number;
|
|
355
343
|
aiStyleMaxChars: number;
|
|
356
344
|
aiTemperature: number;
|
|
@@ -360,7 +348,6 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
360
348
|
aiQuoteReplyProbability: number;
|
|
361
349
|
aiReadForwardMessage: boolean;
|
|
362
350
|
aiForwardMaxNodes: number;
|
|
363
|
-
aiReplyDecision: "two-stage" | "single";
|
|
364
351
|
aiEnableImageRecognition: boolean;
|
|
365
352
|
aiImageMaxCount: number;
|
|
366
353
|
aiImageBudgetMs: number;
|
|
@@ -372,19 +359,10 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
372
359
|
aiWebSearchCacheMinutes: number;
|
|
373
360
|
aiRequestTimeoutSeconds: number;
|
|
374
361
|
aiDebugPrompt: boolean;
|
|
375
|
-
aiIgnoreCommandMessage: boolean;
|
|
376
362
|
aiEnableDirectMentionTrigger: boolean;
|
|
377
363
|
aiEnableFollowupAfterMention: boolean;
|
|
378
364
|
aiFollowupWindowSeconds: number;
|
|
379
365
|
aiFollowupMaxTurns: number;
|
|
380
|
-
aiOwnerPlatform: string;
|
|
381
|
-
aiOwnerUserId: string;
|
|
382
|
-
aiHomePlatform: string;
|
|
383
|
-
aiHomeUserId: string;
|
|
384
|
-
aiInterestMinScore: number;
|
|
385
|
-
aiInterestContextWindow: number;
|
|
386
|
-
aiInterestModel: string;
|
|
387
|
-
aiInterestMaxTokens: number;
|
|
388
366
|
} & {
|
|
389
367
|
allowedUserIds: string[];
|
|
390
368
|
allowGroupOwner: boolean;
|
package/lib/index.js
CHANGED
|
@@ -18,10 +18,6 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
18
18
|
cmdCustom: koishi_1.Schema.string().default('[custom]').description('自定义指令集前缀,用法:[custom]。未配置自定义指令时提示「目前还没有指令」。'),
|
|
19
19
|
cmdVersion: koishi_1.Schema.string().default('[Version]').description('插件信息指令前缀,用法:[Version]。返回当前版本、作者、GitHub 与 npm 地址。'),
|
|
20
20
|
platformFilter: koishi_1.Schema.array(String).default(['onebot']).description('允许启用管理功能的平台列表。'),
|
|
21
|
-
responseStyle: koishi_1.Schema.union([
|
|
22
|
-
koishi_1.Schema.const('plain').description('普通输出'),
|
|
23
|
-
koishi_1.Schema.const('meow').description('Meow 风格输出'),
|
|
24
|
-
]).role('radio').default('plain').description('群聊中指令返回的文本风格。'),
|
|
25
21
|
dryRun: koishi_1.Schema.boolean().default(false).description('演练模式:仅输出计划动作,不执行群管理操作。'),
|
|
26
22
|
}).description('基础设置'),
|
|
27
23
|
koishi_1.Schema.object({
|
|
@@ -133,7 +129,6 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
133
129
|
aiBaseUrl: koishi_1.Schema.string().default('https://api.openai.com/v1').description('接口基础地址(OpenAI 兼容模式需以 /v1 结尾;Gemini 模式可留默认)。'),
|
|
134
130
|
aiModel: koishi_1.Schema.string().default('gpt-4o-mini').description('模型名称,如 gpt-4o-mini / doubao-1.5-lite / gemini-2.0-flash。'),
|
|
135
131
|
aiAgentName: koishi_1.Schema.string().default('bot').description('默认智能体自称(可在配置页修改)。'),
|
|
136
|
-
aiMentionCooldownSeconds: koishi_1.Schema.natural().min(0).max(3600).default(5).description('(兼容字段)旧的 @ 冷却;现在所有模型调用统一走 aiMinReplyIntervalSeconds。'),
|
|
137
132
|
aiCooldownNotice: koishi_1.Schema.boolean().default(true).description('被 @ 但处于模型调用冷却时,是否在群里提示还剩多久(纯本地消息,不调用模型)。'),
|
|
138
133
|
aiCooldownNoticeText: koishi_1.Schema.string().default('还在冷却,{seconds} 秒后再叫我。').description('冷却提示文案,可用 {seconds} 与 {minutes} 占位。'),
|
|
139
134
|
aiCooldownNoticeIntervalSeconds: koishi_1.Schema.natural().min(0).max(600).default(20).description('同一群两次冷却提示的最小间隔(秒),防止连续 @ 刷屏;0 = 不限制。'),
|
|
@@ -159,10 +154,11 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
159
154
|
aiPseudoRandomStep: koishi_1.Schema.number().min(0).max(1).step(0.001).default(0.01).description('伪随机每次未命中增加的概率(默认 0.01 = 1%)。只在真正掷骰且未命中时累加,冷却/阈值跳过不算。'),
|
|
160
155
|
aiMinReplyIntervalSeconds: koishi_1.Schema.natural().default(45).description('同一群两次真正调用模型的最短间隔(秒)。'),
|
|
161
156
|
aiContextWindow: koishi_1.Schema.natural().default(30).description('参与推理的最近消息条数(建议 20~40;太小会导致模型看不到前文)。'),
|
|
157
|
+
persistAiState: koishi_1.Schema.boolean().default(true).description('重启插件后恢复最近上下文、未归纳的消息桶、计数与冷却(保存到 data/qqgm-ai-state.json,只存文本、不存图片)。关闭则每次重启都从头开始。'),
|
|
162
158
|
aiContextMaxChars: koishi_1.Schema.natural().min(0).max(20000).default(0).description('历史上下文的字数上限:超过后从最旧的消息开始丢(至少保留最近 4 条)。0 = 不限。想省 token 可设 2500~3500。'),
|
|
163
159
|
aiStyleMaxChars: koishi_1.Schema.natural().min(0).max(20000).default(0).description('外部插件注入的「说话风格」段每条最多保留多少字。0 = 不限。风格 skill 很长时可设 1200~1800 显著省 token。'),
|
|
164
160
|
aiTemperature: koishi_1.Schema.number().min(0).max(2).step(0.1).default(0.8).description('生成温度(0~2)。群聊接话建议 0.7~0.9,过高会跑题、复述、发散。'),
|
|
165
|
-
aiMaxOutputTokens: koishi_1.Schema.natural().default(
|
|
161
|
+
aiMaxOutputTokens: koishi_1.Schema.natural().min(100).max(131072).default(1500).description('思考 + 回答的总 token 上限(API 的 max_tokens,不是只限制正文)。思考模式开启时思维链也计入这里:设得太小,预算会被思考吃掉、正文被截断;设得太大则单次成本上限更高。群聊接话建议 1000~2000。'),
|
|
166
162
|
aiMaxReplyChars: koishi_1.Schema.natural().min(20).max(500).default(120).description('单条回复的最大字符数,超出会在句末截断。'),
|
|
167
163
|
aiQuoteReplyMode: koishi_1.Schema.union([
|
|
168
164
|
koishi_1.Schema.const('random').description('随机决定'),
|
|
@@ -172,10 +168,6 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
172
168
|
aiQuoteReplyProbability: koishi_1.Schema.number().min(0).max(1).step(0.05).default(0.5).hidden().description('引用概率(仅 random 模式生效)。'),
|
|
173
169
|
aiReadForwardMessage: koishi_1.Schema.boolean().default(true).description('读取合并转发聊天记录的内容,作为上下文的一部分。'),
|
|
174
170
|
aiForwardMaxNodes: koishi_1.Schema.natural().min(1).max(50).default(20).description('单条合并转发最多读取多少条子消息。'),
|
|
175
|
-
aiReplyDecision: koishi_1.Schema.union([
|
|
176
|
-
koishi_1.Schema.const('single').description('一次调用:模型直接输出回复,或用 <pass/> 放弃(推荐)'),
|
|
177
|
-
koishi_1.Schema.const('two-stage').description('两次调用:先判定是否值得回复,再生成正文'),
|
|
178
|
-
]).role('radio').default('single').description('接话决策方式。single 更快、决策与正文一致;two-stage 更省生成成本但多一次延迟。'),
|
|
179
171
|
aiEnableImageRecognition: koishi_1.Schema.boolean().default(true).description('是否启用图片识别(支持时将图片一并发送给模型;不支持的模型会自动降级为纯文本)。'),
|
|
180
172
|
aiImageMaxCount: koishi_1.Schema.natural().default(2).description('每次最多发送给模型的图片数量。'),
|
|
181
173
|
aiImageBudgetMs: koishi_1.Schema.natural().min(500).max(20000).default(6000).description('图片下载/转换的总时间预算(毫秒)。超时直接跳过图片,避免拖慢回复。'),
|
|
@@ -191,19 +183,10 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
191
183
|
aiWebSearchCacheMinutes: koishi_1.Schema.natural().min(0).max(1440).default(10).description('相同 query 的结果缓存分钟数;0=不缓存。'),
|
|
192
184
|
aiRequestTimeoutSeconds: koishi_1.Schema.natural().min(5).max(120).default(20).description('单次模型请求超时(秒)。'),
|
|
193
185
|
aiDebugPrompt: koishi_1.Schema.boolean().default(false).description('调试:把最终系统提示词与用户提示词写入日志(排查"答非所问"时打开,平时关闭)。'),
|
|
194
|
-
aiIgnoreCommandMessage: koishi_1.Schema.boolean().default(true).description('忽略看起来像命令的消息,避免干扰正常指令执行。'),
|
|
195
186
|
aiEnableDirectMentionTrigger: koishi_1.Schema.boolean().default(true).description('消息命中智能体名字时是否忽略阈值直接触发回复。'),
|
|
196
187
|
aiEnableFollowupAfterMention: koishi_1.Schema.boolean().default(true).description('点名触发后,是否跟随该用户一段时间继续对话。'),
|
|
197
188
|
aiFollowupWindowSeconds: koishi_1.Schema.natural().default(120).description('点名后跟随该用户的持续时间(秒)。'),
|
|
198
189
|
aiFollowupMaxTurns: koishi_1.Schema.natural().default(3).description('一次点名会话最多继续回复轮数。'),
|
|
199
|
-
aiOwnerPlatform: koishi_1.Schema.string().default('onebot').description('主人平台标识(用于识别主人用户,如 onebot)。'),
|
|
200
|
-
aiOwnerUserId: koishi_1.Schema.string().default('').description('主人平台用户 ID(如 QQ 号,用于记忆主人身份)。'),
|
|
201
|
-
aiHomePlatform: koishi_1.Schema.string().default('onebot').description('兼容字段:主页平台标识(建议改用 aiOwnerPlatform)。'),
|
|
202
|
-
aiHomeUserId: koishi_1.Schema.string().default('').description('兼容字段:主页平台用户 ID(建议改用 aiOwnerUserId)。'),
|
|
203
|
-
aiInterestMinScore: koishi_1.Schema.number().min(0).max(100).step(1).default(82).description('(仅 aiReplyDecision=two-stage 时生效)判定为值得回复的最低分。'),
|
|
204
|
-
aiInterestContextWindow: koishi_1.Schema.number().min(4).max(16).step(1).default(8).description('(仅 two-stage 生效)判定使用的上下文窗口条数。'),
|
|
205
|
-
aiInterestModel: koishi_1.Schema.string().default('').description('(仅 two-stage 生效)判定专用模型(留空沿用 aiModel)。'),
|
|
206
|
-
aiInterestMaxTokens: koishi_1.Schema.natural().min(256).max(16384).default(2048).description('(仅 two-stage 生效)判定的最大输出 token。'),
|
|
207
190
|
}).description('AI 回复'),
|
|
208
191
|
koishi_1.Schema.object({
|
|
209
192
|
allowedUserIds: koishi_1.Schema.array(String).role('table').default([]).description('允许直接使用群管理命令的账号 ID 白名单。命中即通过,不再校验群内角色。'),
|
package/lib/service.js
CHANGED
|
@@ -599,7 +599,8 @@ class QQGroupManagerService extends koishi_1.Service {
|
|
|
599
599
|
return `platform=${session.platform ?? 'unknown'} user=${session.userId ?? 'unknown'} guild=${session.guildId ?? 'private'}`;
|
|
600
600
|
}
|
|
601
601
|
styleText(text) {
|
|
602
|
-
|
|
602
|
+
// 旧的「Meow 风格」已移除:想要喵味请在 qqgm-chat-style 里加一个风格 skill。
|
|
603
|
+
return text;
|
|
603
604
|
}
|
|
604
605
|
getMessageText(session) {
|
|
605
606
|
const raw = session?.content ?? '';
|
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.10",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
package/readme.md
CHANGED
|
@@ -92,22 +92,30 @@ npm i @nestim/koishi-plugin-qq-group-manager
|
|
|
92
92
|
| `bannedWordScoreThreshold` | `70` | 违禁词评分触发阈值(强关键词共用) |
|
|
93
93
|
| `strongKeywords` | `[]` | 强关键词;命中即触发且**无视白名单豁免**,支持 `关键词\|分值` |
|
|
94
94
|
| `groupRules` | `[]` | 按群覆盖策略(违禁词、强关键词、白名单关键词、AI 开关、自动处罚阈值等) |
|
|
95
|
-
| `memoryFileName` | `Memory.md` | 记忆库基础文件名;分作用域时作为前缀 |
|
|
96
|
-
| `memoryPerScope` | `true` | 按私聊/群聊分开存:`Memory_<群号>_群聊.md` / `Memory_<QQ号>_私聊.md` |
|
|
97
|
-
| `memoryAutoLearn` | `false` | **AI 自动归纳记忆**(内建):上下文挤满后把消息总结成记忆并回推 |
|
|
98
|
-
| `memoryLearnIdleHours` | `8` | 空闲兜底小时数;期间没有新消息则不触发 |
|
|
99
|
-
| `memoryLearnThresholdScale` | `1` | 归纳阈值 = `aiContextWindow × 该值` |
|
|
100
|
-
| `memoryLearnMaxChars` | `150` | 单条自动记忆字数上限 |
|
|
101
|
-
| `memoryLearnPushBack` | `true` | 归纳后回推原会话(私聊发私聊、群聊发对应群) |
|
|
102
|
-
| `memoryLearnDuplicateThreshold` | `0.55` | 相似度超此值跳过,避免重复记 |
|
|
95
|
+
| `memoryFileName` | `Memory.md` | 记忆库基础文件名;分作用域时作为前缀 |
|
|
96
|
+
| `memoryPerScope` | `true` | 按私聊/群聊分开存:`Memory_<群号>_群聊.md` / `Memory_<QQ号>_私聊.md` |
|
|
97
|
+
| `memoryAutoLearn` | `false` | **AI 自动归纳记忆**(内建):上下文挤满后把消息总结成记忆并回推 |
|
|
98
|
+
| `memoryLearnIdleHours` | `8` | 空闲兜底小时数;期间没有新消息则不触发 |
|
|
99
|
+
| `memoryLearnThresholdScale` | `1` | 归纳阈值 = `aiContextWindow × 该值` |
|
|
100
|
+
| `memoryLearnMaxChars` | `150` | 单条自动记忆字数上限 |
|
|
101
|
+
| `memoryLearnPushBack` | `true` | 归纳后回推原会话(私聊发私聊、群聊发对应群) |
|
|
102
|
+
| `memoryLearnDuplicateThreshold` | `0.55` | 相似度超此值跳过,避免重复记 |
|
|
103
103
|
| `memoryLearnDailyLimit` | `30` | 每作用域每天最多归纳次数 |
|
|
104
|
+
| `memoryLearnConsolidate` | `true` | 自动记忆压缩:每 N 条合并成 1 条 |
|
|
105
|
+
| `memoryLearnConsolidateEvery` | `5` | 每多少条自动记忆压缩一次 |
|
|
106
|
+
| `memoryLearnMaxEntries` | `15` | 自动记忆条数上限(不含手动 `[memory]`) |
|
|
107
|
+
| `memoryLearnConsolidateMaxChars` | `90` | 压缩后单条记忆字数上限 |
|
|
108
|
+
| `memoryLearnModel` | 空 | 归纳/压缩专用模型,留空沿用 `aiModel` |
|
|
104
109
|
| `blacklistFileName` | `banMember.md` | 黑名单文件名模板,实际为 `banMember_<群号>.md` |
|
|
105
110
|
| `pendingJoinFileName` | `JoinRequests.md` | 待审入群申请落盘文件名 |
|
|
106
111
|
| `enableJoinRequestReview` | `true` | 是否发起入群审核 |
|
|
107
112
|
| `enableAiReply` | `false` | AI 回复总开关(建议配合 `aiReplyRequireGroupRule` 逐群开启) |
|
|
108
113
|
| `aiReplyRequireGroupRule` | `true` | 仅对已在 `groupRules` 中单独配置的群启用 AI 回复 |
|
|
109
114
|
| `aiContextWindow` | `30` | 进入提示词的消息条数(建议 20~40) |
|
|
110
|
-
| `
|
|
115
|
+
| `persistAiState` | `true` | 重启后恢复最近上下文、未归纳消息、计数与冷却(保存到 `data/qqgm-ai-state.json`,只存文本) |
|
|
116
|
+
| `aiMaxOutputTokens` | `1500` | 思考 + 回答的总 token 上限(`max_tokens`),不是只限制正文 |
|
|
117
|
+
| `aiPseudoRandom` | `true` | 随机未命中时逐步提高概率,到 1 必定回复 |
|
|
118
|
+
| `aiPseudoRandomStep` | `0.01` | 每次未命中增加的概率 |
|
|
111
119
|
| `aiMaxReplyChars` | `120` | 单条回复最大字符数 |
|
|
112
120
|
| `aiQuoteReplyMode` | `random` | 回复是否引用触发消息:`random` / `always` / `never` |
|
|
113
121
|
| `aiQuoteReplyProbability` | `0.5` | `random` 模式下的引用概率 |
|
|
@@ -167,7 +175,7 @@ npm i @nestim/koishi-plugin-qq-group-manager
|
|
|
167
175
|
| 插件 | 作用 | 地址 |
|
|
168
176
|
| --- | --- | --- |
|
|
169
177
|
| `@nestim/koishi-plugin-qqgm-chat-style` | 聊天风格:一个主风格 + 多个按概率随机叠加的追加风格 | [npm](https://www.npmjs.com/package/@nestim/koishi-plugin-qqgm-chat-style) · [GitHub](https://github.com/Miseat/koishi-plugin-qqgm-chat-style) |
|
|
170
|
-
| `@nestim/koishi-plugin-qqgm-meme` | 表情包:AI 用 `[表情: 情绪]` 抽图,按概率补在文字后面 | [npm](https://www.npmjs.com/package/@nestim/koishi-plugin-qqgm-meme) · [GitHub](https://github.com/Miseat/koishi-plugin-qqgm-meme) |
|
|
178
|
+
| `@nestim/koishi-plugin-qqgm-meme` | 表情包:AI 用 `[表情: 情绪]` 抽图,按概率补在文字后面 | [npm](https://www.npmjs.com/package/@nestim/koishi-plugin-qqgm-meme) · [GitHub](https://github.com/Miseat/koishi-plugin-qqgm-meme) |
|
|
171
179
|
| `@nestim/koishi-plugin-qqgm-private` | 私聊:AI 自动回复 + 定时主动私发 | [npm](https://www.npmjs.com/package/@nestim/koishi-plugin-qqgm-private) · [GitHub](https://github.com/Miseat/koishi-plugin-qqgm-private) |
|
|
172
180
|
|
|
173
181
|
定时提醒(`[提醒] 明天 8 点 开会`)**内建在本插件里**,不需要额外安装。
|
|
@@ -237,10 +245,11 @@ export function apply(ctx) {
|
|
|
237
245
|
|
|
238
246
|
| 文件 | 内容 |
|
|
239
247
|
| --- | --- |
|
|
240
|
-
| `Memory_<群号>_群聊.md` | 该群的记忆,条目之间以 `---` 分隔 |
|
|
248
|
+
| `Memory_<群号>_群聊.md` | 该群的记忆,条目之间以 `---` 分隔 |
|
|
241
249
|
| `Memory_<QQ号>_私聊.md` | 与该用户的私聊记忆 |
|
|
242
250
|
| `banMember_<群号>.md` | 各群黑名单,`## QQ号 · 备注` + 加入时间 |
|
|
243
251
|
| `JoinRequests.md` | 待审入群申请(人类可读表格 + 机器可读区段),重启自动恢复、过期自动清理 |
|
|
252
|
+
| `qqgm-ai-state.json` | AI 上下文与未归纳消息的持久化快照(`persistAiState`,只存文本、不存图片) |
|
|
244
253
|
|
|
245
254
|
## 权限模型
|
|
246
255
|
|