@nestim/koishi-plugin-qqgm-webui 0.2.23 → 0.3.0
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/CHANGELOG.md +36 -0
- package/README.md +39 -56
- package/index.js +170 -11
- package/lib/bot.js +44 -0
- package/lib/data.js +49 -8
- package/lib/logbuf.js +79 -0
- package/lib/plugin-config.js +236 -0
- package/package.json +33 -29
- package/public/app.js +815 -187
- package/public/index.html +60 -145
- package/public/styles.css +89 -19
package/public/index.html
CHANGED
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
|
10
10
|
<div class="app">
|
|
11
|
-
<aside class="sidebar">
|
|
11
|
+
<aside class="sidebar" id="sidebar">
|
|
12
12
|
<div class="brand">
|
|
13
13
|
<div class="brand-mark">Q</div>
|
|
14
14
|
<div class="brand-text">
|
|
15
15
|
<strong>QQGM</strong>
|
|
16
16
|
<span>AI OPS</span>
|
|
17
17
|
</div>
|
|
18
|
+
<button class="nav-close" id="navClose" title="关闭菜单" aria-label="关闭菜单">✕</button>
|
|
18
19
|
</div>
|
|
19
20
|
|
|
20
21
|
<nav class="nav">
|
|
@@ -25,7 +26,6 @@
|
|
|
25
26
|
<button class="nav-item" data-page="plugins">
|
|
26
27
|
<svg viewBox="0 0 24 24"><path d="M9 3h6v3h3a2 2 0 0 1 2 2v3h-3a3 3 0 1 0 0 6h3v3a2 2 0 0 1-2 2h-3v-3a3 3 0 1 0-6 0v3H6a2 2 0 0 1-2-2v-3H7a3 3 0 1 0 0-6H4V8a2 2 0 0 1 2-2h3V3Z"/></svg>
|
|
27
28
|
<span>插件</span>
|
|
28
|
-
<em class="nav-dot"></em>
|
|
29
29
|
</button>
|
|
30
30
|
<button class="nav-item" data-page="monitor">
|
|
31
31
|
<svg viewBox="0 0 24 24"><path d="M4 19V5m0 14h16M8 16l3-5 3 2 4-7"/></svg>
|
|
@@ -52,26 +52,27 @@
|
|
|
52
52
|
</nav>
|
|
53
53
|
|
|
54
54
|
<div class="sidebar-footer">
|
|
55
|
-
<div class="sys-line"><span class="pulse"></span
|
|
56
|
-
<div class="sys-meta">Koishi
|
|
55
|
+
<div class="sys-line"><span class="pulse" id="sysPulse"></span><span id="sysOnline">系统状态</span> <b id="sysBots">-</b></div>
|
|
56
|
+
<div class="sys-meta" id="sysMeta">Koishi · 读取中</div>
|
|
57
57
|
</div>
|
|
58
58
|
</aside>
|
|
59
|
+
<div class="sidebar-backdrop" id="sidebarBackdrop" hidden></div>
|
|
59
60
|
|
|
60
61
|
<main class="main">
|
|
61
62
|
<header class="topbar">
|
|
62
|
-
<div class="
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
<div class="topbar-left">
|
|
64
|
+
<button class="menu-btn" id="menuBtn" title="打开菜单" aria-label="打开菜单">
|
|
65
|
+
<svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16"/></svg>
|
|
66
|
+
</button>
|
|
67
|
+
<div class="crumb">
|
|
68
|
+
<span class="crumb-muted">QQGM</span>
|
|
69
|
+
<span class="crumb-sep">/</span>
|
|
70
|
+
<strong id="pageTitle">总览</strong>
|
|
71
|
+
</div>
|
|
66
72
|
</div>
|
|
67
73
|
<div class="top-actions">
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
<input id="globalSearch" placeholder="搜索插件、群号、trace…" />
|
|
71
|
-
</label>
|
|
72
|
-
<span class="pill online"><i></i> Bot 在线</span>
|
|
73
|
-
<button class="icon-btn" title="刷新">⟳</button>
|
|
74
|
-
<button class="icon-btn" title="通知">◌</button>
|
|
74
|
+
<span class="pill" id="botStatus" title="Bot 连接状态"><i></i><b>检查中</b></span>
|
|
75
|
+
<button class="icon-btn" id="refreshData" title="刷新数据">⟳</button>
|
|
75
76
|
</div>
|
|
76
77
|
</header>
|
|
77
78
|
|
|
@@ -80,13 +81,12 @@
|
|
|
80
81
|
<div id="overview-monitor">
|
|
81
82
|
<div class="page-head">
|
|
82
83
|
<div>
|
|
83
|
-
<h1>总览 <span class="proto-tag"
|
|
84
|
+
<h1>总览 <span class="proto-tag">实时</span></h1>
|
|
84
85
|
<p>今天 12-02 · 数据来自 qqgm-monitor SQLite</p>
|
|
85
86
|
</div>
|
|
86
87
|
<div class="head-actions">
|
|
87
|
-
<button class="
|
|
88
|
-
<button class="btn
|
|
89
|
-
<button class="btn primary" data-toast="已刷新(原型为 mock 数据)">刷新数据</button>
|
|
88
|
+
<button class="btn ghost" id="exportSnapshot">导出快照</button>
|
|
89
|
+
<button class="btn primary" id="refreshOverview">刷新数据</button>
|
|
90
90
|
</div>
|
|
91
91
|
</div>
|
|
92
92
|
|
|
@@ -120,11 +120,11 @@
|
|
|
120
120
|
<div class="grid two">
|
|
121
121
|
<article class="card chart-card">
|
|
122
122
|
<div class="card-head">
|
|
123
|
-
<div><h2>调用趋势</h2><p>最近 7 天 · 调用次数 / token</p></div>
|
|
124
|
-
<select class="select tiny"><option>最近 7 天</option><option>最近 30 天</option></select>
|
|
123
|
+
<div><h2>调用趋势</h2><p id="trendSub">最近 7 天 · 调用次数 / token</p></div>
|
|
124
|
+
<select class="select tiny" id="trendRange"><option value="7">最近 7 天</option><option value="30">最近 30 天</option></select>
|
|
125
125
|
</div>
|
|
126
126
|
<div class="chart-legend"><span><i class="dot blue"></i>调用</span><span><i class="dot cyan"></i>token</span></div>
|
|
127
|
-
<svg class="line-chart" viewBox="0 0 720 210" preserveAspectRatio="none">
|
|
127
|
+
<svg class="line-chart" id="trendChart" viewBox="0 0 720 210" preserveAspectRatio="none">
|
|
128
128
|
<defs>
|
|
129
129
|
<linearGradient id="g1" x1="0" x2="0" y1="0" y2="1"><stop offset="0" stop-color="#5b8def" stop-opacity=".22"/><stop offset="1" stop-color="#5b8def" stop-opacity="0"/></linearGradient>
|
|
130
130
|
</defs>
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
<path class="line cyan dashed" d="M0 185 C70 175 110 180 160 150 S240 155 290 130 S380 150 430 110 S520 130 570 95 S660 90 720 70"/>
|
|
135
135
|
<g class="dots"><circle cx="130" cy="120" r="3"/><circle cx="260" cy="110" r="3"/><circle cx="390" cy="70" r="3"/><circle cx="520" cy="80" r="3"/><circle cx="660" cy="50" r="3"/></g>
|
|
136
136
|
</svg>
|
|
137
|
-
<div class="axis"><span>11-26</span><span>11-27</span><span>11-28</span><span>11-29</span><span>11-30</span><span>12-01</span><span>12-02</span></div>
|
|
137
|
+
<div class="axis" id="trendAxis"><span>11-26</span><span>11-27</span><span>11-28</span><span>11-29</span><span>11-30</span><span>12-01</span><span>12-02</span></div>
|
|
138
138
|
</article>
|
|
139
139
|
|
|
140
140
|
<article class="card">
|
|
@@ -173,13 +173,12 @@
|
|
|
173
173
|
|
|
174
174
|
<article class="card plugins-mini">
|
|
175
175
|
<div class="card-head">
|
|
176
|
-
<div><h2>附属插件</h2><p
|
|
176
|
+
<div><h2>附属插件</h2><p id="pluginMiniCount">自动识别</p></div>
|
|
177
177
|
<button class="link-btn" data-nav="plugins">管理 →</button>
|
|
178
178
|
</div>
|
|
179
|
-
<div
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
<div class="plugin-line"><span class="plugin-ico purple">P</span><div><b>qqgm-private</b><small>私聊 · 1.0.3</small></div><i class="on"></i></div>
|
|
179
|
+
<div id="pluginMiniList">
|
|
180
|
+
<div class="plugin-line"><span class="plugin-ico blue">M</span><div><b>qqgm-monitor</b><small>监控</small></div><i class="on"></i></div>
|
|
181
|
+
</div>
|
|
183
182
|
</article>
|
|
184
183
|
</div>
|
|
185
184
|
<div class="overview-meta">@nestim/koishi-plugin-qq-group-manager v1.6.0 · 作者 Miseat · 监控 1.0.4</div>
|
|
@@ -194,7 +193,7 @@
|
|
|
194
193
|
<button class="btn primary" id="installMonitor">一键安装监控</button>
|
|
195
194
|
<a class="btn ghost" href="https://github.com/Miseat/koishi-plugin-qqgm-monitor" target="_blank" rel="noreferrer">GitHub</a>
|
|
196
195
|
<a class="btn ghost" href="https://www.npmjs.com/package/@nestim/koishi-plugin-qqgm-monitor" target="_blank" rel="noreferrer">npm</a>
|
|
197
|
-
<button class="link-btn" id="demoMonitor">预览:已装监控 →</button>
|
|
196
|
+
<button class="link-btn" id="demoMonitor" hidden>预览:已装监控 →</button>
|
|
198
197
|
</div>
|
|
199
198
|
</div>
|
|
200
199
|
|
|
@@ -232,9 +231,9 @@
|
|
|
232
231
|
<section class="page" id="page-plugins">
|
|
233
232
|
<div class="page-head">
|
|
234
233
|
<div><h1>插件</h1><p>自动扫描 koishi.yml 与 node_modules,只显示附属插件</p></div>
|
|
235
|
-
<button class="btn primary"
|
|
234
|
+
<button class="btn primary" id="rescanPlugins">重新扫描</button>
|
|
236
235
|
</div>
|
|
237
|
-
<div class="plugin-grid">
|
|
236
|
+
<div class="plugin-grid" id="pluginGrid">
|
|
238
237
|
<article class="plugin-card">
|
|
239
238
|
<div class="plugin-card-top"><span class="plugin-ico blue big">M</span><div><h3>qqgm-monitor</h3><p>@nestim/koishi-plugin-qqgm-monitor</p></div><span class="status ok">运行中</span></div>
|
|
240
239
|
<div class="plugin-meta"><span>v1.0.4</span><span>6 个事件</span><span>SQLite</span></div>
|
|
@@ -274,43 +273,37 @@
|
|
|
274
273
|
<section class="page" id="page-monitor">
|
|
275
274
|
<div class="page-head">
|
|
276
275
|
<div><h1>监控</h1><p>总失败率与分群失败率;延迟按回复消息拆阶段</p></div>
|
|
277
|
-
<div class="head-actions"><select class="select"><option>今日</option><option>最近 7 天</option></select><button class="btn ghost"
|
|
276
|
+
<div class="head-actions"><select class="select" id="monitorRange"><option value="1">今日</option><option value="7">最近 7 天</option></select><button class="btn ghost" id="monitorExport">导出 JSON</button></div>
|
|
278
277
|
</div>
|
|
279
278
|
<div class="metrics three">
|
|
280
|
-
<article class="metric"><div class="metric-top"><span>调用</span><em class="trend">今日</em></div><div class="metric-value">
|
|
281
|
-
<article class="metric"><div class="metric-top"><span>失败率</span><em class="trend danger">
|
|
282
|
-
<article class="metric"><div class="metric-top"><span>账户消耗</span><em class="trend"
|
|
279
|
+
<article class="metric"><div class="metric-top"><span>调用</span><em class="trend" id="monitorRangeLabel">今日</em></div><div class="metric-value" id="monitorCalls">0</div><div class="metric-foot" id="monitorTokens">Token 0 · 成本未配置</div></article>
|
|
280
|
+
<article class="metric"><div class="metric-top"><span>失败率</span><em class="trend danger" id="monitorFailRate">0%</em></div><div class="metric-value" id="monitorFail">0 <small>次</small></div><div class="metric-foot" id="monitorFailFoot">解析 0 · 超时 0 · 其他 0</div></article>
|
|
281
|
+
<article class="metric"><div class="metric-top"><span>账户消耗</span><em class="trend">账户</em></div><div class="metric-value" id="monitorCost">—</div><div class="metric-foot" id="monitorBalance">余额未知</div></article>
|
|
283
282
|
</div>
|
|
284
283
|
<div class="grid two">
|
|
285
284
|
<article class="card">
|
|
286
|
-
<div class="card-head"><div><h2>分群失败率</h2><p>延迟不按群拆,失败率按群看</p></div><span class="badge soft">
|
|
285
|
+
<div class="card-head"><div><h2>分群失败率</h2><p>延迟不按群拆,失败率按群看</p></div><span class="badge soft" id="monitorGroupCount">0 个群</span></div>
|
|
287
286
|
<table class="table compact">
|
|
288
287
|
<thead><tr><th>群</th><th>调用</th><th>失败</th><th>失败率</th><th>Token</th></tr></thead>
|
|
289
|
-
<tbody><tr><td
|
|
290
|
-
<tr><td>343850842</td><td>2</td><td>0</td><td><span class="status ok">0.0%</span></td><td>6.6k</td></tr>
|
|
291
|
-
<tr><td>869328396</td><td>1</td><td>0</td><td><span class="status ok">0.0%</span></td><td>3.3k</td></tr></tbody>
|
|
288
|
+
<tbody id="monitorGroups"><tr><td colspan="5">暂无数据</td></tr></tbody>
|
|
292
289
|
</table>
|
|
293
290
|
</article>
|
|
294
291
|
<article class="card">
|
|
295
292
|
<div class="card-head"><div><h2>延迟分位</h2><p>P50 / P95 / P99</p></div></div>
|
|
296
|
-
<div class="p95-grid">
|
|
297
|
-
<div><span>E2E</span><b
|
|
298
|
-
<div><span>模型</span><b
|
|
299
|
-
<div><span>渲染</span><b
|
|
300
|
-
<div><span>发送</span><b
|
|
293
|
+
<div class="p95-grid" id="monitorLatency">
|
|
294
|
+
<div><span>E2E</span><b>—</b><small>收到→发出</small></div>
|
|
295
|
+
<div><span>模型</span><b>—</b><small>API 调用</small></div>
|
|
296
|
+
<div><span>渲染</span><b>—</b><small>过滤/表情</small></div>
|
|
297
|
+
<div><span>发送</span><b>—</b><small>OneBot</small></div>
|
|
301
298
|
</div>
|
|
302
299
|
<p class="hint">P50=一半请求比它快;P95=95% 比它快;P99=99% 比它快。</p>
|
|
303
300
|
</article>
|
|
304
301
|
</div>
|
|
305
302
|
<article class="card">
|
|
306
|
-
<div class="card-head"><div><h2>调用明细</h2><p
|
|
303
|
+
<div class="card-head"><div><h2>调用明细</h2><p>最近 8 次调用</p></div><label class="search small-search"><svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="6"/><path d="m16 16 4 4"/></svg><input id="monitorSearch" placeholder="过滤群号 / 状态" /></label></div>
|
|
307
304
|
<table class="table">
|
|
308
305
|
<thead><tr><th>时间</th><th>Trace</th><th>来源</th><th>模型</th><th>入/出</th><th>耗时</th><th>状态</th></tr></thead>
|
|
309
|
-
<tbody>
|
|
310
|
-
<tr><td>19:02:41</td><td><code>m8k2p1</code></td><td>群 1103369527</td><td>deepseek-chat</td><td>2.1k / 320</td><td>3.0s</td><td><span class="status ok">成功</span></td></tr>
|
|
311
|
-
<tr><td>19:01:58</td><td><code>m8k2n4</code></td><td>群 1103369527</td><td>deepseek-chat</td><td>2.8k / 410</td><td>8.8s</td><td><span class="status ok">成功</span></td></tr>
|
|
312
|
-
<tr><td>18:58:12</td><td><code>m8k1x9</code></td><td>私聊</td><td>deepseek-chat</td><td>1.0k / 0</td><td>9.9s</td><td><span class="status fail">解析失败</span></td></tr>
|
|
313
|
-
</tbody>
|
|
306
|
+
<tbody id="monitorRecent"><tr><td colspan="7">暂无数据</td></tr></tbody>
|
|
314
307
|
</table>
|
|
315
308
|
</article>
|
|
316
309
|
</section>
|
|
@@ -361,113 +354,35 @@
|
|
|
361
354
|
</section>
|
|
362
355
|
|
|
363
356
|
<section class="page" id="page-config">
|
|
364
|
-
<div class="page-head"><div><h1>附属配置</h1><p
|
|
357
|
+
<div class="page-head"><div><h1>附属配置</h1><p>自动读取插件 Schema 与 koishi.yml;每个字段都有说明,保存前备份</p></div></div>
|
|
365
358
|
<div class="config-layout">
|
|
366
|
-
<aside class="card config-nav">
|
|
367
|
-
|
|
368
|
-
<button class="config-plugin active" data-config="monitor"><span class="plugin-ico blue">M</span><div><b>qqgm-monitor</b><small>监控 · 已安装</small></div></button>
|
|
369
|
-
<button class="config-plugin" data-config="meme"><span class="plugin-ico green">E</span><div><b>qqgm-meme</b><small>表情包 · 已安装</small></div></button>
|
|
370
|
-
<button class="config-plugin" data-config="chat"><span class="plugin-ico orange">S</span><div><b>qqgm-chat-style</b><small>聊天风格 · 已安装</small></div></button>
|
|
371
|
-
<button class="config-plugin" data-config="private"><span class="plugin-ico purple">P</span><div><b>qqgm-private</b><small>私聊 · 已安装</small></div></button>
|
|
372
|
-
<button class="config-plugin" data-config="webui"><span class="plugin-ico slate">W</span><div><b>qqgm-webui</b><small>本插件 · 已安装</small></div></button>
|
|
373
|
-
<button class="config-plugin" data-config="memory"><span class="plugin-ico muted">R</span><div><b>qqgm-memory</b><small>记忆管理 · 已安装</small></div></button>
|
|
374
|
-
</aside>
|
|
375
|
-
|
|
376
|
-
<div class="card config-form">
|
|
377
|
-
<div class="side-panel active" data-panel="monitor">
|
|
378
|
-
<div class="form-head"><div><h2>qqgm-monitor</h2><p>@nestim/koishi-plugin-qqgm-monitor · v1.0.4</p></div><span class="status ok">运行中</span></div>
|
|
379
|
-
<div class="form-section"><h3>采集</h3>
|
|
380
|
-
<label class="field"><span>启用监控</span><input type="checkbox" checked /></label>
|
|
381
|
-
<label class="field"><span>数据库文件</span><input value="data/qqgm-monitor.sqlite" /></label>
|
|
382
|
-
<label class="field"><span>明细保留天数</span><input type="number" value="30" /></label>
|
|
383
|
-
</div>
|
|
384
|
-
<div class="form-section"><h3>成本</h3>
|
|
385
|
-
<div class="field-row"><label class="field"><span>输入价格(元/百万)</span><input type="number" value="0" /></label><label class="field"><span>输出价格(元/百万)</span><input type="number" value="0" /></label></div>
|
|
386
|
-
<p class="hint">为 0 时显示“成本未配置”,不会显示成 ¥0。</p>
|
|
387
|
-
<label class="field"><span>余额查询厂家</span><select><option>auto(推荐)</option><option>deepseek</option><option>openrouter</option><option>moonshot</option><option>siliconflow</option><option>none</option></select></label>
|
|
388
|
-
</div>
|
|
389
|
-
<div class="form-foot"><span>保存前备份 koishi.yml</span><div><button class="btn ghost" data-toast="已还原(原型)">还原</button><button class="btn primary" data-toast="配置已保存(原型,不写盘)">保存</button></div></div>
|
|
390
|
-
</div>
|
|
391
|
-
|
|
392
|
-
<div class="side-panel" data-panel="meme">
|
|
393
|
-
<div class="form-head"><div><h2>qqgm-meme</h2><p>@nestim/koishi-plugin-qqgm-meme · v1.1.1</p></div><span class="status ok">运行中</span></div>
|
|
394
|
-
<div class="form-section"><h3>选择</h3>
|
|
395
|
-
<label class="field"><span>选择模式</span><select><option>hybrid 复合</option><option>candidates 候选</option><option>description 描述</option></select></label>
|
|
396
|
-
<label class="field"><span>候选数量</span><input type="number" value="3" /></label>
|
|
397
|
-
<label class="field"><span>追加概率</span><input type="number" value="0.4" step="0.05" /></label>
|
|
398
|
-
<label class="field"><span>最低匹配分</span><input type="number" value="1.2" step="0.1" /></label>
|
|
399
|
-
</div>
|
|
400
|
-
<div class="form-foot"><span>图库 274 张 · 目录 catalog.md</span><div><button class="btn primary" data-toast="配置已保存(原型)">保存</button></div></div>
|
|
401
|
-
</div>
|
|
402
|
-
|
|
403
|
-
<div class="side-panel" data-panel="chat">
|
|
404
|
-
<div class="form-head"><div><h2>qqgm-chat-style</h2><p>@nestim/koishi-plugin-qqgm-chat-style · v1.1.1</p></div><span class="status ok">运行中</span></div>
|
|
405
|
-
<div class="form-section"><h3>风格</h3>
|
|
406
|
-
<label class="field"><span>主风格</span><select><option>northern-netizen-chat</option></select></label>
|
|
407
|
-
<label class="field"><span>追加风格</span><select><option>naruto-mobile-chat</option></select></label>
|
|
408
|
-
<label class="field"><span>追加概率</span><input type="number" value="0.3" step="0.05" /></label>
|
|
409
|
-
</div>
|
|
410
|
-
<div class="form-foot"><span>分群配置 1 个</span><div><button class="btn primary" data-toast="配置已保存(原型)">保存</button></div></div>
|
|
411
|
-
</div>
|
|
412
|
-
|
|
413
|
-
<div class="side-panel" data-panel="private">
|
|
414
|
-
<div class="form-head"><div><h2>qqgm-private</h2><p>@nestim/koishi-plugin-qqgm-private · v1.0.3</p></div><span class="status ok">运行中</span></div>
|
|
415
|
-
<div class="form-section"><h3>私聊</h3>
|
|
416
|
-
<label class="field"><span>启用</span><input type="checkbox" checked /></label>
|
|
417
|
-
<label class="field"><span>回复间隔(秒)</span><input type="number" value="2" /></label>
|
|
418
|
-
<label class="field"><span>上下文字数</span><input type="number" value="20" /></label>
|
|
419
|
-
<label class="field"><span>主动私发</span><input type="checkbox" /></label>
|
|
420
|
-
</div>
|
|
421
|
-
<div class="form-foot"><span>复用主插件模型与风格</span><div><button class="btn primary" data-toast="配置已保存(原型)">保存</button></div></div>
|
|
422
|
-
</div>
|
|
423
|
-
|
|
424
|
-
<div class="side-panel" data-panel="webui">
|
|
425
|
-
<div class="form-head"><div><h2>qqgm-webui</h2><p>@nestim/koishi-plugin-qqgm-webui · v0.1.0</p></div><span class="status ok">本插件</span></div>
|
|
426
|
-
<div class="form-section"><h3>访问</h3>
|
|
427
|
-
<label class="field"><span>挂载路径</span><input value="/qqgm" /></label>
|
|
428
|
-
<label class="field"><span>访问令牌</span><input type="password" value="••••••••" /></label>
|
|
429
|
-
<label class="field"><span>允许非本机访问</span><input type="checkbox" /></label>
|
|
430
|
-
</div>
|
|
431
|
-
<div class="form-foot"><span>公网访问必须设置 token</span><div><button class="btn primary" data-toast="配置已保存(原型)">保存</button></div></div>
|
|
432
|
-
</div>
|
|
433
|
-
|
|
434
|
-
<div class="side-panel" data-panel="memory">
|
|
435
|
-
<div class="form-head"><div><h2>qqgm-memory</h2><p>@nestim/koishi-plugin-qqgm-memory · v1.0.0</p></div><span class="status ok">运行中</span></div>
|
|
436
|
-
<div class="form-section"><h3>数据库</h3>
|
|
437
|
-
<label class="field"><span>SQLite 文件</span><input value="data/qqgm-memory.sqlite" /></label>
|
|
438
|
-
<label class="field"><span>主插件记忆后端</span><input value="md(默认)" disabled /></label>
|
|
439
|
-
<p class="hint">主插件当前是 MD。把主插件 <code>memoryBackend</code> 改为 <code>sqlite</code> 后,本插件才接管数据;迁移前先备份 MD。</p>
|
|
440
|
-
</div>
|
|
441
|
-
<div class="form-section"><h3>迁移</h3>
|
|
442
|
-
<p class="hint">切到 SQLite 后执行 <code>memdb migrate</code> 导入 Memory_*.md;改回 md 可回滚。当前库 0 条。</p>
|
|
443
|
-
</div>
|
|
444
|
-
<div class="form-foot"><span>和主插件共用同一个 DB 文件</span><div><button class="btn ghost" data-toast="已还原(原型)">还原</button><button class="btn primary" data-toast="记忆配置已保存(原型)">保存</button></div></div>
|
|
445
|
-
</div>
|
|
446
|
-
</div>
|
|
359
|
+
<aside class="card config-nav" id="pluginConfigNav"><div class="schema-loading">读取插件…</div></aside>
|
|
360
|
+
<div class="card config-form" id="pluginConfigForm"><div class="schema-loading">选择一个插件</div></div>
|
|
447
361
|
</div>
|
|
448
362
|
</section>
|
|
449
363
|
|
|
450
364
|
<section class="page" id="page-logs">
|
|
451
|
-
<div class="page-head"><div><h1>日志</h1><p
|
|
365
|
+
<div class="page-head"><div><h1>日志</h1><p>进程内实时日志;默认保留最近 2000 行,可按级别和关键词过滤</p></div>
|
|
366
|
+
<div class="head-actions">
|
|
367
|
+
<label class="search"><svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="6"/><path d="m16 16 4 4"/></svg><input id="logSearch" placeholder="过滤关键词" /></label>
|
|
368
|
+
<button class="btn ghost" id="logPause">暂停</button>
|
|
369
|
+
</div>
|
|
370
|
+
</div>
|
|
452
371
|
<div class="card log-card">
|
|
453
|
-
<div class="log-toolbar"
|
|
454
|
-
|
|
455
|
-
<
|
|
456
|
-
<div class="log-line"><time>19:02:40.812</time><span class="lvl info">INFO</span><span class="src">nestim-qq-group-manager</span><p>[ai] reply sent trace=m8k2p1 e2e=3021ms</p></div>
|
|
457
|
-
<div class="log-line"><time>19:01:58.442</time><span class="lvl warn">WARN</span><span class="src">qqgm-monitor</span><p>model call slow: 8.8s (trace=m8k2n4 kind=reply)</p></div>
|
|
458
|
-
<div class="log-line"><time>18:58:12.108</time><span class="lvl error">ERROR</span><span class="src">nestim-qq-group-manager</span><p>[ai] reply failed: empty response (trace=m8k1x9)</p></div>
|
|
459
|
-
<div class="log-line"><time>18:55:03.771</time><span class="lvl info">INFO</span><span class="src">qqgm-meme</span><p>sent M0107 gist=干饭快乐 tags=干饭,白饭</p></div>
|
|
460
|
-
<div class="log-line"><time>18:51:47.529</time><span class="lvl info">INFO</span><span class="src">qqgm-monitor</span><p>memory.committed scope=group:1103369527 category=偏好 chars=42</p></div>
|
|
372
|
+
<div class="log-toolbar">
|
|
373
|
+
<div class="chips" id="logChips"><button class="chip active" data-level="all">全部</button><button class="chip" data-level="info">INFO</button><button class="chip" data-level="warn">WARN</button><button class="chip" data-level="error">ERROR</button></div>
|
|
374
|
+
<span class="log-meta" id="logMeta">读取中…</span>
|
|
461
375
|
</div>
|
|
376
|
+
<div class="log-view" id="logView"><div class="log-empty">暂无日志</div></div>
|
|
462
377
|
</div>
|
|
463
378
|
</section>
|
|
464
379
|
</div>
|
|
465
380
|
|
|
466
381
|
<footer class="statusbar">
|
|
467
|
-
<span><i class="pulse"></i>
|
|
468
|
-
<span>
|
|
469
|
-
<span
|
|
470
|
-
<span class="right"
|
|
382
|
+
<span><i class="pulse" id="statusPulse"></i> <span id="statusRoute">/qqgm</span></span>
|
|
383
|
+
<span id="statusBots">Bot -</span>
|
|
384
|
+
<span id="statusCalls">-</span>
|
|
385
|
+
<span class="right" id="statusRight">读取 Koishi 状态</span>
|
|
471
386
|
</footer>
|
|
472
387
|
</main>
|
|
473
388
|
</div>
|
package/public/styles.css
CHANGED
|
@@ -62,8 +62,14 @@ svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round
|
|
|
62
62
|
.user div:nth-child(2) { display: flex; flex-direction: column; line-height: 1.2; }
|
|
63
63
|
.user strong { font-size: 12px; color: #e8eefb; font-weight: 600; }
|
|
64
64
|
.user span { font-size: 10px; color: #71829c; margin-top: 3px; }
|
|
65
|
-
.icon-btn { width: 30px; height: 30px; border-radius: 8px; color: #8ea0ba; display: grid; place-items: center;
|
|
65
|
+
.icon-btn { width: 30px; height: 30px; border-radius: 8px; color: #8ea0ba; display: grid; place-items: center; }
|
|
66
66
|
.icon-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
|
|
67
|
+
.menu-btn { display: none; width: 34px; height: 34px; border-radius: 9px; color: #53637a; background: #fff; border: 1px solid var(--line); place-items: center; flex: 0 0 auto; }
|
|
68
|
+
.menu-btn svg { width: 18px; height: 18px; }
|
|
69
|
+
.menu-btn:hover { border-color: #c8d4e4; }
|
|
70
|
+
.nav-close { display: none; margin-left: auto; width: 28px; height: 28px; border-radius: 8px; color: #8fa0b9; background: rgba(255,255,255,.06); }
|
|
71
|
+
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
|
|
72
|
+
.sidebar-backdrop { display: none; }
|
|
67
73
|
|
|
68
74
|
/* main */
|
|
69
75
|
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
|
|
@@ -77,9 +83,13 @@ svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round
|
|
|
77
83
|
.search svg { width: 15px; height: 15px; color: #9aa8bb; }
|
|
78
84
|
.search input { border: 0; outline: 0; background: transparent; font-size: 12px; width: 100%; color: #3b4a60; }
|
|
79
85
|
.search input::placeholder { color: #aab5c5; }
|
|
80
|
-
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; border-radius: 20px; padding: 5px 10px; }
|
|
86
|
+
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; border-radius: 20px; padding: 5px 10px; background: #f1f4f8; color: #77869a; }
|
|
87
|
+
.pill b { font-weight: 600; }
|
|
81
88
|
.pill.online { color: #17845b; background: #e8f7f0; }
|
|
82
89
|
.pill.online i { width: 6px; height: 6px; background: #21b47b; border-radius: 50%; }
|
|
90
|
+
.pill.offline { color: #b23b3b; background: #fdeeee; }
|
|
91
|
+
.pill.offline i { width: 6px; height: 6px; background: #d9534f; border-radius: 50%; }
|
|
92
|
+
.pulse.off { background: #94a3b8; box-shadow: 0 0 0 4px rgba(148,163,184,.12); }
|
|
83
93
|
.top-actions .icon-btn { color: #7d8ba1; background: #fff; border: 1px solid var(--line); font-size: 15px; }
|
|
84
94
|
.content { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 26px 28px 34px; }
|
|
85
95
|
.page { display: none; animation: fade .18s ease; }
|
|
@@ -140,7 +150,8 @@ svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round
|
|
|
140
150
|
.line-chart .line.cyan { stroke: var(--cyan); }
|
|
141
151
|
.line-chart .dashed { stroke-dasharray: 4 4; opacity: .8; }
|
|
142
152
|
.line-chart .dots circle { fill: #fff; stroke: var(--blue); stroke-width: 2; }
|
|
143
|
-
.axis { display:
|
|
153
|
+
.axis { display: grid; grid-auto-flow: column; color: #a0adbe; font-size: 10px; padding: 0 2px; }
|
|
154
|
+
.axis span { text-align: center; overflow: hidden; white-space: nowrap; }
|
|
144
155
|
.latency-list { display: flex; flex-direction: column; gap: 13px; padding-top: 2px; }
|
|
145
156
|
.lat-row { display: grid; grid-template-columns: 82px 1fr 52px; align-items: center; gap: 10px; font-size: 11.5px; color: #5f6e83; }
|
|
146
157
|
.lat-row b { text-align: right; font-weight: 650; color: #2e3d53; }
|
|
@@ -148,6 +159,11 @@ svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round
|
|
|
148
159
|
.lat-bar i { display: block; height: 100%; border-radius: 4px; }
|
|
149
160
|
.lat-total { display: flex; justify-content: space-between; margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 12px; color: #718096; }
|
|
150
161
|
.lat-total b { font-size: 15px; color: #1c2a3d; }
|
|
162
|
+
.p95-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
|
|
163
|
+
.p95-grid > div { background: #f7f9fc; border: 1px solid #eef2f7; border-radius: 8px; padding: 9px 11px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
|
|
164
|
+
.p95-grid span { font-size: 10px; color: #8d9aab; }
|
|
165
|
+
.p95-grid b { font-size: 12px; color: #2f4058; overflow-wrap: anywhere; }
|
|
166
|
+
.p95-grid small { font-size: 9.5px; color: #a0adbe; }
|
|
151
167
|
.hint { font-size: 10.5px; color: #95a1b2; line-height: 1.55; margin: 12px 0 0; }
|
|
152
168
|
code { background: #f2f5f9; color: #55657d; border-radius: 4px; padding: 1px 4px; font-family: Consolas, monospace; font-size: 10.5px; }
|
|
153
169
|
|
|
@@ -161,9 +177,10 @@ code { background: #f2f5f9; color: #55657d; border-radius: 4px; padding: 1px 4px
|
|
|
161
177
|
.tag.private { color: #8a63c9; background: #f4efff; }
|
|
162
178
|
.tag.memory { color: #178c6a; background: #eaf8f2; }
|
|
163
179
|
.tag.soft { color: #6b7b90; background: #f1f4f8; }
|
|
164
|
-
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; border-radius: 5px; padding: 3px 6px; }
|
|
180
|
+
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; border-radius: 5px; padding: 3px 6px; white-space: nowrap; }
|
|
165
181
|
.status::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
|
|
166
182
|
.status.ok { color: #16875c; background: #eaf8f1; }
|
|
183
|
+
.status.warn { color: #a06a1a; background: #fff4de; }
|
|
167
184
|
.status.fail { color: #c4574d; background: #fdf0ee; }
|
|
168
185
|
.plugins-mini { display: flex; flex-direction: column; }
|
|
169
186
|
.plugin-line { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid #f2f5f9; }
|
|
@@ -172,6 +189,8 @@ code { background: #f2f5f9; color: #55657d; border-radius: 4px; padding: 1px 4px
|
|
|
172
189
|
.plugin-line b { font-size: 11.5px; font-weight: 600; color: #35445a; }
|
|
173
190
|
.plugin-line small { font-size: 10px; color: #95a2b4; margin-top: 2px; }
|
|
174
191
|
.plugin-line .on { width: 6px; height: 6px; border-radius: 50%; background: #2bb37d; margin-left: auto; }
|
|
192
|
+
.plugin-line .off { width: 6px; height: 6px; border-radius: 50%; background: #c3ccd9; margin-left: auto; }
|
|
193
|
+
.plugin-card .plugin-ico { width: 38px; height: 38px; border-radius: 10px; }
|
|
175
194
|
.plugin-ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: 0 0 auto; }
|
|
176
195
|
.plugin-ico.big { width: 38px; height: 38px; border-radius: 10px; font-size: 14px; }
|
|
177
196
|
.plugin-ico.blue { background: linear-gradient(135deg, #5b8def, #3f68d8); }
|
|
@@ -179,6 +198,9 @@ code { background: #f2f5f9; color: #55657d; border-radius: 4px; padding: 1px 4px
|
|
|
179
198
|
.plugin-ico.orange { background: linear-gradient(135deg, #f0ae5b, #dd8d2c); }
|
|
180
199
|
.plugin-ico.purple { background: linear-gradient(135deg, #a486e8, #7c5bc6); }
|
|
181
200
|
.plugin-ico.slate { background: linear-gradient(135deg, #60738d, #405067); }
|
|
201
|
+
.plugin-ico-svg svg, .group-ico svg { width: 15px; height: 15px; stroke: #fff; fill: none; }
|
|
202
|
+
.group-ico { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, #4f7df3, #6a5bd8); }
|
|
203
|
+
.plugin-ico.warn { background: linear-gradient(135deg, #f0ae5b, #dd8d2c); }
|
|
182
204
|
|
|
183
205
|
/* plugins page */
|
|
184
206
|
.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
|
|
@@ -250,10 +272,11 @@ code { background: #f2f5f9; color: #55657d; border-radius: 4px; padding: 1px 4px
|
|
|
250
272
|
.chip.active { background: #eef3ff; color: #3f68d8; }
|
|
251
273
|
.log-meta { font-size: 10px; color: #9aa7b8; }
|
|
252
274
|
.log-view { background: #0f1726; color: #c6d2e4; font-family: Consolas, "Cascadia Mono", monospace; font-size: 11px; line-height: 1.8; padding: 14px 16px; min-height: 420px; }
|
|
253
|
-
.log-line { display: grid; grid-template-columns:
|
|
275
|
+
.log-line { display: grid; grid-template-columns: 86px 52px 150px minmax(0, 1fr); gap: 6px; align-items: baseline; }
|
|
254
276
|
.log-line time { color: #5f718c; }
|
|
255
277
|
.log-line .src { color: #88a2c8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
256
|
-
.log-line p { margin: 0; color: #aebbd0; white-space:
|
|
278
|
+
.log-line p { margin: 0; color: #aebbd0; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
279
|
+
.log-empty { color: #6b7f9c; font-size: 11.5px; padding: 18px 4px; }
|
|
257
280
|
.lvl { font-size: 9px; letter-spacing: .04em; }
|
|
258
281
|
.lvl.info { color: #58c49b; } .lvl.warn { color: #e3ad55; } .lvl.error { color: #ef7f74; }
|
|
259
282
|
|
|
@@ -318,6 +341,15 @@ code { background: #f2f5f9; color: #55657d; border-radius: 4px; padding: 1px 4px
|
|
|
318
341
|
.schema-field-control > input:not([type=checkbox]), .schema-field-control > select { height: 36px; border: 1px solid #e2e8f1; border-radius: 8px; background: #fbfcfe; padding: 0 10px; font-size: 12px; color: #3b4b61; outline: none; }
|
|
319
342
|
.schema-field-control > textarea { border: 1px solid #e2e8f1; border-radius: 8px; background: #fbfcfe; padding: 9px 10px; font-size: 12px; color: #3b4b61; outline: none; resize: vertical; line-height: 1.65; font-family: inherit; }
|
|
320
343
|
.schema-field-control > textarea:focus, .schema-field-control > input:focus, .schema-field-control > select:focus { border-color: #9ab7ef; background: #fff; }
|
|
344
|
+
.secret-field { display: flex; gap: 7px; align-items: center; }
|
|
345
|
+
.secret-field input { flex: 1; min-width: 0; height: 36px; border: 1px solid #e2e8f1; border-radius: 8px; background: #fbfcfe; padding: 0 10px; font-size: 12px; color: #3b4b61; outline: none; font-family: Consolas, monospace; }
|
|
346
|
+
.secret-field input:focus { border-color: #9ab7ef; background: #fff; }
|
|
347
|
+
.eye-btn { width: 36px; height: 36px; flex: 0 0 auto; border: 1px solid #e2e8f1; border-radius: 8px; background: #fff; color: #7c8ca2; display: grid; place-items: center; }
|
|
348
|
+
.eye-btn:hover { border-color: #b9c9df; color: #4f7df3; }
|
|
349
|
+
.eye-btn svg { width: 17px; height: 17px; }
|
|
350
|
+
.sync-note { margin: 12px 0 0; padding: 9px 11px; border-radius: 8px; background: #fff8e8; border: 1px solid #f3e4c4; color: #8d7138; font-size: 10.5px; line-height: 1.6; }
|
|
351
|
+
.sync-note.ok { background: #eef9f3; border-color: #cfeee0; color: #1a7a58; }
|
|
352
|
+
.sync-note b { color: inherit; }
|
|
321
353
|
.schema-field .json-input { font-family: Consolas, monospace; font-size: 10.5px; }
|
|
322
354
|
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
|
|
323
355
|
.switch input { display: none; }
|
|
@@ -375,20 +407,58 @@ code { background: #f2f5f9; color: #55657d; border-radius: 4px; padding: 1px 4px
|
|
|
375
407
|
.grid.two, .grid.wide { grid-template-columns: 1fr; }
|
|
376
408
|
.plugin-grid { grid-template-columns: 1fr 1fr; }
|
|
377
409
|
.welcome-grid { grid-template-columns: 1fr 1fr; }
|
|
410
|
+
.config-layout { grid-template-columns: 210px minmax(0, 1fr); }
|
|
411
|
+
.schema-field { grid-template-columns: 210px minmax(0, 1fr); gap: 18px; }
|
|
378
412
|
}
|
|
413
|
+
|
|
379
414
|
@media (max-width: 820px) {
|
|
380
|
-
|
|
381
|
-
.
|
|
382
|
-
.sidebar {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
.
|
|
388
|
-
.
|
|
389
|
-
.
|
|
390
|
-
.
|
|
391
|
-
.
|
|
392
|
-
.
|
|
415
|
+
html, body { overflow: hidden; }
|
|
416
|
+
.app { display: block; height: 100dvh; }
|
|
417
|
+
.sidebar {
|
|
418
|
+
position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 50;
|
|
419
|
+
padding: 20px 14px 16px; transform: translateX(-105%); transition: transform .22s ease;
|
|
420
|
+
box-shadow: 20px 0 50px rgba(8, 15, 27, .28);
|
|
421
|
+
}
|
|
422
|
+
.sidebar.open { transform: none; }
|
|
423
|
+
.sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(8, 15, 27, .48); }
|
|
424
|
+
.sidebar-backdrop[hidden] { display: none; }
|
|
425
|
+
.nav-close { display: grid; }
|
|
426
|
+
.menu-btn { display: grid; }
|
|
427
|
+
.main { height: 100dvh; }
|
|
428
|
+
.topbar { padding: 0 14px; height: 58px; flex-basis: 58px; }
|
|
429
|
+
.topbar .crumb-muted, .topbar .crumb-sep { display: none; }
|
|
430
|
+
.top-actions { gap: 7px; }
|
|
431
|
+
.content { padding: 16px 14px 28px; }
|
|
432
|
+
.page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
|
|
433
|
+
.page-head h1 { font-size: 21px; }
|
|
434
|
+
.head-actions { flex-wrap: wrap; }
|
|
435
|
+
.metrics, .metrics.three { grid-template-columns: 1fr 1fr; }
|
|
436
|
+
.plugin-grid, .memory-layout, .config-layout, .welcome-grid { grid-template-columns: 1fr; }
|
|
437
|
+
.scope-list { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 12px; }
|
|
438
|
+
.scope-list h3 { width: 100%; margin: 2px 6px 2px; }
|
|
439
|
+
.scope-list h3.mt { margin-top: 8px; }
|
|
440
|
+
.scope { width: auto; gap: 8px; }
|
|
441
|
+
.schema-field, .schema-field.long { grid-template-columns: 1fr; gap: 8px; padding: 14px 0; }
|
|
442
|
+
.schema-field .field > span { flex: 0 0 120px; }
|
|
443
|
+
.field > span { flex: 0 0 120px; }
|
|
444
|
+
.config-nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; }
|
|
445
|
+
.config-nav .config-group-label { width: 100%; }
|
|
446
|
+
.config-plugin { width: auto; gap: 7px; padding: 7px 9px; }
|
|
447
|
+
.config-plugin small { display: none; }
|
|
448
|
+
.form-foot { flex-direction: column; align-items: flex-start; gap: 10px; }
|
|
449
|
+
.log-line { grid-template-columns: 72px 44px minmax(0, 1fr); }
|
|
393
450
|
.log-line .src { display: none; }
|
|
451
|
+
.log-view { min-height: 55vh; padding: 12px; }
|
|
452
|
+
.statusbar { gap: 10px; padding: 0 12px; }
|
|
453
|
+
.statusbar #statusRight { display: none; }
|
|
454
|
+
.statusbar #statusCalls { display: none; }
|
|
455
|
+
.modal-card { width: 94vw; padding: 15px; }
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
@media (max-width: 520px) {
|
|
459
|
+
.metrics, .metrics.three { grid-template-columns: 1fr; }
|
|
460
|
+
.top-actions .pill b { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
461
|
+
.welcome-hero { padding: 22px 20px; }
|
|
462
|
+
.welcome-actions { flex-wrap: wrap; }
|
|
463
|
+
.brand { padding-bottom: 18px; }
|
|
394
464
|
}
|