koishi-plugin-group-analysis-mx 1.5.9 → 1.6.1

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.
@@ -894,7 +894,8 @@ class AnalysisService extends koishi_1.Service {
894
894
  if (normRaw)
895
895
  nicknameAvatarMap.set(normRaw, user.avatar);
896
896
  }
897
- // 排行榜显示名使用群名片
897
+ // 保留个人昵称(供话题 chip 匹配),排行榜显示名仍使用群名片
898
+ user.rawName = rawName;
898
899
  user.nickname = displayName;
899
900
  }
900
901
  // 话题:参与者/描述里的用户 ID(官方 bot 为 openid)回填为昵称,回填不到显示"群友"
@@ -43,7 +43,8 @@ class LLMService extends koishi_1.Service {
43
43
  throw new Error('未找到 YAML 响应。');
44
44
  }
45
45
  try {
46
- const data = (0, js_yaml_1.load)(yamlMatch[1]);
46
+ // json: true 容忍重复 key(LLM 偶尔会重复输出 sender 等字段),后者覆盖前者
47
+ const data = (0, js_yaml_1.load)(yamlMatch[1], { json: true });
47
48
  if (Array.isArray(data)) {
48
49
  this.ctx.logger.info(`成功解析 ${data.length} 条数据。`);
49
50
  }
@@ -229,8 +229,12 @@ class RendererService extends koishi_1.Service {
229
229
  // 话题昵称装饰:只给描述正文里的昵称加"头像 + 胶囊"小标签(参与者那一行不加)
230
230
  const nameAvatar = new Map();
231
231
  for (const u of (data.userStats || [])) {
232
- if (u && u.nickname && u.avatar && String(u.avatar).startsWith('data:'))
233
- nameAvatar.set(String(u.nickname), u.avatar);
232
+ if (u && u.avatar && String(u.avatar).startsWith('data:')) {
233
+ for (const nm of [u.rawName, u.nickname]) {
234
+ if (nm && String(nm).trim())
235
+ nameAvatar.set(String(nm).trim(), u.avatar);
236
+ }
237
+ }
234
238
  }
235
239
  // 昵称按长度降序,避免短名先替换把长名拆开
236
240
  const chipNames = [...nameAvatar.keys()].filter((n) => n && n.trim()).sort((x, y) => y.length - x.length);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-group-analysis-mx",
3
3
  "description": "群聊分析插件 - 生成精美群聊统计报告,支持 AI 话题总结(独立版,不依赖 ChatLuna)",
4
- "version": "1.5.9",
4
+ "version": "1.6.1",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",
@@ -52,3 +52,5 @@
52
52
 
53
53
 
54
54
 
55
+
56
+