koishi-plugin-chat-analyse 1.4.3 → 1.4.5
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/index.js +3 -13
- package/package.json +2 -3
package/lib/index.js
CHANGED
|
@@ -1783,11 +1783,6 @@ var Renderer = class {
|
|
|
1783
1783
|
if (!words?.length) return;
|
|
1784
1784
|
const wordsJson = JSON.stringify(words);
|
|
1785
1785
|
const selectedPalette = this.COLOR_PALETTES[Math.floor(Math.random() * this.COLOR_PALETTES.length)];
|
|
1786
|
-
const weights = words.map((w) => w[1]);
|
|
1787
|
-
const maxWeight = Math.max(...weights, 1);
|
|
1788
|
-
const minWeight = Math.min(...weights);
|
|
1789
|
-
const MAX_FONT_SIZE = 64;
|
|
1790
|
-
const MIN_FONT_SIZE = 4;
|
|
1791
1786
|
const cardHtml = `
|
|
1792
1787
|
<div class="container">
|
|
1793
1788
|
<div class="header">
|
|
@@ -1801,11 +1796,6 @@ var Renderer = class {
|
|
|
1801
1796
|
const palette = ${JSON.stringify(selectedPalette)};
|
|
1802
1797
|
WordCloud(document.getElementById('wordcloud-container'), {
|
|
1803
1798
|
fontFamily: '"Noto Sans CJK SC", "Arial", sans-serif',
|
|
1804
|
-
weightFactor: (size) => {
|
|
1805
|
-
if (${maxWeight} === ${minWeight}) return (${MIN_FONT_SIZE} + ${MAX_FONT_SIZE}) / 2;
|
|
1806
|
-
const normalizedWeight = (size - ${minWeight}) / (${maxWeight} - ${minWeight});
|
|
1807
|
-
return ${MIN_FONT_SIZE} + normalizedWeight * (${MAX_FONT_SIZE} - ${MIN_FONT_SIZE});
|
|
1808
|
-
},
|
|
1809
1799
|
color: (word, weight, fontSize, distance, theta) => {
|
|
1810
1800
|
return palette[Math.floor(Math.random() * palette.length)];
|
|
1811
1801
|
},
|
|
@@ -1813,9 +1803,9 @@ var Renderer = class {
|
|
|
1813
1803
|
shape: 'square',
|
|
1814
1804
|
gridSize: 1,
|
|
1815
1805
|
ellipticity: 1,
|
|
1816
|
-
rotateRatio:
|
|
1817
|
-
minRotation:
|
|
1818
|
-
maxRotation: Math.PI /
|
|
1806
|
+
rotateRatio: 0.5,
|
|
1807
|
+
minRotation: Math.PI / 2,
|
|
1808
|
+
maxRotation: Math.PI / 2,
|
|
1819
1809
|
backgroundColor: 'transparent',
|
|
1820
1810
|
clearCanvas: true,
|
|
1821
1811
|
shuffle: true,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-chat-analyse",
|
|
3
3
|
"description": "强大而全面的聊天数据分析插件。支持多维度统计(命令、发言、消息类型、活跃度),可生成发言排行、词云图,并提供完善的数据管理。",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.5",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Yis_Rime <yis_rime@outlook.com>"
|
|
7
7
|
],
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"license": "AGPL-3.0-only",
|
|
20
|
-
"scripts": {},
|
|
21
20
|
"keywords": [
|
|
22
21
|
"chatbot",
|
|
23
22
|
"koishi",
|
|
@@ -36,7 +35,7 @@
|
|
|
36
35
|
"koishi-plugin-puppeteer": "^3.5.2"
|
|
37
36
|
},
|
|
38
37
|
"peerDependencies": {
|
|
39
|
-
"koishi": "4.18.8"
|
|
38
|
+
"koishi": "^4.18.8"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
41
|
"@node-rs/jieba": "^2.0.1"
|