koishi-plugin-group-analysis-mx 1.0.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.
Files changed (94) hide show
  1. package/lib/config.d.ts +53 -0
  2. package/lib/config.d.ts.map +1 -0
  3. package/lib/config.js +376 -0
  4. package/lib/config.js.map +1 -0
  5. package/lib/cron.d.ts +8 -0
  6. package/lib/cron.d.ts.map +1 -0
  7. package/lib/cron.js +62 -0
  8. package/lib/cron.js.map +1 -0
  9. package/lib/index.d.ts +6 -0
  10. package/lib/index.d.ts.map +1 -0
  11. package/lib/index.js +51 -0
  12. package/lib/index.js.map +1 -0
  13. package/lib/onebot/cqcode.d.ts +14 -0
  14. package/lib/onebot/cqcode.d.ts.map +1 -0
  15. package/lib/onebot/cqcode.js +92 -0
  16. package/lib/onebot/cqcode.js.map +1 -0
  17. package/lib/plugin.d.ts +4 -0
  18. package/lib/plugin.d.ts.map +1 -0
  19. package/lib/plugin.js +41 -0
  20. package/lib/plugin.js.map +1 -0
  21. package/lib/plugins/command.d.ts +9 -0
  22. package/lib/plugins/command.d.ts.map +1 -0
  23. package/lib/plugins/command.js +196 -0
  24. package/lib/plugins/command.js.map +1 -0
  25. package/lib/service/analysis.d.ts +48 -0
  26. package/lib/service/analysis.d.ts.map +1 -0
  27. package/lib/service/analysis.js +714 -0
  28. package/lib/service/analysis.js.map +1 -0
  29. package/lib/service/llm.d.ts +43 -0
  30. package/lib/service/llm.d.ts.map +1 -0
  31. package/lib/service/llm.js +160 -0
  32. package/lib/service/llm.js.map +1 -0
  33. package/lib/service/message.d.ts +55 -0
  34. package/lib/service/message.d.ts.map +1 -0
  35. package/lib/service/message.js +527 -0
  36. package/lib/service/message.js.map +1 -0
  37. package/lib/service/renderer.d.ts +23 -0
  38. package/lib/service/renderer.d.ts.map +1 -0
  39. package/lib/service/renderer.js +298 -0
  40. package/lib/service/renderer.js.map +1 -0
  41. package/lib/skins/anime.d.ts +19 -0
  42. package/lib/skins/anime.d.ts.map +1 -0
  43. package/lib/skins/anime.js +138 -0
  44. package/lib/skins/anime.js.map +1 -0
  45. package/lib/skins/art.d.ts +19 -0
  46. package/lib/skins/art.d.ts.map +1 -0
  47. package/lib/skins/art.js +146 -0
  48. package/lib/skins/art.js.map +1 -0
  49. package/lib/skins/index.d.ts +50 -0
  50. package/lib/skins/index.d.ts.map +1 -0
  51. package/lib/skins/index.js +84 -0
  52. package/lib/skins/index.js.map +1 -0
  53. package/lib/skins/md3.d.ts +19 -0
  54. package/lib/skins/md3.d.ts.map +1 -0
  55. package/lib/skins/md3.js +147 -0
  56. package/lib/skins/md3.js.map +1 -0
  57. package/lib/skins/newspaper.d.ts +19 -0
  58. package/lib/skins/newspaper.d.ts.map +1 -0
  59. package/lib/skins/newspaper.js +141 -0
  60. package/lib/skins/newspaper.js.map +1 -0
  61. package/lib/skins/scrapbook.d.ts +20 -0
  62. package/lib/skins/scrapbook.d.ts.map +1 -0
  63. package/lib/skins/scrapbook.js +207 -0
  64. package/lib/skins/scrapbook.js.map +1 -0
  65. package/lib/skins/types.d.ts +69 -0
  66. package/lib/skins/types.d.ts.map +1 -0
  67. package/lib/skins/types.js +12 -0
  68. package/lib/skins/types.js.map +1 -0
  69. package/lib/types.d.ts +170 -0
  70. package/lib/types.d.ts.map +1 -0
  71. package/lib/types.js +3 -0
  72. package/lib/types.js.map +1 -0
  73. package/lib/utils.d.ts +55 -0
  74. package/lib/utils.d.ts.map +1 -0
  75. package/lib/utils.js +334 -0
  76. package/lib/utils.js.map +1 -0
  77. package/package.json +48 -0
  78. package/resources/anime/css/template_group.css +470 -0
  79. package/resources/anime/images/decoration_br.svg +19 -0
  80. package/resources/anime/images/decoration_tl.svg +24 -0
  81. package/resources/anime/template_group.html +108 -0
  82. package/resources/anime/template_user.html +99 -0
  83. package/resources/art/css/template_group.css +484 -0
  84. package/resources/art/template_group.html +77 -0
  85. package/resources/art/template_user.html +63 -0
  86. package/resources/md3/css/template_group.css +880 -0
  87. package/resources/md3/template_group.html +189 -0
  88. package/resources/md3/template_user.html +175 -0
  89. package/resources/newspaper/css/template_group.css +568 -0
  90. package/resources/newspaper/template_group.html +133 -0
  91. package/resources/newspaper/template_user.html +119 -0
  92. package/resources/scrapbook/css/style.css +1094 -0
  93. package/resources/scrapbook/template_group.html +115 -0
  94. package/resources/scrapbook/template_user.html +119 -0
@@ -0,0 +1,189 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="color-scheme" content="light dark" />
7
+ <title>群聊分析报告</title>
8
+ <link rel="stylesheet" href="./css/template_group.css" />
9
+ <script src="https://cdnjs.onmicrosoft.cn/ajax/libs/color-thief/2.6.0/color-thief.umd.js"></script>
10
+ <script type="importmap">
11
+ {
12
+ "imports": {
13
+ "@material/material-color-utilities": "https://npm.onmicrosoft.cn/@materialx/material-color-utilities@0.4.8"
14
+ }
15
+ }
16
+ </script>
17
+ </head>
18
+ <body>
19
+ <img id="dynamic-color-source" src="${dynamicAvatarUrl}" alt="" />
20
+ <div class="container">
21
+ <div class="header">
22
+ <h1>群聊分析报告</h1>
23
+ <div class="sub-title">${groupName} | ${analysisDate}</div>
24
+ </div>
25
+
26
+ <div class="summary">
27
+ <div class="summary-item">
28
+ <div class="label">总消息数</div>
29
+ <div class="value">${totalMessages}</div>
30
+ </div>
31
+ <div class="summary-item">
32
+ <div class="label">参与人数</div>
33
+ <div class="value">${totalParticipants}</div>
34
+ </div>
35
+ <div class="summary-item">
36
+ <div class="label">总字数</div>
37
+ <div class="value">${totalChars}</div>
38
+ </div>
39
+ <div class="summary-item">
40
+ <div class="label">最活跃时段</div>
41
+ <div class="value">${mostActivePeriod}</div>
42
+ </div>
43
+ </div>
44
+
45
+ <div class="section-title">龙王榜</div>
46
+ <div class="card-grid two-columns">${userStats}</div>
47
+
48
+ <div class="section-title">群友称号</div>
49
+ <div class="card-grid two-columns">${userTitles}</div>
50
+
51
+ <div class="section-title">热门话题</div>
52
+ <div class="card-grid">${topics}</div>
53
+
54
+ <div class="section-title">本群圣经</div>
55
+ <div class="card-grid">${goldenQuotes}</div>
56
+
57
+ <div class="section-title">24小时活跃分布</div>
58
+ ${activeHoursChart}
59
+
60
+ <footer>由 Koishi 强力驱动</footer>
61
+ </div>
62
+
63
+ <script type="module">
64
+ import * as material_color_utilities from '@material/material-color-utilities'
65
+
66
+ const colorThief = new ColorThief()
67
+ const {
68
+ themeFromSourceColor,
69
+ argbFromRgb,
70
+ Hct,
71
+ DynamicScheme,
72
+ SpecVersion,
73
+ Variant
74
+ } = material_color_utilities
75
+
76
+ const body = document.body
77
+ const root = document.documentElement
78
+ const themeSetting = '${theme}'
79
+ const defaultSourceColor = [103, 80, 164]
80
+
81
+ function applyTheme(themeName) {
82
+ body.className = themeName + '-theme'
83
+ }
84
+
85
+ function setCssVariable(variable, value) {
86
+ root.style.setProperty(variable, value)
87
+ }
88
+
89
+ function applyDynamicColors(color) {
90
+ try {
91
+ const isDark = body.classList.contains('dark-theme')
92
+ const sourceArgb = argbFromRgb(color[0], color[1], color[2])
93
+
94
+ const scheme = DynamicScheme.from({
95
+ isDark,
96
+ specVersion: SpecVersion.SPEC_2025,
97
+ // variant: Variant.EXPRESSIVE,
98
+ sourceColorHct: Hct.fromInt(sourceArgb)
99
+ })
100
+
101
+ const tokenMap = {
102
+ primary: 'primary',
103
+ 'on-primary': 'onPrimary',
104
+ 'primary-container': 'primaryContainer',
105
+ 'on-primary-container': 'onPrimaryContainer',
106
+ secondary: 'secondary',
107
+ 'on-secondary': 'onSecondary',
108
+ 'secondary-container': 'secondaryContainer',
109
+ 'on-secondary-container': 'onSecondaryContainer',
110
+ tertiary: 'tertiary',
111
+ 'on-tertiary': 'onTertiary',
112
+ 'tertiary-container': 'tertiaryContainer',
113
+ 'on-tertiary-container': 'onTertiaryContainer',
114
+ error: 'error',
115
+ 'on-error': 'onError',
116
+ 'error-container': 'errorContainer',
117
+ 'on-error-container': 'onErrorContainer',
118
+ background: 'background',
119
+ 'on-background': 'onBackground',
120
+ surface: 'surface',
121
+ 'on-surface': 'onSurface',
122
+ 'surface-dim': 'surfaceDim',
123
+ 'surface-bright': 'surfaceBright',
124
+ 'surface-variant': 'surfaceVariant',
125
+ 'on-surface-variant': 'onSurfaceVariant',
126
+ outline: 'outline',
127
+ 'outline-variant': 'outlineVariant',
128
+ 'surface-container-lowest': 'surfaceContainerLowest',
129
+ 'surface-container-low': 'surfaceContainerLow',
130
+ 'surface-container': 'surfaceContainer',
131
+ 'surface-container-high': 'surfaceContainerHigh',
132
+ 'surface-container-highest': 'surfaceContainerHighest',
133
+ 'inverse-surface': 'inverseSurface',
134
+ 'inverse-on-surface': 'inverseOnSurface',
135
+ 'inverse-primary': 'inversePrimary',
136
+ scrim: 'scrim',
137
+ shadow: 'shadow'
138
+ }
139
+
140
+ Object.entries(tokenMap).forEach(([cssToken, md3Token]) => {
141
+ let colorValue = scheme[md3Token]
142
+ if (colorValue === undefined) return
143
+
144
+ const unsignedValue = colorValue >>> 0
145
+ const r = (unsignedValue >> 16) & 255
146
+ const g = (unsignedValue >> 8) & 255
147
+ const b = unsignedValue & 255
148
+
149
+ setCssVariable(
150
+ '--dynamic-' + cssToken,
151
+ 'rgb(' + r + ', ' + g + ', ' + b + ')'
152
+ )
153
+ })
154
+ } catch (error) {
155
+ console.error('Error applying dynamic colors:', error)
156
+ }
157
+ }
158
+
159
+ function init() {
160
+ if (themeSetting === 'auto') {
161
+ const hour = new Date().getHours()
162
+ const theme = hour >= 19 || hour < 6 ? 'dark' : 'light'
163
+ applyTheme(theme)
164
+ } else {
165
+ applyTheme(themeSetting)
166
+ }
167
+
168
+ const img = document.getElementById('dynamic-color-source')
169
+ img.setAttribute('crossOrigin', '')
170
+
171
+ try {
172
+ const palette = colorThief.getPalette(
173
+ img,
174
+ 5,
175
+ 10
176
+ )
177
+ const color =
178
+ palette[Math.floor(Math.random() * palette.length)]
179
+ applyDynamicColors(color)
180
+ } catch (e) {
181
+ console.error('Error extracting color:', e)
182
+ applyDynamicColors(defaultSourceColor)
183
+ }
184
+ }
185
+
186
+ init()
187
+ </script>
188
+ </body>
189
+ </html>
@@ -0,0 +1,175 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="color-scheme" content="light dark" />
7
+ <title>用户画像报告</title>
8
+ <link rel="stylesheet" href="./css/template_group.css" />
9
+ <script src="https://cdnjs.onmicrosoft.cn/ajax/libs/color-thief/2.6.0/color-thief.umd.js"></script>
10
+ <script type="importmap">
11
+ {
12
+ "imports": {
13
+ "@material/material-color-utilities": "https://npm.onmicrosoft.cn/@materialx/material-color-utilities@0.4.8"
14
+ }
15
+ }
16
+ </script>
17
+ </head>
18
+ <body>
19
+ <img id="dynamic-color-source" src="${dynamicAvatarUrl}" alt="" />
20
+ <div class="container">
21
+ <div class="header user-header">
22
+ <img src="${avatar}" alt="User Avatar" class="avatar-large" />
23
+ <h1>${username} 的用户画像</h1>
24
+ <div class="sub-title">数据生成于: ${analysisDate}</div>
25
+ </div>
26
+
27
+ <div class="section-title">个性摘要</div>
28
+ <div class="persona-summary">
29
+ <p>${summary}</p>
30
+ </div>
31
+
32
+ <div class="section-title">核心特质</div>
33
+ <div class="tag-container">${keyTraits}</div>
34
+
35
+ <div class="section-title">兴趣领域</div>
36
+ <div class="tag-container">${interests}</div>
37
+
38
+ <div class="section-title">沟通风格</div>
39
+ <div class="persona-block">
40
+ <p>${communicationStyle}</p>
41
+ </div>
42
+
43
+ <div class="section-title">事实依据</div>
44
+ ${evidence}
45
+
46
+ <footer>由 Koishi 强力驱动</footer>
47
+ </div>
48
+
49
+ <script type="module">
50
+ import * as material_color_utilities from '@material/material-color-utilities'
51
+
52
+ const colorThief = new ColorThief()
53
+ const {
54
+ themeFromSourceColor,
55
+ argbFromRgb,
56
+ Hct,
57
+ DynamicScheme,
58
+ SpecVersion,
59
+ Variant
60
+ } = material_color_utilities
61
+
62
+ const body = document.body
63
+ const root = document.documentElement
64
+ const themeSetting = '${theme}'
65
+ const defaultSourceColor = [103, 80, 164]
66
+
67
+ function applyTheme(themeName) {
68
+ body.className = themeName + '-theme'
69
+ }
70
+
71
+ function setCssVariable(variable, value) {
72
+ root.style.setProperty(variable, value)
73
+ }
74
+
75
+ function applyDynamicColors(color) {
76
+ try {
77
+ const isDark = body.classList.contains('dark-theme')
78
+ const sourceArgb = argbFromRgb(color[0], color[1], color[2])
79
+
80
+ const scheme = DynamicScheme.from({
81
+ isDark,
82
+ specVersion: SpecVersion.SPEC_2025,
83
+ // variant: Variant.EXPRESSIVE,
84
+ sourceColorHct: Hct.fromInt(sourceArgb)
85
+ })
86
+
87
+ const tokenMap = {
88
+ primary: 'primary',
89
+ 'on-primary': 'onPrimary',
90
+ 'primary-container': 'primaryContainer',
91
+ 'on-primary-container': 'onPrimaryContainer',
92
+ secondary: 'secondary',
93
+ 'on-secondary': 'onSecondary',
94
+ 'secondary-container': 'secondaryContainer',
95
+ 'on-secondary-container': 'onSecondaryContainer',
96
+ tertiary: 'tertiary',
97
+ 'on-tertiary': 'onTertiary',
98
+ 'tertiary-container': 'tertiaryContainer',
99
+ 'on-tertiary-container': 'onTertiaryContainer',
100
+ error: 'error',
101
+ 'on-error': 'onError',
102
+ 'error-container': 'errorContainer',
103
+ 'on-error-container': 'onErrorContainer',
104
+ background: 'background',
105
+ 'on-background': 'onBackground',
106
+ surface: 'surface',
107
+ 'on-surface': 'onSurface',
108
+ 'surface-dim': 'surfaceDim',
109
+ 'surface-bright': 'surfaceBright',
110
+ 'surface-variant': 'surfaceVariant',
111
+ 'on-surface-variant': 'onSurfaceVariant',
112
+ outline: 'outline',
113
+ 'outline-variant': 'outlineVariant',
114
+ 'surface-container-lowest': 'surfaceContainerLowest',
115
+ 'surface-container-low': 'surfaceContainerLow',
116
+ 'surface-container': 'surfaceContainer',
117
+ 'surface-container-high': 'surfaceContainerHigh',
118
+ 'surface-container-highest': 'surfaceContainerHighest',
119
+ 'inverse-surface': 'inverseSurface',
120
+ 'inverse-on-surface': 'inverseOnSurface',
121
+ 'inverse-primary': 'inversePrimary',
122
+ scrim: 'scrim',
123
+ shadow: 'shadow'
124
+ }
125
+
126
+ Object.entries(tokenMap).forEach(([cssToken, md3Token]) => {
127
+ let colorValue = scheme[md3Token]
128
+ if (colorValue === undefined) return
129
+
130
+ const unsignedValue = colorValue >>> 0
131
+ const r = (unsignedValue >> 16) & 255
132
+ const g = (unsignedValue >> 8) & 255
133
+ const b = unsignedValue & 255
134
+
135
+ setCssVariable(
136
+ '--dynamic-' + cssToken,
137
+ 'rgb(' + r + ', ' + g + ', ' + b + ')'
138
+ )
139
+ })
140
+ } catch (error) {
141
+ console.error('Error applying dynamic colors:', error)
142
+ }
143
+ }
144
+
145
+ function init() {
146
+ if (themeSetting === 'auto') {
147
+ const hour = new Date().getHours()
148
+ const theme = hour >= 19 || hour < 6 ? 'dark' : 'light'
149
+ applyTheme(theme)
150
+ } else {
151
+ applyTheme(themeSetting)
152
+ }
153
+
154
+ const img = document.getElementById('dynamic-color-source')
155
+ img.setAttribute('crossOrigin', '')
156
+
157
+ try {
158
+ const palette = colorThief.getPalette(
159
+ img,
160
+ 5,
161
+ 10
162
+ )
163
+ const color =
164
+ palette[Math.floor(Math.random() * palette.length)]
165
+ applyDynamicColors(color)
166
+ } catch (e) {
167
+ console.error('Error extracting color:', e)
168
+ applyDynamicColors(defaultSourceColor)
169
+ }
170
+ }
171
+
172
+ init()
173
+ </script>
174
+ </body>
175
+ </html>