koishi-plugin-group-analysis-mx 1.2.1 → 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.
@@ -816,34 +816,56 @@ class AnalysisService extends koishi_1.Service {
816
816
  }
817
817
  avatarMap.set(String(user.userId), user.avatar || '');
818
818
  }
819
- // 用户称号列表同样补全头像(LLM 返回的 id 可能是数字类型)
819
+ // 昵称 原始昵称 / 头像 映射(金句、称号用),并对 emoji/空白做归一化以增强匹配。
820
+ // LLM 返回的 sender/name 常丢失 emoji,这里用真实昵称(含 emoji)替换显示。
821
+ const nicknameAvatarMap = new Map();
822
+ const nicknameMap = new Map();
823
+ for (const user of sortedUsers) {
824
+ if (user.nickname) {
825
+ const normalized = (0, utils_1.normalizeNickname)(user.nickname);
826
+ if (!nicknameMap.has(user.nickname))
827
+ nicknameMap.set(user.nickname, user.nickname);
828
+ if (normalized && !nicknameMap.has(normalized))
829
+ nicknameMap.set(normalized, user.nickname);
830
+ if (user.avatar) {
831
+ nicknameAvatarMap.set(user.nickname, user.avatar);
832
+ if (normalized && !nicknameAvatarMap.has(normalized))
833
+ nicknameAvatarMap.set(normalized, user.avatar);
834
+ }
835
+ }
836
+ }
837
+ // 用户称号:用真实昵称替换 LLM 生成的 name(保留 emoji),并补全头像
820
838
  if (Array.isArray(userTitles)) {
821
839
  userTitles.forEach((title) => {
840
+ if (title && title.name) {
841
+ const normalized = (0, utils_1.normalizeNickname)(title.name);
842
+ const realName = nicknameMap.get(title.name) ||
843
+ (normalized ? nicknameMap.get(normalized) : '') ||
844
+ '';
845
+ if (realName)
846
+ title.name = realName;
847
+ }
822
848
  if (title && !title.avatar && avatarMap.has(String(title.id))) {
823
849
  title.avatar = avatarMap.get(String(title.id));
824
850
  }
825
851
  });
826
852
  }
827
- // 昵称 头像 映射(金句 sender 匹配用),并对 emoji/空白做归一化以增强匹配
828
- const nicknameAvatarMap = new Map();
829
- for (const user of sortedUsers) {
830
- if (user.nickname && user.avatar) {
831
- nicknameAvatarMap.set(user.nickname, user.avatar);
832
- const normalized = (0, utils_1.normalizeNickname)(user.nickname);
833
- if (normalized && !nicknameAvatarMap.has(normalized)) {
834
- nicknameAvatarMap.set(normalized, user.avatar);
835
- }
836
- }
837
- }
838
- // 金句同样补全发送者头像(按昵称匹配)
853
+ // 金句:用真实昵称替换 LLM 生成的昵称(保留 emoji),并补全发送者头像
839
854
  if (Array.isArray(goldenQuotes)) {
840
855
  goldenQuotes.forEach((quote) => {
841
- if (quote && !quote.avatar && quote.sender) {
856
+ if (quote && quote.sender) {
842
857
  const normalized = (0, utils_1.normalizeNickname)(quote.sender);
843
- quote.avatar =
844
- nicknameAvatarMap.get(quote.sender) ||
845
- (normalized ? nicknameAvatarMap.get(normalized) : '') ||
858
+ const realName = nicknameMap.get(quote.sender) ||
859
+ (normalized ? nicknameMap.get(normalized) : '') ||
846
860
  '';
861
+ if (realName)
862
+ quote.sender = realName;
863
+ if (!quote.avatar) {
864
+ quote.avatar =
865
+ nicknameAvatarMap.get(quote.sender) ||
866
+ nicknameAvatarMap.get(normalized) ||
867
+ '';
868
+ }
847
869
  }
848
870
  });
849
871
  }
@@ -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.3",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",