@nestim/koishi-plugin-qq-group-manager 1.1.4 → 1.2.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/CHANGELOG.md +299 -0
- package/lib/ai/engine.d.ts +74 -0
- package/lib/ai/engine.js +525 -0
- package/lib/ai/memory.d.ts +30 -0
- package/lib/ai/memory.js +89 -0
- package/lib/ai/prompt.d.ts +36 -0
- package/lib/ai/prompt.js +125 -0
- package/lib/ai/provider.d.ts +48 -0
- package/lib/ai/provider.js +194 -0
- package/lib/ai/state.d.ts +53 -0
- package/lib/ai/state.js +62 -0
- package/lib/ai/trigger.d.ts +28 -0
- package/lib/ai/trigger.js +41 -0
- package/lib/ai/vision.d.ts +15 -0
- package/lib/ai/vision.js +64 -0
- package/lib/core/names.d.ts +48 -0
- package/lib/core/names.js +144 -0
- package/lib/core/text.d.ts +47 -0
- package/lib/core/text.js +284 -0
- package/lib/index.d.ts +263 -54
- package/lib/index.js +19 -13
- package/lib/service.d.ts +574 -153
- package/lib/service.js +56 -1221
- package/package.json +18 -6
- package/readme.md +27 -13
- package/src/ai/engine.ts +568 -0
- package/src/ai/memory.ts +104 -0
- package/src/ai/prompt.ts +142 -0
- package/src/ai/provider.ts +221 -0
- package/src/ai/state.ts +91 -0
- package/src/ai/trigger.ts +60 -0
- package/src/ai/vision.ts +81 -0
- package/src/core/names.ts +158 -0
- package/src/core/text.ts +332 -0
- package/src/index.ts +186 -0
- package/src/service.js +3327 -0
- package/tsconfig.json +24 -0
- package/lib/commands.d.ts +0 -4
- package/lib/commands.js +0 -18
- package/lib/types.d.ts +0 -23
- package/lib/types.js +0 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,37 +1,290 @@
|
|
|
1
1
|
import { Context, Schema } from 'koishi';
|
|
2
|
-
export declare const name = "qq-group-manager";
|
|
2
|
+
export declare const name = "nestim-qq-group-manager";
|
|
3
3
|
export declare const inject: {
|
|
4
4
|
optional: string[];
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export declare const Config: Schema<Schemastery.ObjectS<{
|
|
7
|
+
command: Schema<string, string>;
|
|
8
|
+
cmdMute: Schema<string, string>;
|
|
9
|
+
cmdUnmute: Schema<string, string>;
|
|
10
|
+
cmdKick: Schema<string, string>;
|
|
11
|
+
cmdMemory: Schema<string, string>;
|
|
12
|
+
cmdBan: Schema<string, string>;
|
|
13
|
+
cmdUnban: Schema<string, string>;
|
|
14
|
+
cmdBanList: Schema<string, string>;
|
|
15
|
+
cmdCustom: Schema<string, string>;
|
|
16
|
+
cmdVersion: Schema<string, string>;
|
|
17
|
+
platformFilter: Schema<string[], string[]>;
|
|
18
|
+
responseStyle: Schema<"plain" | "meow", "plain" | "meow">;
|
|
19
|
+
dryRun: Schema<boolean, boolean>;
|
|
20
|
+
}> | Schemastery.ObjectS<{
|
|
21
|
+
bannedWords: Schema<string[], string[]>;
|
|
22
|
+
bannedWordScoreThreshold: Schema<number, number>;
|
|
23
|
+
strongKeywords: Schema<string[], string[]>;
|
|
24
|
+
blockCardMessage: Schema<boolean, boolean>;
|
|
25
|
+
blockForwardMessage: Schema<boolean, boolean>;
|
|
26
|
+
autoDeleteViolation: Schema<boolean, boolean>;
|
|
27
|
+
sendViolationNotice: Schema<boolean, boolean>;
|
|
28
|
+
groupRules: Schema<Schemastery.ObjectS<{
|
|
29
|
+
guildId: Schema<string, string>;
|
|
30
|
+
enableAiReply: Schema<boolean, boolean>;
|
|
31
|
+
bannedWords: Schema<string[], string[]>;
|
|
32
|
+
whitelistKeywords: Schema<string[], string[]>;
|
|
33
|
+
strongKeywords: Schema<string[], string[]>;
|
|
34
|
+
whitelistOnlyOwners: Schema<boolean, boolean>;
|
|
35
|
+
blockCardMessage: Schema<boolean, boolean>;
|
|
36
|
+
blockForwardMessage: Schema<boolean, boolean>;
|
|
37
|
+
autoDeleteViolation: Schema<boolean, boolean>;
|
|
38
|
+
sendViolationNotice: Schema<boolean, boolean>;
|
|
39
|
+
autoMuteEnabled: Schema<boolean, boolean>;
|
|
40
|
+
autoMuteThreshold: Schema<number, number>;
|
|
41
|
+
autoMuteMinutes: Schema<number, number>;
|
|
42
|
+
autoKickEnabled: Schema<boolean, boolean>;
|
|
43
|
+
autoKickThreshold: Schema<number, number>;
|
|
44
|
+
autoViolationWindowMinutes: Schema<number, number>;
|
|
45
|
+
enableJoinRequestReview: Schema<boolean, boolean>;
|
|
46
|
+
blacklistEnabled: Schema<boolean, boolean>;
|
|
47
|
+
}>[], Schemastery.ObjectT<{
|
|
48
|
+
guildId: Schema<string, string>;
|
|
49
|
+
enableAiReply: Schema<boolean, boolean>;
|
|
50
|
+
bannedWords: Schema<string[], string[]>;
|
|
51
|
+
whitelistKeywords: Schema<string[], string[]>;
|
|
52
|
+
strongKeywords: Schema<string[], string[]>;
|
|
53
|
+
whitelistOnlyOwners: Schema<boolean, boolean>;
|
|
54
|
+
blockCardMessage: Schema<boolean, boolean>;
|
|
55
|
+
blockForwardMessage: Schema<boolean, boolean>;
|
|
56
|
+
autoDeleteViolation: Schema<boolean, boolean>;
|
|
57
|
+
sendViolationNotice: Schema<boolean, boolean>;
|
|
58
|
+
autoMuteEnabled: Schema<boolean, boolean>;
|
|
59
|
+
autoMuteThreshold: Schema<number, number>;
|
|
60
|
+
autoMuteMinutes: Schema<number, number>;
|
|
61
|
+
autoKickEnabled: Schema<boolean, boolean>;
|
|
62
|
+
autoKickThreshold: Schema<number, number>;
|
|
63
|
+
autoViolationWindowMinutes: Schema<number, number>;
|
|
64
|
+
enableJoinRequestReview: Schema<boolean, boolean>;
|
|
65
|
+
blacklistEnabled: Schema<boolean, boolean>;
|
|
66
|
+
}>[]>;
|
|
67
|
+
}> | Schemastery.ObjectS<{
|
|
68
|
+
enableAutoMute: Schema<boolean, boolean>;
|
|
69
|
+
autoMuteViolationThreshold: Schema<number, number>;
|
|
70
|
+
autoMuteMinutes: Schema<number, number>;
|
|
71
|
+
enableAutoKick: Schema<boolean, boolean>;
|
|
72
|
+
autoKickViolationThreshold: Schema<number, number>;
|
|
73
|
+
autoViolationWindowMinutes: Schema<number, number>;
|
|
74
|
+
}> | Schemastery.ObjectS<{
|
|
75
|
+
enableMemory: Schema<boolean, boolean>;
|
|
76
|
+
memoryFileName: Schema<string, string>;
|
|
77
|
+
memoryInAi: Schema<boolean, boolean>;
|
|
78
|
+
}> | Schemastery.ObjectS<{
|
|
79
|
+
enableBlacklist: Schema<boolean, boolean>;
|
|
80
|
+
blacklistFileName: Schema<string, string>;
|
|
81
|
+
banCommand: Schema<string, string>;
|
|
82
|
+
banKickOnJoin: Schema<boolean, boolean>;
|
|
83
|
+
banRecordOnKick: Schema<boolean, boolean>;
|
|
84
|
+
}> | Schemastery.ObjectS<{
|
|
85
|
+
enableSelfGag: Schema<boolean, boolean>;
|
|
86
|
+
enableUnauthorizedMutePunish: Schema<boolean, boolean>;
|
|
87
|
+
unauthorizedMuteAttemptThreshold: Schema<number, number>;
|
|
88
|
+
unauthorizedMuteWindowMinutes: Schema<number, number>;
|
|
89
|
+
unauthorizedMutePunishMinMinutes: Schema<number, number>;
|
|
90
|
+
unauthorizedMutePunishMaxMinutes: Schema<number, number>;
|
|
91
|
+
}> | Schemastery.ObjectS<{
|
|
92
|
+
enableRepeater: Schema<boolean, boolean>;
|
|
93
|
+
repeaterThreshold: Schema<number, number>;
|
|
94
|
+
repeaterCooldownSeconds: Schema<number, number>;
|
|
95
|
+
repeaterEnableGetMsgRefetch: Schema<boolean, boolean>;
|
|
96
|
+
enableJoinRequestReview: Schema<boolean, boolean>;
|
|
97
|
+
joinRequestReviewTtlMinutes: Schema<number, number>;
|
|
98
|
+
pendingJoinFileName: Schema<string, string>;
|
|
99
|
+
}> | Schemastery.ObjectS<{
|
|
100
|
+
customCommands: Schema<Schemastery.ObjectS<{
|
|
101
|
+
trigger: Schema<string, string>;
|
|
102
|
+
replies: Schema<string[], string[]>;
|
|
103
|
+
enabled: Schema<boolean, boolean>;
|
|
104
|
+
groups: Schema<string[], string[]>;
|
|
105
|
+
randomReply: Schema<boolean, boolean>;
|
|
106
|
+
quote: Schema<boolean, boolean>;
|
|
107
|
+
cooldownSeconds: Schema<number, number>;
|
|
108
|
+
logHit: Schema<boolean, boolean>;
|
|
109
|
+
}>[], Schemastery.ObjectT<{
|
|
110
|
+
trigger: Schema<string, string>;
|
|
111
|
+
replies: Schema<string[], string[]>;
|
|
112
|
+
enabled: Schema<boolean, boolean>;
|
|
113
|
+
groups: Schema<string[], string[]>;
|
|
114
|
+
randomReply: Schema<boolean, boolean>;
|
|
115
|
+
quote: Schema<boolean, boolean>;
|
|
116
|
+
cooldownSeconds: Schema<number, number>;
|
|
117
|
+
logHit: Schema<boolean, boolean>;
|
|
118
|
+
}>[]>;
|
|
119
|
+
}> | Schemastery.ObjectS<{
|
|
120
|
+
enableAiReply: Schema<boolean, boolean>;
|
|
121
|
+
aiReplyRequireGroupRule: Schema<boolean, boolean>;
|
|
122
|
+
aiProvider: Schema<"openai-compatible" | "gemini", "openai-compatible" | "gemini">;
|
|
123
|
+
aiApiKey: Schema<string, string>;
|
|
124
|
+
aiBaseUrl: Schema<string, string>;
|
|
125
|
+
aiModel: Schema<string, string>;
|
|
126
|
+
aiAgentName: Schema<string, string>;
|
|
127
|
+
aiSystemPrompt: Schema<string, string>;
|
|
128
|
+
aiActivePersona: Schema<string, string>;
|
|
129
|
+
aiPersonas: Schema<Schemastery.ObjectS<{
|
|
130
|
+
id: Schema<string, string>;
|
|
131
|
+
selfName: Schema<string, string>;
|
|
132
|
+
prompt: Schema<string, string>;
|
|
133
|
+
}>[], Schemastery.ObjectT<{
|
|
134
|
+
id: Schema<string, string>;
|
|
135
|
+
selfName: Schema<string, string>;
|
|
136
|
+
prompt: Schema<string, string>;
|
|
137
|
+
}>[]>;
|
|
138
|
+
aiReplyMode: Schema<"threshold" | "random" | "hybrid", "threshold" | "random" | "hybrid">;
|
|
139
|
+
aiMessageThreshold: Schema<number, number>;
|
|
140
|
+
aiRandomReplyProbability: Schema<number, number>;
|
|
141
|
+
aiMinReplyIntervalSeconds: Schema<number, number>;
|
|
142
|
+
aiContextWindow: Schema<number, number>;
|
|
143
|
+
aiTemperature: Schema<number, number>;
|
|
144
|
+
aiMaxOutputTokens: Schema<number, number>;
|
|
145
|
+
aiMaxReplyChars: Schema<number, number>;
|
|
146
|
+
aiReplyDecision: Schema<"two-stage" | "single", "two-stage" | "single">;
|
|
147
|
+
aiEnableImageRecognition: Schema<boolean, boolean>;
|
|
148
|
+
aiImageMaxCount: Schema<number, number>;
|
|
149
|
+
aiImageBudgetMs: Schema<number, number>;
|
|
150
|
+
aiRequestTimeoutSeconds: Schema<number, number>;
|
|
151
|
+
aiDebugPrompt: Schema<boolean, boolean>;
|
|
152
|
+
aiIgnoreCommandMessage: Schema<boolean, boolean>;
|
|
153
|
+
aiEnableDirectMentionTrigger: Schema<boolean, boolean>;
|
|
154
|
+
aiEnableFollowupAfterMention: Schema<boolean, boolean>;
|
|
155
|
+
aiFollowupWindowSeconds: Schema<number, number>;
|
|
156
|
+
aiFollowupMaxTurns: Schema<number, number>;
|
|
157
|
+
aiOwnerPlatform: Schema<string, string>;
|
|
158
|
+
aiOwnerUserId: Schema<string, string>;
|
|
159
|
+
aiHomePlatform: Schema<string, string>;
|
|
160
|
+
aiHomeUserId: Schema<string, string>;
|
|
161
|
+
aiInterestMinScore: Schema<number, number>;
|
|
162
|
+
aiInterestContextWindow: Schema<number, number>;
|
|
163
|
+
aiInterestModel: Schema<string, string>;
|
|
164
|
+
aiInterestMaxTokens: Schema<number, number>;
|
|
165
|
+
}> | Schemastery.ObjectS<{
|
|
166
|
+
allowedUserIds: Schema<string[], string[]>;
|
|
167
|
+
allowGroupOwner: Schema<boolean, boolean>;
|
|
168
|
+
allowGroupAdmin: Schema<boolean, boolean>;
|
|
169
|
+
requireBotOwnerForAdmin: Schema<boolean, boolean>;
|
|
170
|
+
allowAdminBypassWhitelistMute: Schema<boolean, boolean>;
|
|
171
|
+
}> | Schemastery.ObjectS<{
|
|
172
|
+
logCommandResult: Schema<boolean, boolean>;
|
|
173
|
+
logAuthCheck: Schema<boolean, boolean>;
|
|
174
|
+
}>, {
|
|
7
175
|
command: string;
|
|
176
|
+
cmdMute: string;
|
|
177
|
+
cmdUnmute: string;
|
|
178
|
+
cmdKick: string;
|
|
179
|
+
cmdMemory: string;
|
|
180
|
+
cmdBan: string;
|
|
181
|
+
cmdUnban: string;
|
|
182
|
+
cmdBanList: string;
|
|
183
|
+
cmdCustom: string;
|
|
184
|
+
cmdVersion: string;
|
|
8
185
|
platformFilter: string[];
|
|
9
|
-
responseStyle:
|
|
186
|
+
responseStyle: "plain" | "meow";
|
|
10
187
|
dryRun: boolean;
|
|
188
|
+
} & import("koishi").Dict & {
|
|
189
|
+
bannedWords: string[];
|
|
190
|
+
bannedWordScoreThreshold: number;
|
|
191
|
+
strongKeywords: string[];
|
|
192
|
+
blockCardMessage: boolean;
|
|
193
|
+
blockForwardMessage: boolean;
|
|
194
|
+
autoDeleteViolation: boolean;
|
|
195
|
+
sendViolationNotice: boolean;
|
|
196
|
+
groupRules: Schemastery.ObjectT<{
|
|
197
|
+
guildId: Schema<string, string>;
|
|
198
|
+
enableAiReply: Schema<boolean, boolean>;
|
|
199
|
+
bannedWords: Schema<string[], string[]>;
|
|
200
|
+
whitelistKeywords: Schema<string[], string[]>;
|
|
201
|
+
strongKeywords: Schema<string[], string[]>;
|
|
202
|
+
whitelistOnlyOwners: Schema<boolean, boolean>;
|
|
203
|
+
blockCardMessage: Schema<boolean, boolean>;
|
|
204
|
+
blockForwardMessage: Schema<boolean, boolean>;
|
|
205
|
+
autoDeleteViolation: Schema<boolean, boolean>;
|
|
206
|
+
sendViolationNotice: Schema<boolean, boolean>;
|
|
207
|
+
autoMuteEnabled: Schema<boolean, boolean>;
|
|
208
|
+
autoMuteThreshold: Schema<number, number>;
|
|
209
|
+
autoMuteMinutes: Schema<number, number>;
|
|
210
|
+
autoKickEnabled: Schema<boolean, boolean>;
|
|
211
|
+
autoKickThreshold: Schema<number, number>;
|
|
212
|
+
autoViolationWindowMinutes: Schema<number, number>;
|
|
213
|
+
enableJoinRequestReview: Schema<boolean, boolean>;
|
|
214
|
+
blacklistEnabled: Schema<boolean, boolean>;
|
|
215
|
+
}>[];
|
|
216
|
+
} & {
|
|
217
|
+
enableAutoMute: boolean;
|
|
218
|
+
autoMuteViolationThreshold: number;
|
|
219
|
+
autoMuteMinutes: number;
|
|
220
|
+
enableAutoKick: boolean;
|
|
221
|
+
autoKickViolationThreshold: number;
|
|
222
|
+
autoViolationWindowMinutes: number;
|
|
223
|
+
} & {
|
|
224
|
+
enableMemory: boolean;
|
|
225
|
+
memoryFileName: string;
|
|
226
|
+
memoryInAi: boolean;
|
|
227
|
+
} & {
|
|
228
|
+
enableBlacklist: boolean;
|
|
229
|
+
blacklistFileName: string;
|
|
230
|
+
banCommand: string;
|
|
231
|
+
banKickOnJoin: boolean;
|
|
232
|
+
banRecordOnKick: boolean;
|
|
233
|
+
} & {
|
|
11
234
|
enableSelfGag: boolean;
|
|
12
235
|
enableUnauthorizedMutePunish: boolean;
|
|
13
236
|
unauthorizedMuteAttemptThreshold: number;
|
|
14
237
|
unauthorizedMuteWindowMinutes: number;
|
|
15
238
|
unauthorizedMutePunishMinMinutes: number;
|
|
16
239
|
unauthorizedMutePunishMaxMinutes: number;
|
|
240
|
+
} & {
|
|
241
|
+
enableRepeater: boolean;
|
|
242
|
+
repeaterThreshold: number;
|
|
243
|
+
repeaterCooldownSeconds: number;
|
|
244
|
+
repeaterEnableGetMsgRefetch: boolean;
|
|
245
|
+
enableJoinRequestReview: boolean;
|
|
246
|
+
joinRequestReviewTtlMinutes: number;
|
|
247
|
+
pendingJoinFileName: string;
|
|
248
|
+
} & {
|
|
249
|
+
customCommands: Schemastery.ObjectT<{
|
|
250
|
+
trigger: Schema<string, string>;
|
|
251
|
+
replies: Schema<string[], string[]>;
|
|
252
|
+
enabled: Schema<boolean, boolean>;
|
|
253
|
+
groups: Schema<string[], string[]>;
|
|
254
|
+
randomReply: Schema<boolean, boolean>;
|
|
255
|
+
quote: Schema<boolean, boolean>;
|
|
256
|
+
cooldownSeconds: Schema<number, number>;
|
|
257
|
+
logHit: Schema<boolean, boolean>;
|
|
258
|
+
}>[];
|
|
259
|
+
} & {
|
|
17
260
|
enableAiReply: boolean;
|
|
18
|
-
|
|
261
|
+
aiReplyRequireGroupRule: boolean;
|
|
262
|
+
aiProvider: "openai-compatible" | "gemini";
|
|
19
263
|
aiApiKey: string;
|
|
20
264
|
aiBaseUrl: string;
|
|
21
265
|
aiModel: string;
|
|
22
266
|
aiAgentName: string;
|
|
23
267
|
aiSystemPrompt: string;
|
|
24
268
|
aiActivePersona: string;
|
|
25
|
-
aiPersonas:
|
|
26
|
-
|
|
269
|
+
aiPersonas: Schemastery.ObjectT<{
|
|
270
|
+
id: Schema<string, string>;
|
|
271
|
+
selfName: Schema<string, string>;
|
|
272
|
+
prompt: Schema<string, string>;
|
|
273
|
+
}>[];
|
|
274
|
+
aiReplyMode: "threshold" | "random" | "hybrid";
|
|
27
275
|
aiMessageThreshold: number;
|
|
28
276
|
aiRandomReplyProbability: number;
|
|
29
277
|
aiMinReplyIntervalSeconds: number;
|
|
30
278
|
aiContextWindow: number;
|
|
31
279
|
aiTemperature: number;
|
|
32
280
|
aiMaxOutputTokens: number;
|
|
281
|
+
aiMaxReplyChars: number;
|
|
282
|
+
aiReplyDecision: "two-stage" | "single";
|
|
33
283
|
aiEnableImageRecognition: boolean;
|
|
34
284
|
aiImageMaxCount: number;
|
|
285
|
+
aiImageBudgetMs: number;
|
|
286
|
+
aiRequestTimeoutSeconds: number;
|
|
287
|
+
aiDebugPrompt: boolean;
|
|
35
288
|
aiIgnoreCommandMessage: boolean;
|
|
36
289
|
aiEnableDirectMentionTrigger: boolean;
|
|
37
290
|
aiEnableFollowupAfterMention: boolean;
|
|
@@ -45,58 +298,14 @@ export interface Config {
|
|
|
45
298
|
aiInterestContextWindow: number;
|
|
46
299
|
aiInterestModel: string;
|
|
47
300
|
aiInterestMaxTokens: number;
|
|
48
|
-
|
|
49
|
-
repeaterThreshold: number;
|
|
50
|
-
repeaterCooldownSeconds: number;
|
|
51
|
-
repeaterEnableGetMsgRefetch: boolean;
|
|
52
|
-
enableJoinRequestReview: boolean;
|
|
53
|
-
joinRequestReviewTtlMinutes: number;
|
|
54
|
-
pendingJoinFileName: string;
|
|
55
|
-
bannedWords: string[];
|
|
56
|
-
strongKeywords: string[];
|
|
57
|
-
blockCardMessage: boolean;
|
|
58
|
-
blockForwardMessage: boolean;
|
|
59
|
-
autoDeleteViolation: boolean;
|
|
60
|
-
sendViolationNotice: boolean;
|
|
61
|
-
enableAutoMute: boolean;
|
|
62
|
-
autoMuteViolationThreshold: number;
|
|
63
|
-
autoMuteMinutes: number;
|
|
64
|
-
enableAutoKick: boolean;
|
|
65
|
-
autoKickViolationThreshold: number;
|
|
66
|
-
autoViolationWindowMinutes: number;
|
|
67
|
-
enableMemory: boolean;
|
|
68
|
-
memoryFileName: string;
|
|
69
|
-
memoryInAi: boolean;
|
|
70
|
-
groupRules: GroupRule[];
|
|
301
|
+
} & {
|
|
71
302
|
allowedUserIds: string[];
|
|
72
303
|
allowGroupOwner: boolean;
|
|
73
304
|
allowGroupAdmin: boolean;
|
|
74
305
|
requireBotOwnerForAdmin: boolean;
|
|
75
306
|
allowAdminBypassWhitelistMute: boolean;
|
|
307
|
+
} & {
|
|
76
308
|
logCommandResult: boolean;
|
|
77
309
|
logAuthCheck: boolean;
|
|
78
|
-
}
|
|
79
|
-
export
|
|
80
|
-
id: string;
|
|
81
|
-
selfName: string;
|
|
82
|
-
prompt: string;
|
|
83
|
-
}
|
|
84
|
-
export interface GroupRule {
|
|
85
|
-
guildId: string;
|
|
86
|
-
enableAiReply?: boolean;
|
|
87
|
-
bannedWords: string[];
|
|
88
|
-
strongKeywords?: string[];
|
|
89
|
-
blockCardMessage: boolean;
|
|
90
|
-
blockForwardMessage: boolean;
|
|
91
|
-
autoDeleteViolation: boolean;
|
|
92
|
-
sendViolationNotice: boolean;
|
|
93
|
-
autoMuteEnabled?: boolean;
|
|
94
|
-
autoMuteThreshold?: number;
|
|
95
|
-
autoMuteMinutes?: number;
|
|
96
|
-
autoKickEnabled?: boolean;
|
|
97
|
-
autoKickThreshold?: number;
|
|
98
|
-
autoViolationWindowMinutes?: number;
|
|
99
|
-
enableJoinRequestReview?: boolean;
|
|
100
|
-
}
|
|
101
|
-
export declare const Config: Schema<Config>;
|
|
102
|
-
export declare function apply(ctx: Context, config: Config): void;
|
|
310
|
+
}>;
|
|
311
|
+
export declare function apply(ctx: Context, config: any): void;
|
package/lib/index.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.Config = exports.inject = exports.name = void 0;
|
|
|
4
4
|
exports.apply = apply;
|
|
5
5
|
const koishi_1 = require("koishi");
|
|
6
6
|
const service_1 = require("./service");
|
|
7
|
-
const commands_1 = require("./commands");
|
|
8
7
|
exports.name = 'nestim-qq-group-manager';
|
|
9
8
|
exports.inject = {
|
|
10
9
|
optional: ['puppeteer'],
|
|
@@ -128,15 +127,23 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
128
127
|
koishi_1.Schema.const('threshold').description('只看消息数:累计达到阈值才触发(不看概率)'),
|
|
129
128
|
koishi_1.Schema.const('random').description('只看概率:每条消息掷一次骰(不看消息数)'),
|
|
130
129
|
koishi_1.Schema.const('hybrid').description('两者都要满足:先累计到阈值,再按概率掷中'),
|
|
131
|
-
]).role('radio').default('hybrid').description('AI
|
|
132
|
-
aiMessageThreshold: koishi_1.Schema.natural().default(16).description('阈值触发所需累计消息数。threshold / hybrid
|
|
130
|
+
]).role('radio').default('hybrid').description('AI 触发策略:threshold 只看消息数、random 只看概率、hybrid 两者都要满足。@点名与点名后跟随会越过这些闸门。是否真正接话由模型在回复时用 <pass/> 自行决定。'),
|
|
131
|
+
aiMessageThreshold: koishi_1.Schema.natural().default(16).description('阈值触发所需累计消息数。threshold / hybrid 模式下未达此数一律不触发;计数器在模型给出回复或主动放弃后清零。'),
|
|
133
132
|
aiRandomReplyProbability: koishi_1.Schema.percent().default(0.08).description('随机触发概率(每条消息掷一次骰)。random / hybrid 模式下未掷中直接跳过,不会调用 AI 接口。填 0 等同于关闭随机触发。'),
|
|
134
|
-
aiMinReplyIntervalSeconds: koishi_1.Schema.natural().default(45).description('
|
|
135
|
-
aiContextWindow: koishi_1.Schema.natural().default(
|
|
136
|
-
aiTemperature: koishi_1.Schema.number().min(0).max(2).step(0.1).default(0.8).description('生成温度(0~2
|
|
137
|
-
aiMaxOutputTokens: koishi_1.Schema.natural().default(
|
|
138
|
-
|
|
133
|
+
aiMinReplyIntervalSeconds: koishi_1.Schema.natural().default(45).description('同一群两次真正调用模型的最短间隔(秒)。'),
|
|
134
|
+
aiContextWindow: koishi_1.Schema.natural().default(30).description('参与推理的最近消息条数(建议 20~40;太小会导致模型看不到前文)。'),
|
|
135
|
+
aiTemperature: koishi_1.Schema.number().min(0).max(2).step(0.1).default(0.8).description('生成温度(0~2)。群聊接话建议 0.7~0.9,过高会跑题、复述、发散。'),
|
|
136
|
+
aiMaxOutputTokens: koishi_1.Schema.natural().default(400).description('AI 最大输出 token 数。群聊一句话不需要太大,过大会增加延迟。'),
|
|
137
|
+
aiMaxReplyChars: koishi_1.Schema.natural().min(20).max(500).default(120).description('单条回复的最大字符数,超出会在句末截断。'),
|
|
138
|
+
aiReplyDecision: koishi_1.Schema.union([
|
|
139
|
+
koishi_1.Schema.const('single').description('一次调用:模型直接输出回复,或用 <pass/> 放弃(推荐)'),
|
|
140
|
+
koishi_1.Schema.const('two-stage').description('两次调用:先判定是否值得回复,再生成正文'),
|
|
141
|
+
]).role('radio').default('single').description('接话决策方式。single 更快、决策与正文一致;two-stage 更省生成成本但多一次延迟。'),
|
|
142
|
+
aiEnableImageRecognition: koishi_1.Schema.boolean().default(true).description('是否启用图片识别(支持时将图片一并发送给模型;不支持的模型会自动降级为纯文本)。'),
|
|
139
143
|
aiImageMaxCount: koishi_1.Schema.natural().default(2).description('每次最多发送给模型的图片数量。'),
|
|
144
|
+
aiImageBudgetMs: koishi_1.Schema.natural().min(500).max(20000).default(6000).description('图片下载/转换的总时间预算(毫秒)。超时直接跳过图片,避免拖慢回复。'),
|
|
145
|
+
aiRequestTimeoutSeconds: koishi_1.Schema.natural().min(5).max(120).default(20).description('单次模型请求超时(秒)。'),
|
|
146
|
+
aiDebugPrompt: koishi_1.Schema.boolean().default(false).description('调试:把最终系统提示词与用户提示词写入日志(排查"答非所问"时打开,平时关闭)。'),
|
|
140
147
|
aiIgnoreCommandMessage: koishi_1.Schema.boolean().default(true).description('忽略看起来像命令的消息,避免干扰正常指令执行。'),
|
|
141
148
|
aiEnableDirectMentionTrigger: koishi_1.Schema.boolean().default(true).description('消息命中智能体名字时是否忽略阈值直接触发回复。'),
|
|
142
149
|
aiEnableFollowupAfterMention: koishi_1.Schema.boolean().default(true).description('点名触发后,是否跟随该用户一段时间继续对话。'),
|
|
@@ -146,10 +153,10 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
146
153
|
aiOwnerUserId: koishi_1.Schema.string().default('').description('主人平台用户 ID(如 QQ 号,用于记忆主人身份)。'),
|
|
147
154
|
aiHomePlatform: koishi_1.Schema.string().default('onebot').description('兼容字段:主页平台标识(建议改用 aiOwnerPlatform)。'),
|
|
148
155
|
aiHomeUserId: koishi_1.Schema.string().default('').description('兼容字段:主页平台用户 ID(建议改用 aiOwnerUserId)。'),
|
|
149
|
-
aiInterestMinScore: koishi_1.Schema.number().min(0).max(100).step(1).default(82).description('
|
|
150
|
-
aiInterestContextWindow: koishi_1.Schema.number().min(4).max(16).step(1).default(8).description('
|
|
151
|
-
aiInterestModel: koishi_1.Schema.string().default('').description('
|
|
152
|
-
aiInterestMaxTokens: koishi_1.Schema.natural().min(256).max(16384).default(2048).description('
|
|
156
|
+
aiInterestMinScore: koishi_1.Schema.number().min(0).max(100).step(1).default(82).description('(仅 aiReplyDecision=two-stage 时生效)判定为值得回复的最低分。'),
|
|
157
|
+
aiInterestContextWindow: koishi_1.Schema.number().min(4).max(16).step(1).default(8).description('(仅 two-stage 生效)判定使用的上下文窗口条数。'),
|
|
158
|
+
aiInterestModel: koishi_1.Schema.string().default('').description('(仅 two-stage 生效)判定专用模型(留空沿用 aiModel)。'),
|
|
159
|
+
aiInterestMaxTokens: koishi_1.Schema.natural().min(256).max(16384).default(2048).description('(仅 two-stage 生效)判定的最大输出 token。'),
|
|
153
160
|
}).description('AI 回复'),
|
|
154
161
|
koishi_1.Schema.object({
|
|
155
162
|
allowedUserIds: koishi_1.Schema.array(String).role('table').default([]).description('允许直接使用群管理命令的账号 ID 白名单。命中即通过,不再校验群内角色。'),
|
|
@@ -178,5 +185,4 @@ function apply(ctx, config) {
|
|
|
178
185
|
ctx.on('dispose', () => {
|
|
179
186
|
service.flushPendingJoinRequests();
|
|
180
187
|
});
|
|
181
|
-
(0, commands_1.registerCommands)(ctx, service, config);
|
|
182
188
|
}
|