koishi-plugin-group-analysis-mx 1.5.6 → 1.5.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.
@@ -919,7 +919,7 @@ class AnalysisService extends koishi_1.Service {
919
919
  const norm = (0, utils_1.normalizeNickname)(sVal);
920
920
  if (norm && nicknameMap.has(norm))
921
921
  return nicknameMap.get(norm);
922
- if (/^[0-9A-Fa-f]{16,}$/.test(cleaned) || (cleaned.length > 12 && !/^\d+$/.test(cleaned)))
922
+ if (/^[0-9A-Fa-f]{16,}$/.test(cleaned))
923
923
  return '群友';
924
924
  return sVal;
925
925
  };
@@ -955,7 +955,7 @@ class AnalysisService extends koishi_1.Service {
955
955
  // 金句:LLM 输入用 [user_id],这里按 ID 精确回填完整昵称(含 emoji),并补全头像。
956
956
  if (Array.isArray(goldenQuotes)) {
957
957
  // 官方 bot 的 userId 可能是 openid(长十六进制串),不能直接当昵称显示
958
- const isOpenId = (v) => { const x = String(v || '').trim(); if (!x) return false; if (/^\d+$/.test(x)) return false; return /^[0-9A-Fa-f]{16,}$/.test(x) || x.length > 12; };
958
+ const isOpenId = (v) => { const x = String(v || '').trim(); if (!x) return false; if (/^\d+$/.test(x)) return false; return /^[0-9A-Fa-f]{16,}$/.test(x); };
959
959
  // id → 完整昵称(群名片优先,回退消息昵称;跳过 openid 形式)
960
960
  const idToNickname = new Map();
961
961
  for (const msg of messages) {
@@ -984,7 +984,7 @@ class AnalysisService extends koishi_1.Service {
984
984
  '';
985
985
  if (realName)
986
986
  quote.sender = realName;
987
- else if (isOpenId(quote.sender) || String(quote.sender).length > 12)
987
+ else if (isOpenId(quote.sender))
988
988
  quote.sender = '群友';
989
989
  if (!quote.avatar) {
990
990
  quote.avatar =
@@ -226,36 +226,18 @@ class RendererService extends koishi_1.Service {
226
226
  userTitles: await Promise.all((data.userTitles || []).map(inlineAvatar)),
227
227
  };
228
228
 
229
- // 话题昵称装饰:把参与者/详情里出现的昵称包成带头像的小标签 chip
229
+ // 话题昵称装饰:只给描述正文里的昵称加"头像 + 胶囊"小标签(参与者那一行不加)
230
230
  const nameAvatar = new Map();
231
231
  for (const u of (data.userStats || [])) {
232
232
  if (u && u.nickname && u.avatar && String(u.avatar).startsWith('data:'))
233
233
  nameAvatar.set(String(u.nickname), u.avatar);
234
234
  }
235
- const chipNames = [...nameAvatar.keys()].filter((n) => n && n.length >= 2).sort((x, y) => y.length - x.length);
235
+ // 昵称按长度降序,避免短名先替换把长名拆开
236
+ const chipNames = [...nameAvatar.keys()].filter((n) => n && n.trim()).sort((x, y) => y.length - x.length);
236
237
  const chipOf = (name) => {
237
238
  const av = nameAvatar.get(name);
238
- const img = av ? '<img src="' + av + '" alt="" style="width:1.15em;height:1.15em;border-radius:50%;object-fit:cover;vertical-align:middle;display:inline-block;margin-right:4px">' : '';
239
- return '<span class="topic-user" style="display:inline-flex;align-items:center;background:rgba(0,0,0,.05);border-radius:6px;padding:0 6px;font-size:.92em;vertical-align:middle">' + img + name + '</span>';
240
- };
241
- data = {
242
- ...data,
243
- topics: (data.topics || []).map((t) => {
244
- if (!t) return t;
245
- const contributors = Array.isArray(t.contributors)
246
- ? t.contributors.map((c) => { const n = String(c); return chipNames.includes(n) ? chipOf(n) : n; })
247
- : t.contributors;
248
- let detail = String(t.detail || '');
249
- const ph = [];
250
- for (const n of chipNames) {
251
- if (!detail.includes(n)) continue;
252
- const tag = '\u0001' + ph.length + '\u0002';
253
- detail = detail.split(n).join(tag);
254
- ph.push(chipOf(n));
255
- }
256
- detail = detail.replace(/\u0001(\d+)\u0002/g, (m, i) => ph[+i] || '');
257
- return { ...t, contributors, detail };
258
- }),
239
+ const img = av ? '<img src="' + av + '" alt="" style="width:1.15em;height:1.15em;border-radius:50%;object-fit:cover;vertical-align:middle;display:inline-block;margin-right:3px">' : '';
240
+ return '<span class="topic-user" style="display:inline-flex;align-items:center;background:rgba(0,0,0,.055);border-radius:999px;padding:1px 8px 1px 2px;font-size:.92em;line-height:1.7;vertical-align:middle;margin:0 1px">' + img + name + '</span>';
259
241
  };
260
242
  const templatePath = this.getSkinPath('template_group.html');
261
243
  const randomId = Math.random().toString(36).substring(2, 15);
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.6",
4
+ "version": "1.5.8",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",
@@ -49,3 +49,5 @@
49
49
  }
50
50
 
51
51
 
52
+
53
+