koishi-plugin-group-analysis-mx 1.2.1 → 1.2.2

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.
@@ -824,26 +824,40 @@ class AnalysisService extends koishi_1.Service {
824
824
  }
825
825
  });
826
826
  }
827
- // 昵称 → 头像 映射(金句 sender 匹配用),并对 emoji/空白做归一化以增强匹配
827
+ // 昵称 → 原始昵称 / 头像 映射(金句、称号用),并对 emoji/空白做归一化以增强匹配。
828
+ // LLM 返回的 sender/name 常丢失 emoji,这里用真实昵称(含 emoji)替换显示。
828
829
  const nicknameAvatarMap = new Map();
830
+ const nicknameMap = new Map();
829
831
  for (const user of sortedUsers) {
830
- if (user.nickname && user.avatar) {
831
- nicknameAvatarMap.set(user.nickname, user.avatar);
832
+ if (user.nickname) {
832
833
  const normalized = (0, utils_1.normalizeNickname)(user.nickname);
833
- if (normalized && !nicknameAvatarMap.has(normalized)) {
834
- nicknameAvatarMap.set(normalized, user.avatar);
834
+ if (!nicknameMap.has(user.nickname))
835
+ nicknameMap.set(user.nickname, user.nickname);
836
+ if (normalized && !nicknameMap.has(normalized))
837
+ nicknameMap.set(normalized, user.nickname);
838
+ if (user.avatar) {
839
+ nicknameAvatarMap.set(user.nickname, user.avatar);
840
+ if (normalized && !nicknameAvatarMap.has(normalized))
841
+ nicknameAvatarMap.set(normalized, user.avatar);
835
842
  }
836
843
  }
837
844
  }
838
- // 金句同样补全发送者头像(按昵称匹配)
845
+ // 金句:用真实昵称替换 LLM 生成的昵称(保留 emoji),并补全发送者头像
839
846
  if (Array.isArray(goldenQuotes)) {
840
847
  goldenQuotes.forEach((quote) => {
841
- if (quote && !quote.avatar && quote.sender) {
848
+ if (quote && quote.sender) {
842
849
  const normalized = (0, utils_1.normalizeNickname)(quote.sender);
843
- quote.avatar =
844
- nicknameAvatarMap.get(quote.sender) ||
845
- (normalized ? nicknameAvatarMap.get(normalized) : '') ||
850
+ const realName = nicknameMap.get(quote.sender) ||
851
+ (normalized ? nicknameMap.get(normalized) : '') ||
846
852
  '';
853
+ if (realName)
854
+ quote.sender = realName;
855
+ if (!quote.avatar) {
856
+ quote.avatar =
857
+ nicknameAvatarMap.get(quote.sender) ||
858
+ nicknameAvatarMap.get(normalized) ||
859
+ '';
860
+ }
847
861
  }
848
862
  });
849
863
  }
@@ -27,7 +27,7 @@ class ScrapbookSkinRenderer {
27
27
  <div class="quote-wrapper">
28
28
  <div class="q-flex-container">
29
29
  <div class="q-user-col">
30
- ${quote.avatar ? `<img src="${quote.avatar}" alt="头像" style="width:40px;height:40px;border-radius:50%;object-fit:cover;margin-top:4px;">` : ''}
30
+ ${quote.avatar ? `<div class="q-avatar-box"><img src="${quote.avatar}" class="q-avatar" alt="头像"></div>` : ''}
31
31
  </div>
32
32
 
33
33
  <div class="q-content-col">
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.2.1",
4
+ "version": "1.2.2",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",