nonebot-plugin-botui 0.1.0__py3-none-any.whl
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.
- nonebot_plugin_botui/__init__.py +382 -0
- nonebot_plugin_botui/api.py +1683 -0
- nonebot_plugin_botui/capture.py +570 -0
- nonebot_plugin_botui/config.py +170 -0
- nonebot_plugin_botui/ingest.py +216 -0
- nonebot_plugin_botui/media.py +438 -0
- nonebot_plugin_botui/mediastore.py +954 -0
- nonebot_plugin_botui/models.py +221 -0
- nonebot_plugin_botui/paths.py +36 -0
- nonebot_plugin_botui/segments.py +900 -0
- nonebot_plugin_botui/static/app.css +1774 -0
- nonebot_plugin_botui/static/app.js +3799 -0
- nonebot_plugin_botui/static/index.html +232 -0
- nonebot_plugin_botui/store.py +1271 -0
- nonebot_plugin_botui/webui.py +386 -0
- nonebot_plugin_botui-0.1.0.dist-info/METADATA +231 -0
- nonebot_plugin_botui-0.1.0.dist-info/RECORD +18 -0
- nonebot_plugin_botui-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh-CN" data-theme="dark">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
6
|
+
<meta name="color-scheme" content="dark light">
|
|
7
|
+
<meta name="referrer" content="no-referrer">
|
|
8
|
+
<title>BotUI · 消息控制台</title>
|
|
9
|
+
<base href="./">
|
|
10
|
+
<link rel="stylesheet" href="./static/app.css">
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<!-- 应用外壳:两栏布局,窄屏下由 JS 切换 data-pane 决定显示哪一栏 -->
|
|
14
|
+
<div class="app" id="app" data-pane="sidebar">
|
|
15
|
+
|
|
16
|
+
<!-- ============ 左侧边栏 ============ -->
|
|
17
|
+
<aside class="sidebar" id="sidebar">
|
|
18
|
+
<header class="sidebar-head">
|
|
19
|
+
<div class="sidebar-title-row">
|
|
20
|
+
<span class="brand">
|
|
21
|
+
<span class="brand-mark" aria-hidden="true"></span>
|
|
22
|
+
<span class="brand-text">BotUI</span>
|
|
23
|
+
</span>
|
|
24
|
+
<button class="icon-btn" id="themeBtn" type="button" title="切换主题" aria-label="切换主题">
|
|
25
|
+
<svg class="ico-sun" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.2"/><path d="M12 2.6v2.2M12 19.2v2.2M2.6 12h2.2M19.2 12h2.2M5.3 5.3l1.6 1.6M17.1 17.1l1.6 1.6M18.7 5.3l-1.6 1.6M6.9 17.1l-1.6 1.6"/></svg>
|
|
26
|
+
<svg class="ico-moon" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 14.2A8.2 8.2 0 0 1 9.8 4 8.4 8.4 0 1 0 20 14.2z"/></svg>
|
|
27
|
+
</button>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="search-wrap">
|
|
30
|
+
<svg class="search-ico" viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="6.2"/><path d="M15.6 15.6L21 21"/></svg>
|
|
31
|
+
<input type="search" id="searchInput" class="search-input" placeholder="搜索会话 / 群号 / 消息" autocomplete="off" spellcheck="false" aria-label="搜索会话或消息">
|
|
32
|
+
<button class="search-clear" id="searchClear" type="button" aria-label="清空搜索" hidden>✕</button>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="search-tabs" id="searchTabs" hidden role="tablist" aria-label="搜索范围">
|
|
35
|
+
<button class="search-tab active" id="tabChats" type="button" role="tab" aria-selected="true">会话</button>
|
|
36
|
+
<button class="search-tab" id="tabMsgs" type="button" role="tab" aria-selected="false">消息</button>
|
|
37
|
+
</div>
|
|
38
|
+
</header>
|
|
39
|
+
|
|
40
|
+
<div class="chat-list" id="chatList" role="list" aria-label="会话列表"></div>
|
|
41
|
+
|
|
42
|
+
<!-- 消息搜索结果:只在「消息」标签下显示,点一条直接跳到该会话并定位 -->
|
|
43
|
+
<div class="msg-results" id="msgResults" hidden role="list" aria-label="消息搜索结果"></div>
|
|
44
|
+
|
|
45
|
+
<footer class="sidebar-foot">
|
|
46
|
+
<div class="conn-row">
|
|
47
|
+
<span class="dot dot-idle" id="connDot" aria-hidden="true"></span>
|
|
48
|
+
<span class="conn-text" id="connText">正在连接…</span>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="conn-meta" id="connMeta"></div>
|
|
51
|
+
</footer>
|
|
52
|
+
</aside>
|
|
53
|
+
|
|
54
|
+
<!-- ============ 右侧会话区 ============ -->
|
|
55
|
+
<main class="chat-pane" id="chatPane">
|
|
56
|
+
<header class="chat-head" id="chatHead">
|
|
57
|
+
<button class="icon-btn back-btn" id="backBtn" type="button" title="返回会话列表" aria-label="返回会话列表">
|
|
58
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 5l-7 7 7 7"/></svg>
|
|
59
|
+
</button>
|
|
60
|
+
<div class="head-avatar" id="headAvatar"></div>
|
|
61
|
+
<div class="head-main">
|
|
62
|
+
<div class="head-name-row">
|
|
63
|
+
<span class="head-name" id="headName">未选择会话</span>
|
|
64
|
+
<button class="icon-btn head-rename" id="headRenameBtn" type="button" title="设置会话备注" aria-label="设置会话备注" hidden>
|
|
65
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 20h4l10-10-4-4L4 16v4z"/><path d="M13.5 6.5l4 4"/></svg>
|
|
66
|
+
</button>
|
|
67
|
+
<span class="badge" id="headKind" hidden></span>
|
|
68
|
+
</div>
|
|
69
|
+
<div class="head-sub" id="headSub">从左侧选择一个会话开始查看消息</div>
|
|
70
|
+
</div>
|
|
71
|
+
<button class="icon-btn" id="reloadBtn" type="button" title="重新加载消息" aria-label="重新加载消息">
|
|
72
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.6-5.9"/><path d="M20.2 4.4v4.2H16"/></svg>
|
|
73
|
+
</button>
|
|
74
|
+
|
|
75
|
+
<!-- 设置:缓存管理(本地缓存占用 / 清理),入口在右上角 -->
|
|
76
|
+
<button class="icon-btn" id="settingsBtn" type="button" title="设置" aria-label="设置" aria-haspopup="dialog">
|
|
77
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="3.2"/><path d="M12 2.8v2.4M12 18.8v2.4M2.8 12h2.4M18.8 12h2.4M5.5 5.5l1.7 1.7M16.8 16.8l1.7 1.7M18.5 5.5l-1.7 1.7M7.2 16.8l-1.7 1.7"/></svg>
|
|
78
|
+
</button>
|
|
79
|
+
|
|
80
|
+
<!-- 机器人切换器:列出所有连接过的机器人,在线的标「在线」,会话按机器人区分 -->
|
|
81
|
+
<div class="bot-switch" id="botSwitch">
|
|
82
|
+
<button class="bot-btn" id="botBtn" type="button" aria-haspopup="true" aria-expanded="false" title="切换机器人">
|
|
83
|
+
<span class="dot dot-idle" id="botDot" aria-hidden="true"></span>
|
|
84
|
+
<span class="bot-btn-name" id="botBtnName">选择机器人</span>
|
|
85
|
+
<svg class="bot-caret" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>
|
|
86
|
+
</button>
|
|
87
|
+
<div class="bot-menu" id="botMenu" hidden role="menu" aria-label="选择机器人"></div>
|
|
88
|
+
</div>
|
|
89
|
+
</header>
|
|
90
|
+
|
|
91
|
+
<div class="msg-area">
|
|
92
|
+
<div class="msg-viewport" id="msgViewport">
|
|
93
|
+
<div class="msg-list" id="msgList"></div>
|
|
94
|
+
</div>
|
|
95
|
+
<button class="new-msg-btn" id="newMsgBtn" type="button" hidden></button>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<footer class="composer" id="composer">
|
|
99
|
+
<div class="composer-bar" id="replyBar" hidden>
|
|
100
|
+
<span class="bar-label" id="replyBarLabel"></span>
|
|
101
|
+
<button class="bar-close" id="replyBarClose" type="button" aria-label="取消回复">✕</button>
|
|
102
|
+
</div>
|
|
103
|
+
<div class="pending-at" id="pendingAt" hidden></div>
|
|
104
|
+
<div class="pending-files" id="pendingFiles" hidden></div>
|
|
105
|
+
<div class="composer-row">
|
|
106
|
+
<button class="composer-tool" id="atBtn" type="button" title="提及成员(@)">@</button>
|
|
107
|
+
<button class="composer-tool" id="fileBtn" type="button" title="发送图片 / 文件">+</button>
|
|
108
|
+
<textarea id="composerInput" class="composer-input" rows="1" placeholder="输入消息,Enter 发送,Shift+Enter 换行" aria-label="消息输入框"></textarea>
|
|
109
|
+
<button class="send-btn" id="sendBtn" type="button">发送</button>
|
|
110
|
+
</div>
|
|
111
|
+
<div class="composer-hint" id="composerHint"></div>
|
|
112
|
+
<input type="file" id="filePicker" multiple hidden aria-hidden="true">
|
|
113
|
+
</footer>
|
|
114
|
+
</main>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<!-- 拖拽文件到页面任意位置即可添加附件 -->
|
|
118
|
+
<div class="drop-overlay" id="dropOverlay" hidden>
|
|
119
|
+
<div class="drop-overlay-card">松开即可添加附件(图片 / 文件)</div>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<!-- 图片灯箱:点击图片查看大图,点击任意处或 Esc 关闭 -->
|
|
123
|
+
<div class="lightbox" id="lightbox" hidden>
|
|
124
|
+
<img id="lightboxImg" alt="图片预览">
|
|
125
|
+
<div class="lightbox-tip">点击任意位置或按 Esc 关闭</div>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<!-- 文件在线预览:文本 / 图片 / PDF / 音视频 / 合并转发 -->
|
|
129
|
+
<div class="file-viewer" id="fileViewer" hidden role="dialog" aria-modal="true" aria-labelledby="fileViewerTitle">
|
|
130
|
+
<div class="file-card">
|
|
131
|
+
<header class="file-head">
|
|
132
|
+
<div class="file-head-main">
|
|
133
|
+
<h2 class="file-title" id="fileViewerTitle">文件预览</h2>
|
|
134
|
+
<p class="file-meta" id="fileViewerMeta"></p>
|
|
135
|
+
</div>
|
|
136
|
+
<a class="file-action" id="fileViewerSave" href="#" download>下载</a>
|
|
137
|
+
<button class="file-action" id="fileViewerClose" type="button">关闭</button>
|
|
138
|
+
</header>
|
|
139
|
+
<div class="file-body" id="fileViewerBody"></div>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<!-- 消息右键菜单 -->
|
|
144
|
+
<div class="ctx-menu" id="ctxMenu" hidden role="menu"></div>
|
|
145
|
+
|
|
146
|
+
<!-- 备注(别名)编辑弹窗:给会话 / 成员 / 机器人起一个认得出的名字 -->
|
|
147
|
+
<div class="alias" id="aliasDialog" hidden role="dialog" aria-modal="true" aria-labelledby="aliasTitle">
|
|
148
|
+
<div class="alias-card">
|
|
149
|
+
<h2 class="alias-title" id="aliasTitle">设置备注</h2>
|
|
150
|
+
<p class="alias-desc" id="aliasDesc">备注只影响界面显示,不会写入聊天记录。</p>
|
|
151
|
+
<input type="text" class="alias-input" id="aliasInput" maxlength="64" autocomplete="off" spellcheck="false" aria-label="备注">
|
|
152
|
+
<div class="alias-actions">
|
|
153
|
+
<button class="settings-btn" id="aliasClear" type="button">清除备注</button>
|
|
154
|
+
<button class="settings-btn primary" id="aliasSave" type="button">保存</button>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<!-- 设置面板:目前只有本地缓存管理,后续设置项继续往里加 -->
|
|
160
|
+
<div class="settings" id="settings" hidden role="dialog" aria-modal="true" aria-labelledby="settingsTitle">
|
|
161
|
+
<div class="settings-card">
|
|
162
|
+
<header class="settings-head">
|
|
163
|
+
<h2 class="settings-title" id="settingsTitle">设置</h2>
|
|
164
|
+
<button class="file-action" id="settingsClose" type="button">关闭</button>
|
|
165
|
+
</header>
|
|
166
|
+
<div class="settings-body">
|
|
167
|
+
<section class="settings-section">
|
|
168
|
+
<div class="settings-section-head">
|
|
169
|
+
<h3 class="settings-section-title">新消息通知</h3>
|
|
170
|
+
<span class="settings-badge" id="notifyState">已关闭</span>
|
|
171
|
+
</div>
|
|
172
|
+
<p class="settings-desc">
|
|
173
|
+
收到新消息时弹出系统通知(需浏览器授权)。页面已聚焦在当前会话时不会打扰,
|
|
174
|
+
自己发出的消息也不会提醒。
|
|
175
|
+
</p>
|
|
176
|
+
<label class="settings-switch">
|
|
177
|
+
<input type="checkbox" id="notifyToggle">
|
|
178
|
+
<span class="switch-track" aria-hidden="true"></span>
|
|
179
|
+
<span class="switch-text">开启网页通知</span>
|
|
180
|
+
</label>
|
|
181
|
+
<label class="settings-switch">
|
|
182
|
+
<input type="checkbox" id="notifySound">
|
|
183
|
+
<span class="switch-track" aria-hidden="true"></span>
|
|
184
|
+
<span class="switch-text">通知提示音</span>
|
|
185
|
+
</label>
|
|
186
|
+
</section>
|
|
187
|
+
|
|
188
|
+
<section class="settings-section">
|
|
189
|
+
<div class="settings-section-head">
|
|
190
|
+
<h3 class="settings-section-title">本地缓存</h3>
|
|
191
|
+
<span class="settings-badge" id="cacheState">—</span>
|
|
192
|
+
</div>
|
|
193
|
+
<p class="settings-desc">
|
|
194
|
+
机器人收到的图片与文件会自动下载到本地,之后即使原链接失效也能查看。
|
|
195
|
+
未被聊天记录引用的资源会按保留时间自动回收。
|
|
196
|
+
</p>
|
|
197
|
+
<div class="cache-stats" id="cacheStats"></div>
|
|
198
|
+
<div class="cache-actions">
|
|
199
|
+
<button class="settings-btn" id="cacheRefresh" type="button">刷新</button>
|
|
200
|
+
<button class="settings-btn" id="cacheClearOrphans" type="button">清理未引用</button>
|
|
201
|
+
<button class="settings-btn" id="cacheClearImages" type="button">清理图片</button>
|
|
202
|
+
<button class="settings-btn" id="cacheClearFiles" type="button">清理文件</button>
|
|
203
|
+
<button class="settings-btn danger" id="cacheClearAll" type="button">清空缓存</button>
|
|
204
|
+
</div>
|
|
205
|
+
</section>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<!-- @ 成员选择菜单:列出该会话记录到过的成员,供点选 -->
|
|
211
|
+
<div class="at-menu" id="atMenu" hidden role="menu" tabindex="-1" aria-label="选择要提及的成员"></div>
|
|
212
|
+
|
|
213
|
+
<!-- 令牌输入页:仅在需要鉴权且本地无令牌时显示 -->
|
|
214
|
+
<div class="gate" id="gate" hidden>
|
|
215
|
+
<div class="gate-card">
|
|
216
|
+
<div class="gate-logo" aria-hidden="true"></div>
|
|
217
|
+
<h1 class="gate-title">BotUI 消息控制台</h1>
|
|
218
|
+
<p class="gate-desc" id="gateDesc">该服务已开启访问令牌校验,请输入令牌后继续。</p>
|
|
219
|
+
<form class="gate-form" id="gateForm" autocomplete="off">
|
|
220
|
+
<input type="password" class="gate-input" id="gateInput" placeholder="请输入访问令牌" autocomplete="off" spellcheck="false" aria-label="访问令牌">
|
|
221
|
+
<button type="submit" class="gate-submit" id="gateSubmit">保存</button>
|
|
222
|
+
</form>
|
|
223
|
+
<p class="gate-tip">令牌仅保存在当前浏览器的 localStorage 中</p>
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
|
|
227
|
+
<!-- 轻量提示条 -->
|
|
228
|
+
<div class="toast" id="toast" hidden></div>
|
|
229
|
+
|
|
230
|
+
<script src="./static/app.js"></script>
|
|
231
|
+
</body>
|
|
232
|
+
</html>
|