koishi-plugin-group-analysis-mx 1.5.7 → 1.5.9
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/lib/service/analysis.js +9 -3
- package/package.json +3 -1
package/lib/service/analysis.js
CHANGED
|
@@ -911,6 +911,12 @@ class AnalysisService extends koishi_1.Service {
|
|
|
911
911
|
}
|
|
912
912
|
const resolveTopicName = (raw) => {
|
|
913
913
|
const sVal = String(raw || '').trim();
|
|
914
|
+
// 形如 "昵称(openid)":只取昵称部分
|
|
915
|
+
const m = sVal.match(/^(.+?)\s*[((]([0-9A-Fa-f]{16,})[))]\s*$/);
|
|
916
|
+
if (m) {
|
|
917
|
+
const nick = m[1].trim();
|
|
918
|
+
return nick || topicIdToName.get(m[2]) || '群友';
|
|
919
|
+
}
|
|
914
920
|
const cleaned = sVal.replace(/[\[\]()()]/g, '').trim();
|
|
915
921
|
if (topicIdToName.has(cleaned))
|
|
916
922
|
return topicIdToName.get(cleaned);
|
|
@@ -919,7 +925,7 @@ class AnalysisService extends koishi_1.Service {
|
|
|
919
925
|
const norm = (0, utils_1.normalizeNickname)(sVal);
|
|
920
926
|
if (norm && nicknameMap.has(norm))
|
|
921
927
|
return nicknameMap.get(norm);
|
|
922
|
-
if (/^[0-9A-Fa-f]{16,}$/.test(cleaned)
|
|
928
|
+
if (/^[0-9A-Fa-f]{16,}$/.test(cleaned))
|
|
923
929
|
return '群友';
|
|
924
930
|
return sVal;
|
|
925
931
|
};
|
|
@@ -955,7 +961,7 @@ class AnalysisService extends koishi_1.Service {
|
|
|
955
961
|
// 金句:LLM 输入用 [user_id],这里按 ID 精确回填完整昵称(含 emoji),并补全头像。
|
|
956
962
|
if (Array.isArray(goldenQuotes)) {
|
|
957
963
|
// 官方 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)
|
|
964
|
+
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
965
|
// id → 完整昵称(群名片优先,回退消息昵称;跳过 openid 形式)
|
|
960
966
|
const idToNickname = new Map();
|
|
961
967
|
for (const msg of messages) {
|
|
@@ -984,7 +990,7 @@ class AnalysisService extends koishi_1.Service {
|
|
|
984
990
|
'';
|
|
985
991
|
if (realName)
|
|
986
992
|
quote.sender = realName;
|
|
987
|
-
else if (isOpenId(quote.sender)
|
|
993
|
+
else if (isOpenId(quote.sender))
|
|
988
994
|
quote.sender = '群友';
|
|
989
995
|
if (!quote.avatar) {
|
|
990
996
|
quote.avatar =
|
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.
|
|
4
|
+
"version": "1.5.9",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.mjs",
|
|
7
7
|
"typings": "lib/index.d.ts",
|
|
@@ -50,3 +50,5 @@
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
+
|
|
54
|
+
|