openclacky 1.5.26 → 1.5.27
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.
- checksums.yaml +4 -4
- data/.clacky/skills/gem-release/SKILL.md +7 -1
- data/CHANGELOG.md +15 -0
- data/lib/clacky/agent_profile.rb +53 -1
- data/lib/clacky/default_extensions/knowledge/README.md +6 -1
- data/lib/clacky/default_extensions/knowledge/README.zh.md +6 -1
- data/lib/clacky/default_extensions/knowledge/agents/knowledge/system_prompt.md +10 -0
- data/lib/clacky/default_extensions/knowledge/api/handler.rb +165 -0
- data/lib/clacky/default_extensions/knowledge/ext.yml +7 -7
- data/lib/clacky/default_extensions/knowledge/hooks/kb_inject.rb +11 -0
- data/lib/clacky/default_extensions/knowledge/lib/index.rb +26 -0
- data/lib/clacky/default_extensions/knowledge/lib/knowledge.rb +11 -0
- data/lib/clacky/default_extensions/knowledge/lib/stats.rb +485 -0
- data/lib/clacky/default_extensions/knowledge/lib/store.rb +45 -0
- data/lib/clacky/default_extensions/knowledge/panels/kb/view.js +1029 -15
- data/lib/clacky/default_extensions/meeting/panels/meeting/view.js +9 -0
- data/lib/clacky/extension/loader.rb +37 -0
- data/lib/clacky/version.rb +1 -1
- data/lib/clacky/web/app.css +1 -1
- data/lib/clacky/web/app.js +13 -5
- data/lib/clacky/web/i18n.js +7 -5
- data/lib/clacky/web/index.html +1 -0
- data/lib/clacky/web/lib/audio-recorder.js +213 -0
- data/lib/clacky/web/utils.js +5 -1
- metadata +3 -1
|
@@ -20,10 +20,46 @@
|
|
|
20
20
|
"ws.sub": "Documents the Knowledge Base agent consults before answering",
|
|
21
21
|
"btn.add": "Add data source",
|
|
22
22
|
"btn.recall": "Recall test",
|
|
23
|
+
"btn.settings": "Settings",
|
|
24
|
+
"set.title": "Settings",
|
|
25
|
+
"set.allTools": "Allow every tool",
|
|
26
|
+
"set.allTools.desc": "When off, the agent can only search and read these documents — no terminal, files, web, memory or skills. Turn it off for guest-facing agents, e.g. over WeChat or Feishu.",
|
|
27
|
+
"set.save": "Save",
|
|
28
|
+
"set.saved": "Saved. New sessions will use this setting.",
|
|
23
29
|
"add.files": "Upload files",
|
|
24
30
|
"add.files.desc": "Markdown, TXT, PDF, Word",
|
|
25
31
|
"add.folder": "Import folder",
|
|
26
32
|
"add.folder.desc": "Import every supported file in a folder",
|
|
33
|
+
"add.rec": "Record audio",
|
|
34
|
+
"add.rec.desc": "Speak — captions appear, then save the text",
|
|
35
|
+
"rec.title": "Record audio",
|
|
36
|
+
"rec.starting": "Opening the microphone…",
|
|
37
|
+
"rec.listening": "Listening… just speak",
|
|
38
|
+
"rec.stop": "Stop recording",
|
|
39
|
+
"rec.wait": "Finishing the last sentences…",
|
|
40
|
+
"rec.empty": "Captions appear here as you speak.",
|
|
41
|
+
"rec.hint": "Speak normally; each sentence shows up once it is recognised. Press stop when you are done.",
|
|
42
|
+
"rec.nothing": "No speech was recognised, so nothing was imported.",
|
|
43
|
+
"rec.sec": "The microphone only works on an https:// page or on localhost. Open this page over https:// and try again.",
|
|
44
|
+
"rec.unsupported": "This browser cannot record audio. Try Chrome or Edge.",
|
|
45
|
+
"rec.denied": "Microphone access was blocked. Allow it for this site in the browser settings, then try again.",
|
|
46
|
+
"rec.noDevice": "No microphone found.",
|
|
47
|
+
"rec.sttMissing": "No speech-to-text model is configured, so the recording cannot be transcribed. Add one in Settings › Models.",
|
|
48
|
+
"rec.segFailed": "This sentence could not be transcribed",
|
|
49
|
+
"rec.confirmTitle": "Save recording",
|
|
50
|
+
"rec.defaultTitle": "Recording {{time}}",
|
|
51
|
+
"rec.source": "Recording",
|
|
52
|
+
"rec.fieldTitle": "Title",
|
|
53
|
+
"rec.fieldFolder": "Save to",
|
|
54
|
+
"rec.fieldBody": "Text",
|
|
55
|
+
"rec.summarize": "Tidy up with AI",
|
|
56
|
+
"rec.summarizing": "Tidying up…",
|
|
57
|
+
"rec.summarized": "Rewritten by AI — check it before saving",
|
|
58
|
+
"rec.restore": "Back to transcript",
|
|
59
|
+
"rec.tooLong": "Too long to tidy up in one go (max {{n}} characters). You can still save it as it is.",
|
|
60
|
+
"rec.llmMissing": "No chat model is configured.",
|
|
61
|
+
"rec.sumFailed": "Could not tidy up: {{msg}}",
|
|
62
|
+
"rec.save": "Save to knowledge base",
|
|
27
63
|
"off": "The knowledge base is switched off, so the agent is not using these documents right now.",
|
|
28
64
|
"close": "Close",
|
|
29
65
|
"filter.all": "All",
|
|
@@ -87,6 +123,59 @@
|
|
|
87
123
|
"recall.score.tip": "Relevance {{score}}\nHigher means a closer match. Ranking only, not a percentage.",
|
|
88
124
|
"recall.history": "Recent searches",
|
|
89
125
|
"recall.history.clear": "Clear",
|
|
126
|
+
"recall.cases": "Test questions",
|
|
127
|
+
"recall.cases.add": "Add a test question",
|
|
128
|
+
"recall.cases.ph": "Type a question, press Enter",
|
|
129
|
+
"recall.cases.empty": "No test questions yet",
|
|
130
|
+
"recall.cases.empty.sub": "Save the questions people ask most; click one to test it again.",
|
|
131
|
+
"recall.cases.del": "Delete",
|
|
132
|
+
"recall.cases.added": "Test question added",
|
|
133
|
+
"recall.cases.deleted": "Test question deleted",
|
|
134
|
+
"stats.entry": "Statistics",
|
|
135
|
+
"stats.title": "Usage",
|
|
136
|
+
"stats.sub": "What people ask the knowledge base, and what it fails to answer",
|
|
137
|
+
"stats.range.today": "Today",
|
|
138
|
+
"stats.range.week": "Last 7 days",
|
|
139
|
+
"stats.range.month": "Last 30 days",
|
|
140
|
+
"stats.range.all": "All time",
|
|
141
|
+
"stats.allSessions": "All conversations",
|
|
142
|
+
"stats.allThemes": "All topics",
|
|
143
|
+
"stats.unmatched": "No match",
|
|
144
|
+
"stats.kpi.total": "Questions",
|
|
145
|
+
"stats.kpi.sessions": "Active conversations",
|
|
146
|
+
"stats.kpi.total.sub": "Asked in chats and on the web",
|
|
147
|
+
"stats.kpi.sessions.sub": "One per conversation",
|
|
148
|
+
"stats.kpi.hit": "Answered",
|
|
149
|
+
"stats.kpi.hit.sub": "{{n}} of {{total}} found a document",
|
|
150
|
+
"stats.kpi.gaps": "Needs an answer",
|
|
151
|
+
"stats.kpi.gaps.sub": "Nothing in the base to cite",
|
|
152
|
+
"stats.trend": "Questions per {{unit}}",
|
|
153
|
+
"stats.unit.day": "day",
|
|
154
|
+
"stats.unit.week": "week",
|
|
155
|
+
"stats.unit.month": "month",
|
|
156
|
+
"stats.themes": "Topics",
|
|
157
|
+
"stats.themes.sub": "Top folder of the documents that matched",
|
|
158
|
+
"stats.top": "Most asked",
|
|
159
|
+
"stats.gaps": "Needs an answer",
|
|
160
|
+
"stats.gaps.sub": "Questions the base could not answer — add a document that covers them",
|
|
161
|
+
"stats.hours": "When people ask",
|
|
162
|
+
"stats.peak": "Peak {{h}}:00",
|
|
163
|
+
"stats.sessions": "Conversations",
|
|
164
|
+
"stats.col.question": "Question",
|
|
165
|
+
"stats.col.topic": "Topic",
|
|
166
|
+
"stats.col.times": "Times",
|
|
167
|
+
"stats.col.last": "Last asked",
|
|
168
|
+
"stats.col.session": "Conversation",
|
|
169
|
+
"stats.col.days": "Days",
|
|
170
|
+
"stats.empty": "No questions in this range",
|
|
171
|
+
"stats.empty.sub": "Every question asked on the web or in a chat shows up here.",
|
|
172
|
+
"stats.gaps.empty": "Nothing missing — every question found a document.",
|
|
173
|
+
"stats.src.web": "Web",
|
|
174
|
+
"stats.pf.feishu": "Feishu",
|
|
175
|
+
"stats.pf.wecom": "WeCom",
|
|
176
|
+
"stats.pf.weixin": "WeChat",
|
|
177
|
+
"stats.pf.dingtalk": "DingTalk",
|
|
178
|
+
"stats.pf.qq": "QQ",
|
|
90
179
|
"loadFailed": "Failed to load: {{msg}}",
|
|
91
180
|
},
|
|
92
181
|
zh: {
|
|
@@ -95,10 +184,46 @@
|
|
|
95
184
|
"ws.sub": "知识库 Agent 回答前会先查阅这里的资料",
|
|
96
185
|
"btn.add": "添加数据源",
|
|
97
186
|
"btn.recall": "召回测试",
|
|
187
|
+
"btn.settings": "设置",
|
|
188
|
+
"set.title": "设置",
|
|
189
|
+
"set.allTools": "允许使用全部工具",
|
|
190
|
+
"set.allTools.desc": "关闭后,该 Agent 只能检索和阅读这里的资料,不能读写文件、执行终端命令、联网,也不读记忆、不使用技能。适合给访客使用,例如接入微信、飞书。",
|
|
191
|
+
"set.save": "保存",
|
|
192
|
+
"set.saved": "已保存,新会话生效。",
|
|
98
193
|
"add.files": "上传文件",
|
|
99
194
|
"add.files.desc": "支持 Markdown、TXT、PDF、Word",
|
|
100
195
|
"add.folder": "导入文件夹",
|
|
101
196
|
"add.folder.desc": "导入文件夹内所有支持的文件",
|
|
197
|
+
"add.rec": "录音导入",
|
|
198
|
+
"add.rec.desc": "边说话边出字幕,再整理入库",
|
|
199
|
+
"rec.title": "录音导入",
|
|
200
|
+
"rec.starting": "正在打开麦克风…",
|
|
201
|
+
"rec.listening": "正在听…请说话",
|
|
202
|
+
"rec.stop": "停止录音",
|
|
203
|
+
"rec.wait": "正在处理最后几句话…",
|
|
204
|
+
"rec.empty": "字幕会随着你说话显示在这里。",
|
|
205
|
+
"rec.hint": "正常说话即可,每句话识别完会显示在这里。说完点「停止录音」。",
|
|
206
|
+
"rec.nothing": "没有识别到语音,未导入任何内容。",
|
|
207
|
+
"rec.sec": "浏览器只允许在 https:// 或本机 localhost 页面使用麦克风。请改用 https:// 地址打开本页后重试。",
|
|
208
|
+
"rec.unsupported": "当前浏览器无法录音,请使用 Chrome 或 Edge。",
|
|
209
|
+
"rec.denied": "麦克风权限被拒绝。请在浏览器设置里允许本站使用麦克风后重试。",
|
|
210
|
+
"rec.noDevice": "没有找到麦克风。",
|
|
211
|
+
"rec.sttMissing": "还没有配置语音识别(STT)模型,无法转写录音。请到 设置 › 模型 里添加。",
|
|
212
|
+
"rec.segFailed": "这一句没能识别出来",
|
|
213
|
+
"rec.confirmTitle": "录音入库",
|
|
214
|
+
"rec.defaultTitle": "录音 {{time}}",
|
|
215
|
+
"rec.source": "录音",
|
|
216
|
+
"rec.fieldTitle": "标题",
|
|
217
|
+
"rec.fieldFolder": "保存到",
|
|
218
|
+
"rec.fieldBody": "文字内容",
|
|
219
|
+
"rec.summarize": "总结文字",
|
|
220
|
+
"rec.summarizing": "正在整理…",
|
|
221
|
+
"rec.summarized": "已由 AI 整理,入库前请核对",
|
|
222
|
+
"rec.restore": "恢复原话",
|
|
223
|
+
"rec.tooLong": "文字太长,无法一次整理(上限 {{n}} 字),仍可直接保存原话。",
|
|
224
|
+
"rec.llmMissing": "还没有配置对话模型。",
|
|
225
|
+
"rec.sumFailed": "整理失败:{{msg}}",
|
|
226
|
+
"rec.save": "确认并入库",
|
|
102
227
|
"off": "知识库目前处于关闭状态,AI 回答时不会参考这些资料。",
|
|
103
228
|
"close": "关闭",
|
|
104
229
|
"filter.all": "全部",
|
|
@@ -162,6 +287,59 @@
|
|
|
162
287
|
"recall.score.tip": "相关度 {{score}}\n越高越相关。只用来排序,不是百分比。",
|
|
163
288
|
"recall.history": "搜索历史",
|
|
164
289
|
"recall.history.clear": "清空",
|
|
290
|
+
"recall.cases": "测试题集",
|
|
291
|
+
"recall.cases.add": "添加测试题",
|
|
292
|
+
"recall.cases.ph": "输入问题,回车保存",
|
|
293
|
+
"recall.cases.empty": "还没有测试题",
|
|
294
|
+
"recall.cases.empty.sub": "把最常被问到的问题存进来,点一下就能复测。",
|
|
295
|
+
"recall.cases.del": "删除",
|
|
296
|
+
"recall.cases.added": "已添加测试题",
|
|
297
|
+
"recall.cases.deleted": "已删除测试题",
|
|
298
|
+
"stats.entry": "数据统计",
|
|
299
|
+
"stats.title": "使用情况",
|
|
300
|
+
"stats.sub": "谁在问、问什么、哪些没答上来",
|
|
301
|
+
"stats.range.today": "今日",
|
|
302
|
+
"stats.range.week": "近 7 天",
|
|
303
|
+
"stats.range.month": "近 30 天",
|
|
304
|
+
"stats.range.all": "全部",
|
|
305
|
+
"stats.allSessions": "全部会话",
|
|
306
|
+
"stats.allThemes": "全部主题",
|
|
307
|
+
"stats.unmatched": "未命中",
|
|
308
|
+
"stats.kpi.total": "提问总数",
|
|
309
|
+
"stats.kpi.sessions": "活跃会话",
|
|
310
|
+
"stats.kpi.total.sub": "渠道与网页的提问合计",
|
|
311
|
+
"stats.kpi.sessions.sub": "一个会话算一个",
|
|
312
|
+
"stats.kpi.hit": "命中率",
|
|
313
|
+
"stats.kpi.hit.sub": "{{total}} 个提问中 {{n}} 个找到资料",
|
|
314
|
+
"stats.kpi.gaps": "待补充问题",
|
|
315
|
+
"stats.kpi.gaps.sub": "没有资料可以依据",
|
|
316
|
+
"stats.trend": "提问趋势(每{{unit}})",
|
|
317
|
+
"stats.unit.day": "日",
|
|
318
|
+
"stats.unit.week": "周",
|
|
319
|
+
"stats.unit.month": "月",
|
|
320
|
+
"stats.themes": "主题分布",
|
|
321
|
+
"stats.themes.sub": "按命中资料的顶层目录归类",
|
|
322
|
+
"stats.top": "常问 TOP 20",
|
|
323
|
+
"stats.gaps": "待补充清单",
|
|
324
|
+
"stats.gaps.sub": "知识库答不上来的问题,补齐资料后就会命中",
|
|
325
|
+
"stats.hours": "提问时段",
|
|
326
|
+
"stats.peak": "峰值 {{h}}:00",
|
|
327
|
+
"stats.sessions": "会话排行",
|
|
328
|
+
"stats.col.question": "问题",
|
|
329
|
+
"stats.col.topic": "主题",
|
|
330
|
+
"stats.col.times": "次数",
|
|
331
|
+
"stats.col.last": "最近提问",
|
|
332
|
+
"stats.col.session": "会话",
|
|
333
|
+
"stats.col.days": "活跃天数",
|
|
334
|
+
"stats.empty": "这个时间段还没有提问",
|
|
335
|
+
"stats.empty.sub": "网页或渠道里的每次提问都会统计到这里。",
|
|
336
|
+
"stats.gaps.empty": "没有待补充的问题,每个提问都命中了资料。",
|
|
337
|
+
"stats.src.web": "网页",
|
|
338
|
+
"stats.pf.feishu": "飞书",
|
|
339
|
+
"stats.pf.wecom": "企业微信",
|
|
340
|
+
"stats.pf.weixin": "微信",
|
|
341
|
+
"stats.pf.dingtalk": "钉钉",
|
|
342
|
+
"stats.pf.qq": "QQ",
|
|
165
343
|
"loadFailed": "加载失败:{{msg}}",
|
|
166
344
|
},
|
|
167
345
|
};
|
|
@@ -214,7 +392,11 @@
|
|
|
214
392
|
const res = await fetch(API + path, opts);
|
|
215
393
|
let data = {};
|
|
216
394
|
try { data = await res.json(); } catch (_e) { /* non-JSON error page */ }
|
|
217
|
-
if (!res.ok)
|
|
395
|
+
if (!res.ok) {
|
|
396
|
+
const err = new Error(data.error || `HTTP ${res.status}`);
|
|
397
|
+
err.type = data.error_type;
|
|
398
|
+
throw err;
|
|
399
|
+
}
|
|
218
400
|
return data;
|
|
219
401
|
}
|
|
220
402
|
|
|
@@ -232,13 +414,14 @@
|
|
|
232
414
|
[/^already exists/, { en: "A folder with this name already exists", zh: "已有同名文件夹" }],
|
|
233
415
|
];
|
|
234
416
|
function errText(msg) {
|
|
235
|
-
const zh =
|
|
417
|
+
const zh = isZh();
|
|
236
418
|
const hit = ERRORS.find(([re]) => re.test(String(msg)));
|
|
237
419
|
return hit ? hit[1][zh ? "zh" : "en"] : msg;
|
|
238
420
|
}
|
|
239
421
|
|
|
240
422
|
// ── Icons (lucide) ─────────────────────────────────────────────────────
|
|
241
423
|
const ICON = {
|
|
424
|
+
settings: '<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>',
|
|
242
425
|
book: '<path d="M12 7v14"/><path d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"/>',
|
|
243
426
|
file: '<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 13H8"/><path d="M16 17H8"/><path d="M16 13h-2"/>',
|
|
244
427
|
upload: '<path d="M12 3v12"/><path d="m17 8-5-5-5 5"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>',
|
|
@@ -247,16 +430,19 @@
|
|
|
247
430
|
search: '<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',
|
|
248
431
|
zap: '<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',
|
|
249
432
|
target: '<circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/>',
|
|
433
|
+
flask: '<path d="M10 2v7.31"/><path d="M14 9.3V1.99"/><path d="M8.5 2h7"/><path d="M14 9.3a6.5 6.5 0 1 1-4 0"/><path d="M5.52 16h12.96"/>',
|
|
250
434
|
trash: '<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>',
|
|
251
435
|
pencil: '<path d="M21.17 6.81a1 1 0 0 0-3.98-3.98L3.84 16.17a2 2 0 0 0-.5.83l-1.32 4.35a.5.5 0 0 0 .62.62l4.35-1.32a2 2 0 0 0 .83-.5z"/><path d="m15 5 4 4"/>',
|
|
252
436
|
chevron: '<path d="m6 9 6 6 6-6"/>',
|
|
253
|
-
|
|
437
|
+
chevronRight: '<path d="m9 18 6-6-6-6"/>',
|
|
438
|
+
chart: '<path d="M3 3v18h18"/><path d="M18 17V9"/><path d="M13 17V5"/><path d="M8 17v-3"/>',
|
|
254
439
|
folderPlus: '<path d="M12 10v6"/><path d="M9 13h6"/><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',
|
|
255
440
|
move: '<path d="M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1"/><path d="M2 13h10"/><path d="m9 16 3-3-3-3"/>',
|
|
256
441
|
inbox: '<polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>',
|
|
257
442
|
history: '<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',
|
|
258
443
|
sort: '<path d="m21 16-4 4-4-4"/><path d="M17 20V4"/><path d="m3 8 4-4 4 4"/><path d="M7 4v16"/>',
|
|
259
444
|
check: '<path d="M20 6 9 17l-5-5"/>',
|
|
445
|
+
mic: '<path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/>',
|
|
260
446
|
};
|
|
261
447
|
|
|
262
448
|
function svg(name, cls, size) {
|
|
@@ -279,7 +465,20 @@
|
|
|
279
465
|
// newest first. Remembered across visits; folders and documents stay in
|
|
280
466
|
// their own group either way.
|
|
281
467
|
const SORT_KEY = "clacky-kb-sort";
|
|
282
|
-
const
|
|
468
|
+
const RANGE_KEY = "clacky-kb-stats-range";
|
|
469
|
+
const RANGES = ["today", "week", "month", "all"];
|
|
470
|
+
const state = {
|
|
471
|
+
data: null, folder: null, filter: "", busy: null, lastQuery: "", sort: loadSort(),
|
|
472
|
+
range: loadRange(), statsSession: "", statsTheme: "",
|
|
473
|
+
stats: null, statsKey: "", statsError: "", statsLoading: false,
|
|
474
|
+
statsBox: null, statsClose: null, statsBody: null,
|
|
475
|
+
};
|
|
476
|
+
function loadRange() {
|
|
477
|
+
try {
|
|
478
|
+
const v = localStorage.getItem(RANGE_KEY);
|
|
479
|
+
return RANGES.includes(v) ? v : "week";
|
|
480
|
+
} catch (_e) { return "week"; }
|
|
481
|
+
}
|
|
283
482
|
function loadSort() {
|
|
284
483
|
try { return localStorage.getItem(SORT_KEY) === "time" ? "time" : "name"; } catch (_e) { return "name"; }
|
|
285
484
|
}
|
|
@@ -394,12 +593,18 @@
|
|
|
394
593
|
|
|
395
594
|
const recallBtn = el("button", { class: "kb-btn kb-btn-ghost", type: "button", onclick: openRecall },
|
|
396
595
|
[svg("target", null, 15), t("btn.recall")]);
|
|
596
|
+
// The report spans the whole base rather than one folder, so it lives next
|
|
597
|
+
// to the other occasional actions instead of inside the folder navigation.
|
|
598
|
+
const statsBtn = el("button", { class: "kb-btn kb-btn-ghost", type: "button", onclick: openStats },
|
|
599
|
+
[svg("chart", null, 15), t("stats.entry")]);
|
|
600
|
+
const settingsBtn = el("button", { class: "kb-btn kb-btn-ghost", type: "button", onclick: openSettings },
|
|
601
|
+
[svg("settings", null, 15), t("btn.settings")]);
|
|
397
602
|
page.appendChild(el("div", { class: "kb-head" }, [
|
|
398
603
|
el("div", { class: "kb-head-text" }, [
|
|
399
604
|
el("h2", { class: "kb-title", text: t("ws.title") }),
|
|
400
605
|
el("p", { class: "kb-sub", text: t("ws.sub") }),
|
|
401
606
|
]),
|
|
402
|
-
el("div", { class: "kb-head-actions" }, [recallBtn, addSourceButton()]),
|
|
607
|
+
el("div", { class: "kb-head-actions" }, [statsBtn, recallBtn, addSourceButton(), settingsBtn]),
|
|
403
608
|
]));
|
|
404
609
|
|
|
405
610
|
const data = state.data;
|
|
@@ -432,7 +637,8 @@
|
|
|
432
637
|
]);
|
|
433
638
|
const cur = state.folder ? rootOf(state.folder) : state.folder;
|
|
434
639
|
const item = (f, label, actions) => {
|
|
435
|
-
const
|
|
640
|
+
const active = cur === f;
|
|
641
|
+
const row = el("div", { class: "kb-nav-item" + (active ? " active" : ""), role: "button", tabindex: "0" }, [
|
|
436
642
|
el("span", { class: "kb-nav-name", text: label, "data-tooltip": label, "data-tooltip-overflow": true }),
|
|
437
643
|
el("span", { class: "kb-nav-count", text: String(entriesIn(f).length) }),
|
|
438
644
|
actions ? el("span", { class: "kb-nav-acts" }, actions) : null,
|
|
@@ -610,6 +816,269 @@
|
|
|
610
816
|
return `${sameYear ? day : day + ", " + d.getFullYear()} ${clock}`;
|
|
611
817
|
}
|
|
612
818
|
|
|
819
|
+
// ── Statistics ─────────────────────────────────────────────────────────
|
|
820
|
+
// Aggregated server-side from the question log; this side only lays it out.
|
|
821
|
+
// The grouping unit is a conversation, so the same page works for IM
|
|
822
|
+
// accounts (one bot per person) and for web-only installations.
|
|
823
|
+
|
|
824
|
+
function openStats() {
|
|
825
|
+
const { overlay, box, close } = modal("kb-modal-stats", () => {
|
|
826
|
+
state.statsBox = null;
|
|
827
|
+
state.statsClose = null;
|
|
828
|
+
state.statsBody = null;
|
|
829
|
+
});
|
|
830
|
+
state.statsBox = box;
|
|
831
|
+
state.statsClose = close;
|
|
832
|
+
document.body.appendChild(overlay);
|
|
833
|
+
// A new question may have been logged since the last look, so the cached
|
|
834
|
+
// key must not satisfy this open; filters keep their values and the same
|
|
835
|
+
// key is still reused while the dialog stays open.
|
|
836
|
+
state.statsKey = "";
|
|
837
|
+
drawStatsModal();
|
|
838
|
+
loadStats();
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
// Rebuilt rather than redrawn when the filter set changes: both dependent
|
|
842
|
+
// dropdowns are built from the payload they filter, so a body-only redraw
|
|
843
|
+
// would leave them listing nothing.
|
|
844
|
+
function drawStatsModal() {
|
|
845
|
+
const box = state.statsBox;
|
|
846
|
+
if (!box) return;
|
|
847
|
+
const picker = (items, selected, onSelect) => selectBox(items, selected, onSelect).wrapper;
|
|
848
|
+
const rangePicker = picker(
|
|
849
|
+
RANGES.map((v) => ({ value: v, label: t("stats.range." + v) })),
|
|
850
|
+
state.range,
|
|
851
|
+
(v) => {
|
|
852
|
+
if (v === state.range) return;
|
|
853
|
+
state.range = v;
|
|
854
|
+
state.statsSession = "";
|
|
855
|
+
state.statsTheme = "";
|
|
856
|
+
state.statsKey = "";
|
|
857
|
+
try { localStorage.setItem(RANGE_KEY, v); } catch (_e) { /* private mode */ }
|
|
858
|
+
drawStatsModal();
|
|
859
|
+
loadStats();
|
|
860
|
+
},
|
|
861
|
+
);
|
|
862
|
+
const known = state.stats || { filters: { sessions: [], themes: [] } };
|
|
863
|
+
const sessionPicker = picker(
|
|
864
|
+
[{ value: "", label: t("stats.allSessions") }].concat(known.filters.sessions.map((s) => ({ value: s.key, label: s.name }))),
|
|
865
|
+
state.statsSession,
|
|
866
|
+
(v) => { state.statsSession = v; state.statsKey = ""; loadStats(); },
|
|
867
|
+
);
|
|
868
|
+
const themePicker = picker(
|
|
869
|
+
[{ value: "", label: t("stats.allThemes") }].concat(known.filters.themes.map((x) => ({ value: x.key, label: themeLabel(x.key) }))),
|
|
870
|
+
state.statsTheme,
|
|
871
|
+
(v) => { state.statsTheme = v; state.statsKey = ""; loadStats(); },
|
|
872
|
+
);
|
|
873
|
+
|
|
874
|
+
const body = el("div", { class: "kb-stats-body" });
|
|
875
|
+
state.statsBody = body;
|
|
876
|
+
box.replaceChildren(
|
|
877
|
+
el("div", { class: "kb-modal-head" }, [
|
|
878
|
+
el("div", {}, [
|
|
879
|
+
el("h3", { class: "kb-modal-title", text: t("stats.title") }),
|
|
880
|
+
el("p", { class: "kb-stats-sub", text: t("stats.sub") }),
|
|
881
|
+
]),
|
|
882
|
+
el("button", {
|
|
883
|
+
type: "button", class: "modal-close-btn", "aria-label": t("close"),
|
|
884
|
+
onclick: () => { if (state.statsClose) state.statsClose(); },
|
|
885
|
+
}),
|
|
886
|
+
]),
|
|
887
|
+
el("div", { class: "kb-stats-bar" }, [rangePicker, sessionPicker, themePicker]),
|
|
888
|
+
body,
|
|
889
|
+
);
|
|
890
|
+
drawStatsBody();
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
async function loadStats() {
|
|
894
|
+
const key = `${state.range}|${state.statsSession}|${state.statsTheme}`;
|
|
895
|
+
if (state.statsKey === key && state.stats) { drawStatsBody(); return; }
|
|
896
|
+
const hadFilters = !!(state.stats && state.stats.filters);
|
|
897
|
+
state.statsLoading = true;
|
|
898
|
+
state.statsError = "";
|
|
899
|
+
drawStatsBody();
|
|
900
|
+
try {
|
|
901
|
+
const data = await call("GET", `/stats?range=${encodeURIComponent(state.range)}`
|
|
902
|
+
+ `&session=${encodeURIComponent(state.statsSession)}&theme=${encodeURIComponent(state.statsTheme)}`);
|
|
903
|
+
state.stats = data;
|
|
904
|
+
state.statsKey = key;
|
|
905
|
+
} catch (e) {
|
|
906
|
+
state.stats = null;
|
|
907
|
+
state.statsError = t("loadFailed", { msg: e.message });
|
|
908
|
+
}
|
|
909
|
+
state.statsLoading = false;
|
|
910
|
+
// The session / topic dropdowns are built from this payload, so the first
|
|
911
|
+
// answer has to rebuild the whole dialog; redrawing only the body would
|
|
912
|
+
// leave them empty until it is reopened.
|
|
913
|
+
if (!hadFilters) drawStatsModal();
|
|
914
|
+
drawStatsBody();
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
function drawStatsBody() {
|
|
918
|
+
const body = state.statsBody;
|
|
919
|
+
if (!body || !body.isConnected) return;
|
|
920
|
+
if (state.statsError) { body.replaceChildren(el("div", { class: "kb-error", text: state.statsError })); return; }
|
|
921
|
+
if (state.statsLoading || !state.stats) { body.replaceChildren(el("div", { class: "kb-skeleton" })); return; }
|
|
922
|
+
|
|
923
|
+
const d = state.stats;
|
|
924
|
+
if (!d.kpi.total) {
|
|
925
|
+
body.replaceChildren(el("div", { class: "kb-empty" }, [
|
|
926
|
+
el("div", { class: "kb-empty-icon" }, [svg("history", null, 28)]),
|
|
927
|
+
el("div", { class: "kb-empty-title", text: t("stats.empty") }),
|
|
928
|
+
el("div", { class: "kb-empty-desc", text: t("stats.empty.sub") }),
|
|
929
|
+
]));
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
body.replaceChildren(
|
|
933
|
+
kpiGrid(d.kpi),
|
|
934
|
+
trendBlock(d.trend),
|
|
935
|
+
themesBlock(d.themes),
|
|
936
|
+
topBlock(d.top),
|
|
937
|
+
gapsBlock(d.gaps),
|
|
938
|
+
hoursBlock(d.hours),
|
|
939
|
+
sessionsBlock(d.sessions),
|
|
940
|
+
);
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
const fmtNum = (n) => Number(n || 0).toLocaleString();
|
|
944
|
+
const pctText = (v) => `${(Number(v || 0) * 100).toFixed(1)}%`;
|
|
945
|
+
|
|
946
|
+
// The log stores "\u0000" for "nothing matched"; the panel never shows it.
|
|
947
|
+
function themeLabel(key) {
|
|
948
|
+
if (key === "\u0000") return t("stats.unmatched");
|
|
949
|
+
return key ? key : t("unfiled");
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
function statSection(title, sub, content) {
|
|
953
|
+
return el("section", { class: "kb-stat-section" }, [
|
|
954
|
+
el("div", { class: "kb-stat-h" }, [
|
|
955
|
+
el("span", { class: "kb-stat-h-title", text: title }),
|
|
956
|
+
sub ? el("span", { class: "kb-stat-h-sub", text: sub }) : null,
|
|
957
|
+
]),
|
|
958
|
+
content,
|
|
959
|
+
]);
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
function kpiGrid(k) {
|
|
963
|
+
const card = (label, value, sub) => el("div", { class: "kb-stat-card" }, [
|
|
964
|
+
el("div", { class: "kb-stat-label", text: label }),
|
|
965
|
+
el("div", { class: "kb-stat-value", text: value }),
|
|
966
|
+
el("div", { class: "kb-stat-sub", text: sub }),
|
|
967
|
+
]);
|
|
968
|
+
return el("div", { class: "kb-stat-grid" }, [
|
|
969
|
+
card(t("stats.kpi.total"), fmtNum(k.total), t("stats.kpi.total.sub")),
|
|
970
|
+
card(t("stats.kpi.sessions"), fmtNum(k.sessions), t("stats.kpi.sessions.sub")),
|
|
971
|
+
card(t("stats.kpi.hit"), pctText(k.hit_rate), t("stats.kpi.hit.sub", { n: fmtNum(k.hit), total: fmtNum(k.total) })),
|
|
972
|
+
card(t("stats.kpi.gaps"), fmtNum(k.gaps), t("stats.kpi.gaps.sub")),
|
|
973
|
+
]);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
function bucketLabel(bucket, key) {
|
|
977
|
+
if (!key) return "";
|
|
978
|
+
if (bucket === "month") return key;
|
|
979
|
+
return key.slice(5).replace("-", "/");
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
function barChart(buckets, peakKey, label) {
|
|
983
|
+
const max = Math.max(...buckets.map((b) => b.count), 1);
|
|
984
|
+
const bars = el("div", { class: "kb-bars" }, buckets.map((b) => el("div", {
|
|
985
|
+
class: "kb-bar" + (peakKey != null && b.key === peakKey ? " peak" : ""),
|
|
986
|
+
"data-tooltip": `${label(b)} · ${b.count}`, "data-tooltip-pos": "top",
|
|
987
|
+
}, [el("span", { style: `height:${Math.max(2, Math.round((b.count / max) * 100))}%` })])));
|
|
988
|
+
return { bars, max };
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
function trendBlock(trend) {
|
|
992
|
+
const buckets = trend.buckets || [];
|
|
993
|
+
if (!buckets.length) return statSection(t("stats.trend", { unit: t("stats.unit." + trend.bucket) }), null,
|
|
994
|
+
el("div", { class: "kb-stats-none", text: t("stats.empty") }));
|
|
995
|
+
const label = (b) => bucketLabel(trend.bucket, b.key);
|
|
996
|
+
const chart = barChart(buckets, null, label);
|
|
997
|
+
if (buckets.length <= 3) chart.bars.classList.add("kb-bars-few");
|
|
998
|
+
const axis = el("div", { class: "kb-chart-axis" }, [
|
|
999
|
+
el("span", { text: label(buckets[0]) }),
|
|
1000
|
+
el("span", { text: label(buckets[buckets.length - 1]) }),
|
|
1001
|
+
]);
|
|
1002
|
+
return statSection(t("stats.trend", { unit: t("stats.unit." + trend.bucket) }), null,
|
|
1003
|
+
el("div", { class: "kb-chart" }, [chart.bars, axis]));
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
function themesBlock(themes) {
|
|
1007
|
+
const list = (themes || []).slice(0, 8);
|
|
1008
|
+
if (!list.length) return statSection(t("stats.themes"), t("stats.themes.sub"), el("div", { class: "kb-stats-none", text: t("stats.empty") }));
|
|
1009
|
+
const max = Math.max(...list.map((x) => x.count), 1);
|
|
1010
|
+
const rows = list.map((x) => el("div", { class: "kb-theme-row" }, [
|
|
1011
|
+
el("span", { class: "kb-theme-name", text: themeLabel(x.key), "data-tooltip": themeLabel(x.key), "data-tooltip-overflow": true }),
|
|
1012
|
+
el("span", { class: "kb-theme-bar" }, [el("span", { style: `width:${Math.round((x.count / max) * 100)}%` })]),
|
|
1013
|
+
el("span", { class: "kb-theme-count", text: `${fmtNum(x.count)} · ${pctText(x.share)}` }),
|
|
1014
|
+
]));
|
|
1015
|
+
return statSection(t("stats.themes"), t("stats.themes.sub"), el("div", { class: "kb-theme-list" }, rows));
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
function statsTable(kind, labels, rows, emptyText) {
|
|
1019
|
+
if (!rows.length) return el("div", { class: "kb-stats-none", text: emptyText });
|
|
1020
|
+
const table = el("div", { class: "kb-stats-table " + kind });
|
|
1021
|
+
table.appendChild(el("div", { class: "kb-stats-row kb-stats-thead" }, labels.map((l) => el("span", { text: l }))));
|
|
1022
|
+
rows.forEach((cells) => table.appendChild(el("div", { class: "kb-stats-row" }, cells)));
|
|
1023
|
+
return table;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
function topBlock(top) {
|
|
1027
|
+
const rows = (top || []).map((x, i) => [
|
|
1028
|
+
el("span", { class: "kb-stats-q" }, [
|
|
1029
|
+
el("span", { class: "kb-stats-rank", text: String(i + 1) }),
|
|
1030
|
+
el("span", { class: "kb-stats-qtext", text: x.q, "data-tooltip": x.q, "data-tooltip-overflow": true }),
|
|
1031
|
+
]),
|
|
1032
|
+
el("span", { class: "kb-stats-topic" }, [el("span", { class: "kb-tag" + (x.theme ? "" : " kb-tag-muted"), text: themeLabel(x.theme) })]),
|
|
1033
|
+
el("span", { class: "kb-stats-num", text: fmtNum(x.count) }),
|
|
1034
|
+
el("span", { class: "kb-stats-time", text: fmtDate(x.last) }),
|
|
1035
|
+
]);
|
|
1036
|
+
return statSection(t("stats.top"), null, statsTable("top",
|
|
1037
|
+
[t("stats.col.question"), t("stats.col.topic"), t("stats.col.times"), t("stats.col.last")], rows, t("stats.empty")));
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
function gapsBlock(gaps) {
|
|
1041
|
+
const rows = (gaps || []).map((x) => [
|
|
1042
|
+
el("span", { class: "kb-stats-qtext", text: x.q, "data-tooltip": x.q, "data-tooltip-overflow": true }),
|
|
1043
|
+
el("span", { class: "kb-stats-num", text: fmtNum(x.count) }),
|
|
1044
|
+
el("span", { class: "kb-stats-time", text: fmtDate(x.last) }),
|
|
1045
|
+
]);
|
|
1046
|
+
return statSection(t("stats.gaps"), t("stats.gaps.sub"), statsTable("gaps",
|
|
1047
|
+
[t("stats.col.question"), t("stats.col.times"), t("stats.col.last")], rows, t("stats.gaps.empty")));
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
function hoursBlock(hours) {
|
|
1051
|
+
const max = Math.max(...hours.buckets.map((b) => b.count), 1);
|
|
1052
|
+
const bars = el("div", { class: "kb-bars kb-bars-hours" }, hours.buckets.map((b) => el("div", {
|
|
1053
|
+
class: "kb-bar" + (hours.peak === b.hour ? " peak" : ""),
|
|
1054
|
+
"data-tooltip": `${b.hour}:00 · ${b.count}`, "data-tooltip-pos": "top",
|
|
1055
|
+
}, [el("span", { style: `height:${Math.max(2, Math.round((b.count / max) * 100))}%` })])));
|
|
1056
|
+
const axis = el("div", { class: "kb-chart-axis kb-chart-axis-hours" }, ["0:00", "6:00", "12:00", "18:00", "23:00"].map((h) => el("span", { text: h })));
|
|
1057
|
+
const sub = hours.peak == null ? null : t("stats.peak", { h: hours.peak });
|
|
1058
|
+
return statSection(t("stats.hours"), sub, el("div", { class: "kb-chart" }, [bars, axis]));
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
function sourceLabel(src) {
|
|
1062
|
+
if (src.src !== "channel") return t("stats.src.web");
|
|
1063
|
+
const dict = KB_I18N[isZh() ? "zh" : "en"];
|
|
1064
|
+
const key = "stats.pf." + src.platform;
|
|
1065
|
+
return dict[key] || src.platform || t("stats.src.web");
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
function sessionsBlock(list) {
|
|
1069
|
+
const rows = (list || []).map((s) => [
|
|
1070
|
+
el("span", { class: "kb-stats-session" }, [
|
|
1071
|
+
el("span", { class: "kb-stats-qtext", text: s.name, "data-tooltip": s.name, "data-tooltip-overflow": true }),
|
|
1072
|
+
el("span", { class: "kb-tag kb-tag-muted", text: sourceLabel(s) }),
|
|
1073
|
+
]),
|
|
1074
|
+
el("span", { class: "kb-stats-num", text: fmtNum(s.count) }),
|
|
1075
|
+
el("span", { class: "kb-stats-num", text: fmtNum(s.days) }),
|
|
1076
|
+
el("span", { class: "kb-stats-time", text: fmtDate(s.last) }),
|
|
1077
|
+
]);
|
|
1078
|
+
return statSection(t("stats.sessions"), null, statsTable("sessions",
|
|
1079
|
+
[t("stats.col.session"), t("stats.col.times"), t("stats.col.days"), t("stats.col.last")], rows, t("stats.empty")));
|
|
1080
|
+
}
|
|
1081
|
+
|
|
613
1082
|
// ── Rename / move / folders ────────────────────────────────────────────
|
|
614
1083
|
// Small one-field dialog (host form styles); onSubmit throws to stay open.
|
|
615
1084
|
function promptBox({ title, label, value, okText, onSubmit }) {
|
|
@@ -753,8 +1222,10 @@
|
|
|
753
1222
|
|
|
754
1223
|
// ── Add data source ────────────────────────────────────────────────────
|
|
755
1224
|
let openMenu = null;
|
|
1225
|
+
let openMenuBtn = null;
|
|
756
1226
|
function closeMenus() {
|
|
757
1227
|
if (openMenu) { openMenu.remove(); openMenu = null; }
|
|
1228
|
+
if (openMenuBtn) { openMenuBtn.classList.remove("is-open"); openMenuBtn = null; }
|
|
758
1229
|
}
|
|
759
1230
|
document.addEventListener("click", closeMenus);
|
|
760
1231
|
document.addEventListener("keydown", (e) => { if (e.key === "Escape") closeMenus(); });
|
|
@@ -785,8 +1256,11 @@
|
|
|
785
1256
|
openMenu = el("div", { class: "kb-menu" }, [
|
|
786
1257
|
item("upload", t("add.files"), t("add.files.desc"), pickFiles),
|
|
787
1258
|
item("folder", t("add.folder"), t("add.folder.desc"), pickFolder),
|
|
1259
|
+
item("mic", t("add.rec"), t("add.rec.desc"), startRecording),
|
|
788
1260
|
]);
|
|
789
1261
|
openMenu.addEventListener("click", (e) => e.stopPropagation());
|
|
1262
|
+
openMenuBtn = btn;
|
|
1263
|
+
btn.classList.add("is-open");
|
|
790
1264
|
holder.appendChild(openMenu);
|
|
791
1265
|
});
|
|
792
1266
|
return holder;
|
|
@@ -951,6 +1425,226 @@
|
|
|
951
1425
|
document.body.appendChild(overlay);
|
|
952
1426
|
}
|
|
953
1427
|
|
|
1428
|
+
// ── Record audio ───────────────────────────────────────────────────────
|
|
1429
|
+
// Speech is cut into sentences on the client (VAD in /lib/audio-recorder.js)
|
|
1430
|
+
// and each sentence is transcribed by the server while the user keeps
|
|
1431
|
+
// talking, so captions appear as they speak. Nothing is saved until the user
|
|
1432
|
+
// reviews the text, optionally has the model tidy it up, and picks a folder.
|
|
1433
|
+
const REC_SUMMARY_MAX = 20000;
|
|
1434
|
+
|
|
1435
|
+
function startRecording() {
|
|
1436
|
+
const ar = window.Clacky && Clacky.AudioRecorder;
|
|
1437
|
+
if (!ar) { toast(t("rec.unsupported"), "error"); return; }
|
|
1438
|
+
if (!ar.secure()) { toast(t("rec.sec"), "error"); return; }
|
|
1439
|
+
if (!ar.supported()) { toast(t("rec.unsupported"), "error"); return; }
|
|
1440
|
+
openRecorder(ar);
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
function openRecorder(ar) {
|
|
1444
|
+
const base = state.folder || "";
|
|
1445
|
+
const startedAt = Date.now();
|
|
1446
|
+
const lines = [];
|
|
1447
|
+
let handle = null;
|
|
1448
|
+
let timer = null;
|
|
1449
|
+
let stopped = false;
|
|
1450
|
+
let closed = false;
|
|
1451
|
+
let fatal = false;
|
|
1452
|
+
let inFlight = 0;
|
|
1453
|
+
let rawText = null;
|
|
1454
|
+
|
|
1455
|
+
const m = modal("kb-modal-rec", () => {
|
|
1456
|
+
closed = true;
|
|
1457
|
+
if (handle) handle.stop();
|
|
1458
|
+
if (timer) clearInterval(timer);
|
|
1459
|
+
}, { dismissable: false });
|
|
1460
|
+
const { box } = m;
|
|
1461
|
+
|
|
1462
|
+
const dot = el("span", { class: "kb-rec-dot" });
|
|
1463
|
+
const statusEl = el("span", { class: "kb-rec-state", text: t("rec.starting") });
|
|
1464
|
+
const clock = el("span", { class: "kb-rec-time", text: "00:00" });
|
|
1465
|
+
const bar = el("span", { class: "kb-rec-bar" });
|
|
1466
|
+
const linesEl = el("div", { class: "kb-rec-lines" });
|
|
1467
|
+
const empty = el("div", { class: "kb-rec-empty", text: t("rec.empty") });
|
|
1468
|
+
linesEl.appendChild(empty);
|
|
1469
|
+
const stopBtn = el("button", { class: "kb-btn kb-btn-primary", type: "button", disabled: true, text: t("rec.stop") });
|
|
1470
|
+
|
|
1471
|
+
box.replaceChildren(
|
|
1472
|
+
modalHeader(t("rec.title"), () => m.close()),
|
|
1473
|
+
el("div", { class: "kb-rec-status" }, [
|
|
1474
|
+
dot, statusEl, clock,
|
|
1475
|
+
el("span", { class: "kb-rec-meter" }, [bar]),
|
|
1476
|
+
]),
|
|
1477
|
+
linesEl,
|
|
1478
|
+
el("p", { class: "kb-rec-hint", text: t("rec.hint") }),
|
|
1479
|
+
el("div", { class: "kb-modal-foot kb-pick-foot" }, [stopBtn]),
|
|
1480
|
+
);
|
|
1481
|
+
document.body.appendChild(m.overlay);
|
|
1482
|
+
|
|
1483
|
+
stopBtn.addEventListener("click", stopRecording);
|
|
1484
|
+
|
|
1485
|
+
ar.start({ onSegment: onSegment, onLevel: onLevel }).then((h) => {
|
|
1486
|
+
handle = h;
|
|
1487
|
+
if (stopped || closed) { h.stop(); return; }
|
|
1488
|
+
dot.classList.add("is-live");
|
|
1489
|
+
statusEl.textContent = t("rec.listening");
|
|
1490
|
+
stopBtn.disabled = false;
|
|
1491
|
+
timer = setInterval(() => {
|
|
1492
|
+
const s = Math.floor((Date.now() - startedAt) / 1000);
|
|
1493
|
+
clock.textContent = `${String(Math.floor(s / 60)).padStart(2, "0")}:${String(s % 60).padStart(2, "0")}`;
|
|
1494
|
+
}, 500);
|
|
1495
|
+
}).catch((err) => {
|
|
1496
|
+
m.close();
|
|
1497
|
+
if (err.code === "insecure_context") toast(t("rec.sec"), "error");
|
|
1498
|
+
else if (err.name === "NotAllowedError" || err.name === "SecurityError") toast(t("rec.denied"), "error");
|
|
1499
|
+
else if (err.name === "NotFoundError" || err.name === "DevicesNotFoundError") toast(t("rec.noDevice"), "error");
|
|
1500
|
+
else toast(t("rec.unsupported"), "error");
|
|
1501
|
+
});
|
|
1502
|
+
|
|
1503
|
+
function onLevel(rms) {
|
|
1504
|
+
bar.style.transform = `scaleX(${Math.min(1, Math.sqrt(rms) * 3).toFixed(3)})`;
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
function stopRecording() {
|
|
1508
|
+
if (stopped) return;
|
|
1509
|
+
stopped = true;
|
|
1510
|
+
stopBtn.disabled = true;
|
|
1511
|
+
statusEl.textContent = t("rec.wait");
|
|
1512
|
+
dot.classList.remove("is-live");
|
|
1513
|
+
bar.style.transform = "scaleX(0)";
|
|
1514
|
+
if (timer) { clearInterval(timer); timer = null; }
|
|
1515
|
+
if (handle) handle.stop();
|
|
1516
|
+
if (inFlight === 0) showConfirm();
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
async function onSegment(blob) {
|
|
1520
|
+
if (closed || fatal) return;
|
|
1521
|
+
inFlight += 1;
|
|
1522
|
+
if (empty.parentNode) empty.remove();
|
|
1523
|
+
|
|
1524
|
+
const row = el("div", { class: "kb-rec-line is-pending" }, [el("span", { class: "kb-spinner" })]);
|
|
1525
|
+
const item = { row: row, text: "" };
|
|
1526
|
+
lines.push(item);
|
|
1527
|
+
linesEl.appendChild(row);
|
|
1528
|
+
linesEl.scrollTop = linesEl.scrollHeight;
|
|
1529
|
+
|
|
1530
|
+
try {
|
|
1531
|
+
const payload = await ar.encode(blob);
|
|
1532
|
+
if (!payload) { drop(item); return; }
|
|
1533
|
+
const res = await call("POST", "/transcribe", payload);
|
|
1534
|
+
const text = (res.text || "").trim();
|
|
1535
|
+
if (!text) { drop(item); return; }
|
|
1536
|
+
item.text = text;
|
|
1537
|
+
row.classList.remove("is-pending");
|
|
1538
|
+
row.textContent = text;
|
|
1539
|
+
} catch (err) {
|
|
1540
|
+
if (err.type === "stt_not_configured") {
|
|
1541
|
+
fatal = true;
|
|
1542
|
+
drop(item);
|
|
1543
|
+
toast(t("rec.sttMissing"), "error");
|
|
1544
|
+
if (!stopped) stopRecording();
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
row.classList.remove("is-pending");
|
|
1548
|
+
row.classList.add("is-error");
|
|
1549
|
+
row.textContent = t("rec.segFailed");
|
|
1550
|
+
} finally {
|
|
1551
|
+
inFlight -= 1;
|
|
1552
|
+
if (closed) return;
|
|
1553
|
+
linesEl.scrollTop = linesEl.scrollHeight;
|
|
1554
|
+
if (stopped && inFlight === 0) showConfirm();
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
function drop(item) {
|
|
1559
|
+
const i = lines.indexOf(item);
|
|
1560
|
+
if (i >= 0) lines.splice(i, 1);
|
|
1561
|
+
item.row.remove();
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
function showConfirm() {
|
|
1565
|
+
if (closed || box.querySelector(".kb-rec-form")) return;
|
|
1566
|
+
const raw = lines.map((l) => l.text).filter(Boolean).join("\n").trim();
|
|
1567
|
+
if (!raw) { m.close(); toast(t("rec.nothing"), "error"); return; }
|
|
1568
|
+
rawText = raw;
|
|
1569
|
+
|
|
1570
|
+
const titleInput = el("input", { class: "form-input", type: "text", maxlength: "200",
|
|
1571
|
+
value: t("rec.defaultTitle", { time: fmtDate(new Date().toISOString()) }) });
|
|
1572
|
+
const folderSel = selectBox(
|
|
1573
|
+
[""].concat(folderOrder()).map((f) => ({ value: f, label: loc(f) })),
|
|
1574
|
+
base,
|
|
1575
|
+
);
|
|
1576
|
+
const ta = el("textarea", { class: "kb-rec-text form-input", rows: "12", spellcheck: "false" });
|
|
1577
|
+
ta.value = raw;
|
|
1578
|
+
|
|
1579
|
+
const sumLabel = el("span", { text: t("rec.summarize") });
|
|
1580
|
+
const sumBtn = el("button", { class: "kb-btn kb-btn-ghost kb-btn-sm", type: "button" }, [svg("zap", null, 15), sumLabel]);
|
|
1581
|
+
const restoreBtn = el("button", { class: "kb-btn kb-btn-ghost kb-btn-sm", type: "button", text: t("rec.restore"), hidden: true });
|
|
1582
|
+
const saveBtn = el("button", { class: "kb-btn kb-btn-primary", type: "button", text: t("rec.save") });
|
|
1583
|
+
|
|
1584
|
+
sumBtn.addEventListener("click", async () => {
|
|
1585
|
+
const body = ta.value.trim();
|
|
1586
|
+
if (!body) return;
|
|
1587
|
+
if (body.length > REC_SUMMARY_MAX) { toast(t("rec.tooLong", { n: REC_SUMMARY_MAX.toLocaleString() }), "error"); return; }
|
|
1588
|
+
sumBtn.disabled = true;
|
|
1589
|
+
const original = sumLabel.textContent;
|
|
1590
|
+
sumLabel.textContent = t("rec.summarizing");
|
|
1591
|
+
try {
|
|
1592
|
+
const res = await call("POST", "/summarize", { text: body, lang: isZh() ? "zh" : "en" });
|
|
1593
|
+
if (!rawText) rawText = body;
|
|
1594
|
+
ta.value = res.text;
|
|
1595
|
+
restoreBtn.hidden = false;
|
|
1596
|
+
toast(t("rec.summarized"), "success");
|
|
1597
|
+
} catch (err) {
|
|
1598
|
+
toast(err.type === "llm_not_configured" ? t("rec.llmMissing") : t("rec.sumFailed", { msg: errText(err.message) }), "error");
|
|
1599
|
+
} finally {
|
|
1600
|
+
sumBtn.disabled = false;
|
|
1601
|
+
sumLabel.textContent = original;
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1604
|
+
|
|
1605
|
+
restoreBtn.addEventListener("click", () => {
|
|
1606
|
+
if (!rawText) return;
|
|
1607
|
+
ta.value = rawText;
|
|
1608
|
+
restoreBtn.hidden = true;
|
|
1609
|
+
});
|
|
1610
|
+
|
|
1611
|
+
saveBtn.addEventListener("click", async () => {
|
|
1612
|
+
const body = ta.value.trim();
|
|
1613
|
+
if (!body) { toast(t("rec.nothing"), "error"); return; }
|
|
1614
|
+
saveBtn.disabled = true;
|
|
1615
|
+
try {
|
|
1616
|
+
await call("POST", "/entry", {
|
|
1617
|
+
folder: folderSel.select.value,
|
|
1618
|
+
title: titleInput.value.trim() || t("rec.defaultTitle", { time: fmtDate(new Date().toISOString()) }),
|
|
1619
|
+
source: t("rec.source"),
|
|
1620
|
+
body,
|
|
1621
|
+
});
|
|
1622
|
+
m.close();
|
|
1623
|
+
toast(t("done", { n: 1 }), "success");
|
|
1624
|
+
await reload();
|
|
1625
|
+
} catch (err) {
|
|
1626
|
+
saveBtn.disabled = false;
|
|
1627
|
+
toast(errText(err.message), "error");
|
|
1628
|
+
}
|
|
1629
|
+
});
|
|
1630
|
+
|
|
1631
|
+
box.replaceChildren(
|
|
1632
|
+
modalHeader(t("rec.confirmTitle"), () => m.close()),
|
|
1633
|
+
el("div", { class: "kb-rec-form" }, [
|
|
1634
|
+
el("label", { class: "form-group" }, [el("span", { class: "form-label", text: t("rec.fieldTitle") }), titleInput]),
|
|
1635
|
+
el("label", { class: "form-group" }, [el("span", { class: "form-label", text: t("rec.fieldFolder") }), folderSel.wrapper]),
|
|
1636
|
+
el("label", { class: "form-group kb-rec-body" }, [el("span", { class: "form-label", text: t("rec.fieldBody") }), ta]),
|
|
1637
|
+
el("div", { class: "kb-rec-tools" }, [sumBtn, restoreBtn]),
|
|
1638
|
+
]),
|
|
1639
|
+
el("div", { class: "kb-modal-foot kb-pick-foot" }, [
|
|
1640
|
+
el("button", { class: "kb-btn kb-btn-ghost", type: "button", text: t("cancel"), onclick: () => m.close() }),
|
|
1641
|
+
saveBtn,
|
|
1642
|
+
]),
|
|
1643
|
+
);
|
|
1644
|
+
ta.focus();
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
|
|
954
1648
|
// ── Edit (host Markdown editor: source + live preview) ─────────────────
|
|
955
1649
|
async function openEntry(path) {
|
|
956
1650
|
let entry;
|
|
@@ -977,16 +1671,20 @@
|
|
|
977
1671
|
}
|
|
978
1672
|
|
|
979
1673
|
// ── Modal helpers ──────────────────────────────────────────────────────
|
|
980
|
-
function modal(extraClass) {
|
|
1674
|
+
function modal(extraClass, onClose, options) {
|
|
1675
|
+
const dismissable = !(options && options.dismissable === false);
|
|
981
1676
|
const box = el("div", { class: "kb-modal " + (extraClass || ""), role: "dialog", "aria-modal": "true" });
|
|
982
1677
|
const overlay = el("div", { class: "modal-overlay kb-overlay" }, [box]);
|
|
983
1678
|
const onKey = (e) => { if (e.key === "Escape") close(); };
|
|
984
1679
|
function close() {
|
|
985
1680
|
overlay.remove();
|
|
986
1681
|
document.removeEventListener("keydown", onKey);
|
|
1682
|
+
if (onClose) onClose();
|
|
1683
|
+
}
|
|
1684
|
+
if (dismissable) {
|
|
1685
|
+
overlay.addEventListener("mousedown", (e) => { if (e.target === overlay) close(); });
|
|
1686
|
+
document.addEventListener("keydown", onKey);
|
|
987
1687
|
}
|
|
988
|
-
overlay.addEventListener("mousedown", (e) => { if (e.target === overlay) close(); });
|
|
989
|
-
document.addEventListener("keydown", onKey);
|
|
990
1688
|
return { overlay, box, close };
|
|
991
1689
|
}
|
|
992
1690
|
|
|
@@ -997,6 +1695,88 @@
|
|
|
997
1695
|
]);
|
|
998
1696
|
}
|
|
999
1697
|
|
|
1698
|
+
// Shared dropdown (components/custom-select.js): a native <select> cannot be
|
|
1699
|
+
// themed to match the panel. Lives under <body> while open so the modal's
|
|
1700
|
+
// own scroll container cannot clip it.
|
|
1701
|
+
function selectBox(items, selected, onSelect) {
|
|
1702
|
+
const wrapper = el("div", { class: "custom-select-wrapper kb-select" });
|
|
1703
|
+
const trigger = el("div", { class: "custom-select-trigger", tabindex: "0" }, [
|
|
1704
|
+
el("span", { class: "custom-select-value" }),
|
|
1705
|
+
svg("chevron", "custom-select-arrow", 14),
|
|
1706
|
+
]);
|
|
1707
|
+
const dropdown = el("div", { class: "custom-select-dropdown" });
|
|
1708
|
+
items.forEach((item) => {
|
|
1709
|
+
dropdown.appendChild(el("div", {
|
|
1710
|
+
class: "custom-select-option" + (item.value === selected ? " selected" : ""),
|
|
1711
|
+
"data-value": item.value,
|
|
1712
|
+
"data-label": item.label,
|
|
1713
|
+
text: item.label,
|
|
1714
|
+
}));
|
|
1715
|
+
});
|
|
1716
|
+
wrapper.append(trigger, dropdown);
|
|
1717
|
+
const select = CustomSelect.init({ trigger, dropdown, portal: true, onSelect });
|
|
1718
|
+
// Pass the label explicitly: setValue otherwise looks the option up with an
|
|
1719
|
+
// attribute selector built from the raw value, which never matches the
|
|
1720
|
+
// "\u0000" key used for unanswered questions.
|
|
1721
|
+
const picked = items.find((item) => item.value === selected);
|
|
1722
|
+
select.setValue(selected, picked ? picked.label : selected);
|
|
1723
|
+
return { wrapper, select };
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
// ── Settings ───────────────────────────────────────────────────────────
|
|
1727
|
+
// One switch, phrased as the normal state: "Allow every tool" is on by
|
|
1728
|
+
// default (full toolset); turning it off pins the agent to kb_search /
|
|
1729
|
+
// kb_read and, with the same whitelist, drops memory, skills and base.md.
|
|
1730
|
+
// Stored as owner data on the server, and applied to new sessions only.
|
|
1731
|
+
async function openSettings() {
|
|
1732
|
+
let allowAll;
|
|
1733
|
+
try {
|
|
1734
|
+
allowAll = (await call("GET", "/settings")).allow_all_tools !== false;
|
|
1735
|
+
} catch (e) {
|
|
1736
|
+
toast(errText(e.message), "error");
|
|
1737
|
+
return;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
const { overlay, box, close } = modal("kb-modal-sm");
|
|
1741
|
+
const desc = el("div", { class: "kb-set-desc", text: t("set.allTools.desc") });
|
|
1742
|
+
|
|
1743
|
+
const toggle = el("button", {
|
|
1744
|
+
type: "button", class: "kb-switch" + (allowAll ? " on" : ""), role: "switch",
|
|
1745
|
+
"aria-checked": String(allowAll),
|
|
1746
|
+
}, [el("span", { class: "kb-switch-knob" })]);
|
|
1747
|
+
toggle.addEventListener("click", () => {
|
|
1748
|
+
allowAll = !allowAll;
|
|
1749
|
+
toggle.classList.toggle("on", allowAll);
|
|
1750
|
+
toggle.setAttribute("aria-checked", String(allowAll));
|
|
1751
|
+
});
|
|
1752
|
+
|
|
1753
|
+
const save = el("button", { class: "kb-btn kb-btn-primary", type: "button", text: t("set.save") });
|
|
1754
|
+
save.addEventListener("click", async () => {
|
|
1755
|
+
save.disabled = true;
|
|
1756
|
+
try {
|
|
1757
|
+
await call("POST", "/settings", { allow_all_tools: allowAll });
|
|
1758
|
+
close();
|
|
1759
|
+
toast(t("set.saved"), "success");
|
|
1760
|
+
} catch (e) {
|
|
1761
|
+
save.disabled = false;
|
|
1762
|
+
toast(errText(e.message), "error");
|
|
1763
|
+
}
|
|
1764
|
+
});
|
|
1765
|
+
|
|
1766
|
+
box.append(
|
|
1767
|
+
modalHeader(t("set.title"), close),
|
|
1768
|
+
el("div", { class: "kb-set-row" }, [
|
|
1769
|
+
el("div", { class: "kb-set-text" }, [
|
|
1770
|
+
el("div", { class: "kb-set-name", text: t("set.allTools") }),
|
|
1771
|
+
desc,
|
|
1772
|
+
]),
|
|
1773
|
+
toggle,
|
|
1774
|
+
]),
|
|
1775
|
+
el("div", { class: "kb-modal-foot" }, [save]),
|
|
1776
|
+
);
|
|
1777
|
+
document.body.appendChild(overlay);
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1000
1780
|
// ── Recall test ────────────────────────────────────────────────────────
|
|
1001
1781
|
function openRecall() {
|
|
1002
1782
|
const { overlay, box, close } = modal("kb-modal-recall");
|
|
@@ -1044,7 +1824,124 @@
|
|
|
1044
1824
|
const field = el("div", { class: "kb-recall-field" }, [svg("search", "kb-recall-icon", 16), input, histBtn, menu]);
|
|
1045
1825
|
const form = el("form", { class: "kb-recall-form" }, [field, btn]);
|
|
1046
1826
|
const results = el("div", { class: "kb-recall-results" });
|
|
1047
|
-
|
|
1827
|
+
const main = el("div", { class: "kb-recall-main" }, [form, results]);
|
|
1828
|
+
const aside = el("aside", { class: "kb-recall-aside" });
|
|
1829
|
+
const body = el("div", { class: "kb-recall-body" }, [main, aside]);
|
|
1830
|
+
box.append(modalHeader(t("recall.title"), close), body);
|
|
1831
|
+
|
|
1832
|
+
// Test question list: stored server-side next to kb.yml, so it survives a
|
|
1833
|
+
// different browser and ships with the knowledge folder.
|
|
1834
|
+
let cases = [];
|
|
1835
|
+
let casesError = "";
|
|
1836
|
+
let adding = false;
|
|
1837
|
+
|
|
1838
|
+
function drawCases() {
|
|
1839
|
+
const head = el("div", { class: "kb-cases-head" }, [
|
|
1840
|
+
svg("flask", "kb-cases-icon", 15),
|
|
1841
|
+
el("span", { class: "kb-cases-title", text: t("recall.cases") }),
|
|
1842
|
+
cases.length ? el("span", { class: "kb-cases-count", text: String(cases.length) }) : null,
|
|
1843
|
+
el("span", { class: "kb-spacer" }),
|
|
1844
|
+
el("button", {
|
|
1845
|
+
type: "button", class: "kb-cases-add",
|
|
1846
|
+
"aria-label": t("recall.cases.add"), "data-tooltip": t("recall.cases.add"), "data-tooltip-pos": "bottom",
|
|
1847
|
+
onclick: startAdd,
|
|
1848
|
+
}, [svg("plus", null, 15)]),
|
|
1849
|
+
]);
|
|
1850
|
+
|
|
1851
|
+
const nodes = [head];
|
|
1852
|
+
if (adding) nodes.push(addField());
|
|
1853
|
+
if (casesError) nodes.push(el("div", { class: "kb-cases-err", text: casesError }));
|
|
1854
|
+
if (!cases.length && !adding && !casesError) {
|
|
1855
|
+
nodes.push(el("div", { class: "kb-cases-empty" }, [
|
|
1856
|
+
el("div", { class: "kb-cases-empty-icon" }, [svg("flask", null, 28)]),
|
|
1857
|
+
el("div", { class: "kb-cases-empty-title", text: t("recall.cases.empty") }),
|
|
1858
|
+
el("div", { class: "kb-cases-empty-sub", text: t("recall.cases.empty.sub") }),
|
|
1859
|
+
]));
|
|
1860
|
+
} else if (cases.length) {
|
|
1861
|
+
nodes.push(el("div", { class: "kb-cases-list" }, cases.map(caseRow)));
|
|
1862
|
+
}
|
|
1863
|
+
aside.replaceChildren(...nodes);
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
function caseRow(q, i) {
|
|
1867
|
+
return el("div", { class: "kb-case" }, [
|
|
1868
|
+
el("button", {
|
|
1869
|
+
type: "button", class: "kb-case-q", title: q,
|
|
1870
|
+
onclick: () => {
|
|
1871
|
+
input.value = q;
|
|
1872
|
+
input.dispatchEvent(new Event("input"));
|
|
1873
|
+
hide();
|
|
1874
|
+
run();
|
|
1875
|
+
},
|
|
1876
|
+
}, [el("span", { class: "kb-case-text", text: q })]),
|
|
1877
|
+
el("button", {
|
|
1878
|
+
type: "button", class: "kb-case-del",
|
|
1879
|
+
"aria-label": t("recall.cases.del"), "data-tooltip": t("recall.cases.del"), "data-tooltip-pos": "bottom",
|
|
1880
|
+
onclick: (ev) => { ev.stopPropagation(); persistCases(cases.filter((_, j) => j !== i), t("recall.cases.deleted")); },
|
|
1881
|
+
}, [svg("trash", null, 14)]),
|
|
1882
|
+
]);
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
function addField() {
|
|
1886
|
+
const field = el("input", {
|
|
1887
|
+
type: "text", class: "kb-case-input", placeholder: t("recall.cases.ph"), maxlength: 300,
|
|
1888
|
+
});
|
|
1889
|
+
field.addEventListener("keydown", (ev) => {
|
|
1890
|
+
if (ev.key === "Escape") {
|
|
1891
|
+
ev.preventDefault();
|
|
1892
|
+
ev.stopPropagation();
|
|
1893
|
+
adding = false;
|
|
1894
|
+
drawCases();
|
|
1895
|
+
return;
|
|
1896
|
+
}
|
|
1897
|
+
if (ev.key !== "Enter") return;
|
|
1898
|
+
ev.preventDefault();
|
|
1899
|
+
const v = field.value.trim();
|
|
1900
|
+
adding = false;
|
|
1901
|
+
if (!v || cases.includes(v)) { drawCases(); return; }
|
|
1902
|
+
persistCases([...cases, v], t("recall.cases.added"));
|
|
1903
|
+
});
|
|
1904
|
+
field.addEventListener("blur", () => {
|
|
1905
|
+
if (adding && !field.value.trim()) { adding = false; drawCases(); }
|
|
1906
|
+
});
|
|
1907
|
+
setTimeout(() => field.focus(), 0);
|
|
1908
|
+
return field;
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
function startAdd() {
|
|
1912
|
+
adding = true;
|
|
1913
|
+
drawCases();
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
async function loadCases() {
|
|
1917
|
+
try {
|
|
1918
|
+
cases = (await call("GET", "/cases")).cases || [];
|
|
1919
|
+
casesError = "";
|
|
1920
|
+
} catch (e) {
|
|
1921
|
+
cases = [];
|
|
1922
|
+
casesError = e.message;
|
|
1923
|
+
}
|
|
1924
|
+
drawCases();
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
async function persistCases(next, okMsg) {
|
|
1928
|
+
const grew = next.length > cases.length;
|
|
1929
|
+
const before = aside.querySelector(".kb-cases-list");
|
|
1930
|
+
const keep = before ? before.scrollTop : 0;
|
|
1931
|
+
try {
|
|
1932
|
+
cases = (await call("POST", "/cases", { cases: next })).cases || [];
|
|
1933
|
+
casesError = "";
|
|
1934
|
+
if (okMsg) toast(okMsg, "success");
|
|
1935
|
+
drawCases();
|
|
1936
|
+
// New questions are appended at the bottom, which is off-screen once
|
|
1937
|
+
// the list is long; a delete must not jump back to the top either.
|
|
1938
|
+
const list = aside.querySelector(".kb-cases-list");
|
|
1939
|
+
if (list) list.scrollTop = grew ? list.scrollHeight : keep;
|
|
1940
|
+
} catch (e) {
|
|
1941
|
+
toast(t("loadFailed", { msg: e.message }), "error");
|
|
1942
|
+
drawCases();
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1048
1945
|
|
|
1049
1946
|
// Clicking anywhere else closes the dropdown; it also unhooks itself once
|
|
1050
1947
|
// the modal is gone.
|
|
@@ -1087,6 +1984,7 @@
|
|
|
1087
1984
|
form.addEventListener("submit", (ev) => { ev.preventDefault(); run(); });
|
|
1088
1985
|
|
|
1089
1986
|
document.body.appendChild(overlay);
|
|
1987
|
+
loadCases();
|
|
1090
1988
|
if (state.lastQuery.trim()) run();
|
|
1091
1989
|
else placeholder(t("recall.empty"), t("recall.empty.sub"));
|
|
1092
1990
|
setTimeout(() => input.focus(), 30);
|
|
@@ -1192,7 +2090,8 @@
|
|
|
1192
2090
|
.kb-btn-primary:not(:disabled):hover { filter: brightness(1.06); }
|
|
1193
2091
|
.kb-btn-ghost { background: var(--color-bg-primary); color: var(--color-text-secondary); border-color: var(--color-border-primary); }
|
|
1194
2092
|
.kb-btn-ghost:hover { color: var(--color-text-primary); background: var(--color-bg-hover); }
|
|
1195
|
-
.kb-chevron { margin-left: 2px; opacity: .8; }
|
|
2093
|
+
.kb-chevron { margin-left: 2px; opacity: .8; transition: transform .15s ease; }
|
|
2094
|
+
.kb-btn.is-open .kb-chevron { transform: rotate(180deg); }
|
|
1196
2095
|
.kb-menu-holder { position: relative; }
|
|
1197
2096
|
.kb-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; width: 288px; padding: 6px; background: var(--color-bg-primary); border: 1px solid var(--color-border-primary); border-radius: 12px; box-shadow: var(--shadow-lg, 0 12px 32px rgba(0,0,0,.12)); animation: kb-pop .12s ease-out; }
|
|
1198
2097
|
@keyframes kb-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
|
|
@@ -1277,13 +2176,128 @@
|
|
|
1277
2176
|
.kb-row-acts { position: static; transform: none; opacity: 1; }
|
|
1278
2177
|
.kb-row-end { min-width: 0; }
|
|
1279
2178
|
}
|
|
2179
|
+
.kb-stats-bar { align-items: flex-start; }
|
|
2180
|
+
.kb-stats-sub { margin: 4px 0 0; font-size: 0.75rem; color: var(--color-text-tertiary); }
|
|
2181
|
+
.kb-stats-bar { flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
|
2182
|
+
.kb-stats-bar .custom-select-wrapper.kb-select { width: auto; }
|
|
2183
|
+
.kb-stats-bar .custom-select-trigger { min-width: 7.5rem; height: 32px; padding: 0 0.625rem; font-size: 0.8125rem; }
|
|
2184
|
+
.kb-stats-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; margin-top: 12px; padding-right: 4px; }
|
|
2185
|
+
.kb-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
|
|
2186
|
+
.kb-stat-card { min-width: 0; padding: 12px 14px; border: 1px solid var(--color-border-primary); border-radius: 12px; background: var(--color-bg-primary); }
|
|
2187
|
+
.kb-stat-label { font-size: 0.75rem; color: var(--color-text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
2188
|
+
.kb-stat-value { margin-top: 6px; font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em; color: var(--color-text-primary); font-variant-numeric: tabular-nums; }
|
|
2189
|
+
.kb-stat-sub { margin-top: 2px; font-size: 0.6875rem; color: var(--color-text-tertiary); }
|
|
2190
|
+
.kb-stat-section { min-width: 0; }
|
|
2191
|
+
.kb-stat-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; min-width: 0; }
|
|
2192
|
+
.kb-stat-h-title { font-size: 0.8125rem; font-weight: 600; color: var(--color-text-primary); }
|
|
2193
|
+
.kb-stat-h-sub { min-width: 0; font-size: 0.6875rem; color: var(--color-text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2194
|
+
.kb-stats-none { padding: 20px 12px; text-align: center; font-size: 0.8125rem; color: var(--color-text-tertiary); border: 1px dashed var(--color-border-primary); border-radius: 10px; }
|
|
2195
|
+
.kb-chart { padding: 12px 14px 8px; border: 1px solid var(--color-border-primary); border-radius: 12px; background: var(--color-bg-primary); }
|
|
2196
|
+
.kb-bars { display: flex; align-items: flex-end; gap: 2px; height: 96px; }
|
|
2197
|
+
.kb-bar { flex: 1; min-width: 2px; display: flex; align-items: flex-end; height: 100%; }
|
|
2198
|
+
/* One or two buckets must not stretch into a slab. */
|
|
2199
|
+
.kb-bars-few .kb-bar { flex: 0 0 auto; width: 44px; }
|
|
2200
|
+
.kb-bar > span { width: 100%; border-radius: 3px 3px 0 0; background: color-mix(in srgb, ${ACCENT} 45%, transparent); transition: background .12s; }
|
|
2201
|
+
.kb-bar:hover > span, .kb-bar.peak > span { background: ${ACCENT}; }
|
|
2202
|
+
.kb-chart-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 0.6875rem; color: var(--color-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
2203
|
+
.kb-theme-list { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--color-border-primary); border-radius: 12px; background: var(--color-bg-primary); }
|
|
2204
|
+
.kb-theme-row { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) 6.5rem; align-items: center; gap: 10px; }
|
|
2205
|
+
.kb-theme-name { font-size: 0.8125rem; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
2206
|
+
.kb-theme-bar { height: 8px; border-radius: 4px; background: var(--color-bg-secondary); overflow: hidden; }
|
|
2207
|
+
.kb-theme-bar > span { display: block; height: 100%; border-radius: 4px; background: color-mix(in srgb, ${ACCENT} 60%, transparent); }
|
|
2208
|
+
.kb-theme-count { text-align: right; font-size: 0.75rem; color: var(--color-text-tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
2209
|
+
.kb-stats-table { border: 1px solid var(--color-border-primary); border-radius: 12px; overflow: hidden; background: var(--color-bg-primary); }
|
|
2210
|
+
.kb-stats-row { display: grid; align-items: center; gap: 10px; min-height: 38px; padding: 8px 14px; font-size: 0.8125rem; }
|
|
2211
|
+
.kb-stats-row + .kb-stats-row { border-top: 1px solid var(--color-border-primary); }
|
|
2212
|
+
.kb-stats-thead { min-height: 30px; font-size: 0.6875rem; color: var(--color-text-tertiary); background: var(--color-bg-secondary); }
|
|
2213
|
+
.kb-stats-table.top .kb-stats-row { grid-template-columns: minmax(0, 1fr) 8rem 3rem 7rem; }
|
|
2214
|
+
.kb-stats-table.gaps .kb-stats-row { grid-template-columns: minmax(0, 1fr) 3rem 7rem; }
|
|
2215
|
+
.kb-stats-table.sessions .kb-stats-row { grid-template-columns: minmax(0, 1fr) 3rem 4rem 7rem; }
|
|
2216
|
+
.kb-stats-q { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
2217
|
+
.kb-stats-rank { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 5px; font-size: 0.625rem; font-weight: 600; color: var(--color-text-tertiary); background: var(--color-bg-secondary); font-variant-numeric: tabular-nums; }
|
|
2218
|
+
.kb-stats-qtext { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-primary); }
|
|
2219
|
+
.kb-stats-session { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
2220
|
+
.kb-stats-num, .kb-stats-time { text-align: right; color: var(--color-text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
|
|
2221
|
+
.kb-stats-time { font-size: 0.75rem; color: var(--color-text-tertiary); }
|
|
2222
|
+
.kb-tag-muted { color: var(--color-text-tertiary); }
|
|
2223
|
+
.kb-stats-body .kb-tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
|
|
2224
|
+
@media (max-width: 900px) {
|
|
2225
|
+
.kb-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
2226
|
+
.kb-stats-table.top .kb-stats-row { grid-template-columns: minmax(0, 1fr) 3rem; }
|
|
2227
|
+
.kb-stats-table.top .kb-stats-row > :nth-child(2),
|
|
2228
|
+
.kb-stats-table.top .kb-stats-row > :nth-child(4) { display: none; }
|
|
2229
|
+
.kb-stats-table.sessions .kb-stats-row { grid-template-columns: minmax(0, 1fr) 3rem 7rem; }
|
|
2230
|
+
.kb-stats-table.sessions .kb-stats-row > :nth-child(3) { display: none; }
|
|
2231
|
+
.kb-stats-bar { align-items: stretch; }
|
|
2232
|
+
.kb-stats-bar .custom-select-wrapper.kb-select { flex: 1; }
|
|
2233
|
+
}
|
|
1280
2234
|
.kb-overlay { z-index: 120; }
|
|
1281
|
-
.kb-modal { width: min(92vw, 640px); max-height: 86vh; display: flex; flex-direction: column; background: var(--color-bg-primary); border: 1px solid var(--color-border-primary); border-radius: 16px; box-shadow: var(--shadow-lg, 0 24px 60px rgba(0,0,0,.18)); padding: 20px 24px 24px; animation: modal-box-in var(--transition-slow, .2s); }
|
|
2235
|
+
.kb-modal { width: min(92vw, 640px); max-height: 86vh; display: flex; flex-direction: column; overflow: hidden; background: var(--color-bg-primary); border: 1px solid var(--color-border-primary); border-radius: 16px; box-shadow: var(--shadow-lg, 0 24px 60px rgba(0,0,0,.18)); padding: 20px 24px 24px; animation: modal-box-in var(--transition-slow, .2s); }
|
|
2236
|
+
.kb-modal-stats { width: min(96vw, 1000px); height: min(90vh, 820px); }
|
|
2237
|
+
.kb-modal-stats .kb-modal-head { margin-bottom: 12px; }
|
|
1282
2238
|
.kb-modal-sm { width: min(92vw, 440px); }
|
|
1283
|
-
.kb-
|
|
1284
|
-
.kb-
|
|
2239
|
+
.kb-set-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 0 4px; }
|
|
2240
|
+
.kb-set-text { flex: 1; min-width: 0; }
|
|
2241
|
+
.kb-set-name { font-size: .875rem; font-weight: 600; color: var(--color-text-primary); }
|
|
2242
|
+
.kb-set-desc { margin-top: 6px; font-size: .8125rem; line-height: 1.55; color: var(--color-text-secondary); }
|
|
2243
|
+
.kb-switch { position: relative; flex: none; width: 40px; height: 24px; margin-top: 2px; padding: 0; border: 0; border-radius: 999px; background: var(--color-border-primary); cursor: pointer; transition: background .18s ease; }
|
|
2244
|
+
.kb-switch.on { background: var(--color-accent-primary); }
|
|
2245
|
+
.kb-switch:focus-visible { outline: 2px solid var(--color-accent-primary); outline-offset: 2px; }
|
|
2246
|
+
.kb-switch-knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s ease; }
|
|
2247
|
+
.kb-switch.on .kb-switch-knob { transform: translateX(16px); }
|
|
2248
|
+
.kb-modal-rec { width: min(94vw, 720px); }
|
|
2249
|
+
.kb-rec-status { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
|
|
2250
|
+
.kb-rec-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--color-text-tertiary); }
|
|
2251
|
+
.kb-rec-dot.is-live { background: var(--color-error); animation: kb-rec-pulse 1.3s ease-in-out infinite; }
|
|
2252
|
+
@keyframes kb-rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .28; } }
|
|
2253
|
+
.kb-rec-state { font-size: 0.8125rem; color: var(--color-text-secondary); }
|
|
2254
|
+
.kb-rec-time { margin-left: auto; font-size: 0.8125rem; color: var(--color-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
2255
|
+
.kb-rec-meter { flex: none; width: 4.5rem; height: 4px; border-radius: 2px; background: var(--color-bg-secondary); overflow: hidden; }
|
|
2256
|
+
.kb-rec-bar { display: block; width: 100%; height: 100%; border-radius: 2px; background: ${ACCENT}; transform: scaleX(0); transform-origin: left center; transition: transform .09s linear; }
|
|
2257
|
+
.kb-rec-lines { flex: 1; min-height: 12rem; max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--color-border-primary); border-radius: 12px; background: var(--color-bg-secondary); }
|
|
2258
|
+
.kb-rec-line { font-size: 0.875rem; line-height: 1.7; color: var(--color-text-primary); white-space: pre-wrap; }
|
|
2259
|
+
.kb-rec-line.is-pending { display: flex; align-items: center; }
|
|
2260
|
+
.kb-rec-line.is-error { font-size: 0.8125rem; color: var(--color-error); }
|
|
2261
|
+
.kb-rec-empty { margin: auto; padding: 2rem 0; text-align: center; font-size: 0.8125rem; color: var(--color-text-tertiary); }
|
|
2262
|
+
.kb-rec-hint { margin: 10px 0 0; font-size: 0.75rem; color: var(--color-text-tertiary); }
|
|
2263
|
+
.kb-rec-form { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 2px; }
|
|
2264
|
+
.kb-rec-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
|
|
2265
|
+
.kb-select { width: 100%; }
|
|
2266
|
+
.kb-select .custom-select-trigger { height: 2.25rem; padding: 0 0.75rem; font-size: 0.8125rem; }
|
|
2267
|
+
.kb-rec-text { flex: 1 1 auto; min-height: 8rem; padding: 10px 12px; font-family: inherit; line-height: 1.65; resize: vertical; }
|
|
2268
|
+
.kb-rec-tools { display: flex; align-items: center; gap: 8px; }
|
|
2269
|
+
.kb-rec-tools [hidden] { display: none; }
|
|
2270
|
+
.kb-modal-recall { width: min(94vw, 960px); height: min(86vh, 720px); }
|
|
2271
|
+
.kb-recall-body { flex: 1; min-height: 0; display: flex; gap: 20px; }
|
|
2272
|
+
.kb-recall-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
|
2273
|
+
.kb-recall-aside { flex: none; width: 15rem; min-height: 0; display: flex; flex-direction: column; padding-left: 18px; border-left: 1px solid var(--color-border-primary); }
|
|
2274
|
+
.kb-cases-head { display: flex; align-items: center; gap: 6px; padding-bottom: 6px; }
|
|
2275
|
+
.kb-cases-icon { flex: none; color: var(--color-text-tertiary); }
|
|
2276
|
+
.kb-cases-title { font-size: 0.8125rem; font-weight: 600; color: var(--color-text-secondary); }
|
|
2277
|
+
.kb-cases-count { font-size: 0.75rem; color: var(--color-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
2278
|
+
.kb-cases-add { display: flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border: none; border-radius: 6px; background: none; color: var(--color-text-tertiary); cursor: pointer; transition: background .15s, color .15s; }
|
|
2279
|
+
.kb-cases-add:hover { color: ${ACCENT}; background: color-mix(in srgb, ${ACCENT} 8%, transparent); }
|
|
2280
|
+
.kb-cases-list { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 1px; margin: 0 -6px; padding: 2px 6px; }
|
|
2281
|
+
.kb-case { display: flex; flex: none; align-items: center; border-radius: 8px; transition: background .12s; }
|
|
2282
|
+
.kb-case:hover { background: var(--color-bg-hover); }
|
|
2283
|
+
.kb-case-q { flex: 1; min-width: 0; display: flex; align-items: center; padding: 7px 8px; border: none; background: none; font: inherit; font-size: 0.8125rem; color: var(--color-text-primary); text-align: left; cursor: pointer; }
|
|
2284
|
+
.kb-case-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2285
|
+
.kb-case-del { flex: none; display: flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; margin-right: 3px; border: none; border-radius: 6px; background: none; color: var(--color-text-tertiary); cursor: pointer; opacity: 0; transition: opacity .12s, color .12s, background .12s; }
|
|
2286
|
+
.kb-case:hover .kb-case-del, .kb-case-del:focus-visible { opacity: 1; }
|
|
2287
|
+
.kb-case-del:hover { color: var(--color-error); background: var(--color-error-bg); }
|
|
2288
|
+
.kb-case-input { width: 100%; height: 2rem; margin-bottom: 2px; padding: 0 8px; border-radius: 8px; border: 1px solid ${ACCENT}; background: var(--color-bg-primary); color: var(--color-text-primary); font-size: 0.8125rem; outline: none; }
|
|
2289
|
+
.kb-cases-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 8px; color: var(--color-text-tertiary); }
|
|
2290
|
+
.kb-cases-empty-icon { opacity: .4; margin-bottom: 10px; }
|
|
2291
|
+
.kb-cases-empty-title { font-size: 0.8125rem; color: var(--color-text-secondary); }
|
|
2292
|
+
.kb-cases-empty-sub { font-size: 0.75rem; margin-top: 6px; line-height: 1.6; }
|
|
2293
|
+
.kb-cases-err { font-size: 0.75rem; color: var(--color-error); padding: 4px 2px; }
|
|
2294
|
+
@media (max-width: 720px) {
|
|
2295
|
+
.kb-recall-body { flex-direction: column; }
|
|
2296
|
+
.kb-recall-aside { width: auto; max-height: 40%; padding: 14px 0 0; border-left: none; border-top: 1px solid var(--color-border-primary); }
|
|
2297
|
+
}
|
|
2298
|
+
.kb-modal-head { flex: none; display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
|
|
1285
2299
|
.kb-modal-title { margin: 0; font-size: 1.0625rem; font-weight: 600; color: var(--color-text-primary); }
|
|
1286
|
-
.kb-modal-foot { display: flex; justify-content: flex-end; margin-top: 16px; }
|
|
2300
|
+
.kb-modal-foot { flex: none; display: flex; justify-content: flex-end; margin-top: 16px; }
|
|
1287
2301
|
.kb-fail-list { display: flex; flex-direction: column; gap: 8px; overflow: auto; }
|
|
1288
2302
|
.kb-fail { padding: 10px 12px; border-radius: 10px; background: var(--color-bg-secondary); }
|
|
1289
2303
|
.kb-fail-file { font-size: 0.8125rem; font-weight: 500; color: var(--color-text-primary); word-break: break-all; }
|