@nestim/koishi-plugin-qq-group-manager 1.2.2 → 1.2.3

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 CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  本文件记录所有值得注意的变更。版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
4
4
 
5
+ ## 1.2.3
6
+
7
+ ### 修复
8
+
9
+ - **续聊(followup)触发过宽**:用户换话题后,像“操不会说话了”这种短句仍会被当成
10
+ “接着上一轮说”,导致机器人追着自己的旧话题自说自话。
11
+ 现在必须满足“与上一轮有话题交集”或“明确追问词(展开/细说/然后/为什么…)”才续聊,
12
+ 否则直接清掉待续状态,按新消息重新判断。
13
+
5
14
  ## 1.2.2
6
15
 
7
16
  ### 修复
package/lib/ai/engine.js CHANGED
@@ -264,9 +264,12 @@ class AiEngine {
264
264
  return false;
265
265
  if (/[??]/.test(text))
266
266
  return true;
267
- if (/(继续|然后|那|所以|为什么|怎么|如何|帮我|还能|可以吗|行吗|对不对|是不是)/.test(text))
267
+ if (/(继续|然后|那|所以|为什么|怎么|如何|帮我|还能|可以吗|行吗|对不对|是不是|展开|多说|细说|具体|举个例子|还有呢|后来呢|说说|讲讲)/.test(text))
268
268
  return true;
269
- return text.length >= 6;
269
+ // 没有话题交集、也不是明确的追问 → 不追着说,避免用户换话题后机器人自说自话
270
+ if (overlap > 0 && ratio >= 0.18)
271
+ return true;
272
+ return false;
270
273
  }
271
274
  startFollowup(state, record) {
272
275
  if (this.config.aiEnableFollowupAfterMention === false)
@@ -354,6 +357,9 @@ class AiEngine {
354
357
  const mention = this.isMention(session, record);
355
358
  const followupState = mention ? null : this.getFollowup(state, record, session);
356
359
  const followup = !!followupState && this.shouldContinueFollowup(record, followupState);
360
+ // 用户换了话题/说的和上一轮无关时,丢掉待续话题,避免机器人追着自己上一句说
361
+ if (followupState && !followup)
362
+ state.followup = null;
357
363
  const threshold = Math.max(1, Number(this.config.aiMessageThreshold ?? 15));
358
364
  const decision = (0, trigger_1.decideTrigger)({
359
365
  mode: (this.config.aiReplyMode || 'hybrid'),
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.2.2",
4
+ "version": "1.2.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
package/src/ai/engine.ts CHANGED
@@ -297,8 +297,10 @@ export class AiEngine {
297
297
  if (text.length >= 8 && ratio <= 0.12 && /[??]/.test(text)) return false;
298
298
 
299
299
  if (/[??]/.test(text)) return true;
300
- if (/(继续|然后|那|所以|为什么|怎么|如何|帮我|还能|可以吗|行吗|对不对|是不是)/.test(text)) return true;
301
- return text.length >= 6;
300
+ if (/(继续|然后|那|所以|为什么|怎么|如何|帮我|还能|可以吗|行吗|对不对|是不是|展开|多说|细说|具体|举个例子|还有呢|后来呢|说说|讲讲)/.test(text)) return true;
301
+ // 没有话题交集、也不是明确的追问 → 不追着说,避免用户换话题后机器人自说自话
302
+ if (overlap > 0 && ratio >= 0.18) return true;
303
+ return false;
302
304
  }
303
305
 
304
306
  private startFollowup(state: GroupState, record: ChatRecord): void {
@@ -382,6 +384,8 @@ export class AiEngine {
382
384
  const mention = this.isMention(session, record);
383
385
  const followupState = mention ? null : this.getFollowup(state, record, session);
384
386
  const followup = !!followupState && this.shouldContinueFollowup(record, followupState);
387
+ // 用户换了话题/说的和上一轮无关时,丢掉待续话题,避免机器人追着自己上一句说
388
+ if (followupState && !followup) state.followup = null;
385
389
 
386
390
  const threshold = Math.max(1, Number(this.config.aiMessageThreshold ?? 15));
387
391
  const decision = decideTrigger({