dsh-colophon 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/client.js +266 -76
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,6 +103,13 @@ usage.jsonl API 调用账本(rules 引擎不写)
|
|
|
103
103
|
- 摘要面板新增「下载 Markdown」按钮(直接保存为 `.md` 文件)
|
|
104
104
|
- 版本号 0.2.0;测试 38 项全绿
|
|
105
105
|
|
|
106
|
+
## 0.2.1(设置界面可读性)
|
|
107
|
+
|
|
108
|
+
- 设置页重做:渐变标题卡 + 状态胶囊、强调条卡片、整行可点的开关(带滑动圆钮)、蓝底主按钮「保存修改」、描边次按钮「处理队列」/「查询」
|
|
109
|
+
- 所有可点击元素都有明确的按钮形态与悬停反馈,队列为空时「处理队列」自动置灰
|
|
110
|
+
- 触发时机、API 预算、用量区间(时/日/周/月/自定义)分组更清晰,警告文案用琥珀色提示条
|
|
111
|
+
- 版本号 0.2.1;截图更新至 `docs/screenshots/settings.png`
|
|
112
|
+
|
|
106
113
|
## 已实现(P2 · 客户端)
|
|
107
114
|
|
|
108
115
|
- 输入框上方「卷末」胶囊:点击展开摘要面板(Markdown 预览、复制、重新生成)
|
package/client.js
CHANGED
|
@@ -37,7 +37,7 @@ window.__ModuleLoader__.load({
|
|
|
37
37
|
failed: '读取失败:{message}',
|
|
38
38
|
crash: '上次 DSH 没有正常退出,卷末已在本地恢复(0 token)。',
|
|
39
39
|
crashAck: '知道了',
|
|
40
|
-
settingsLabel: '卷末
|
|
40
|
+
settingsLabel: '卷末 Colophon',
|
|
41
41
|
settingsIntro: '规则引擎只读本地日志,不调用模型、不花 token;API 摘要为可选项。',
|
|
42
42
|
engine: '摘要引擎',
|
|
43
43
|
engineRules: '本地规则(0 token)',
|
|
@@ -85,6 +85,22 @@ window.__ModuleLoader__.load({
|
|
|
85
85
|
queueRun: '队列已处理',
|
|
86
86
|
apiUnavailable: '当前环境没有可用的模型服务(llm):API 引擎会回退到本地 rules 摘要,并把它放进待确认队列。',
|
|
87
87
|
statusFailed: '状态读取失败',
|
|
88
|
+
basicTitle: '基本设置',
|
|
89
|
+
statusOn: '已启用',
|
|
90
|
+
statusOff: '已暂停',
|
|
91
|
+
settingsSubtitle: '把每次对话的最终结论留在本地;重开会话时先看结论,不必重读整段历史。',
|
|
92
|
+
saveHint: '保存后立即生效,无需重启。',
|
|
93
|
+
enabledHint: '关闭后不再采集新会话;已有摘要仍可查看。',
|
|
94
|
+
engineHint: 'rules 完全本地,0 token;api 每次生成会调用模型,并受下方预算限制。',
|
|
95
|
+
onIdleHint: '智能体停止后几秒内写出摘要。',
|
|
96
|
+
onSwitchHint: '在另一个会话里开始输入时,先总结上一个会话。',
|
|
97
|
+
apiOn: '已开启',
|
|
98
|
+
apiOff: '未开启',
|
|
99
|
+
apply: '查询',
|
|
100
|
+
rangeInvalid: '时间范围无效(开始时间需早于结束时间)。',
|
|
101
|
+
customHint: '结束时间留空表示到当前时刻。',
|
|
102
|
+
queueHint: '这些会话在花费 token 前等待你确认。',
|
|
103
|
+
save: '保存修改',
|
|
88
104
|
},
|
|
89
105
|
en: {
|
|
90
106
|
chip: 'Colophon',
|
|
@@ -150,6 +166,22 @@ window.__ModuleLoader__.load({
|
|
|
150
166
|
queueRun: 'Queue processed',
|
|
151
167
|
apiUnavailable: 'No model service (llm) is available here: the API engine falls back to local rules digests and queues the session for confirmation.',
|
|
152
168
|
statusFailed: 'Status unavailable',
|
|
169
|
+
basicTitle: 'Basics',
|
|
170
|
+
statusOn: 'Enabled',
|
|
171
|
+
statusOff: 'Paused',
|
|
172
|
+
settingsSubtitle: 'Keep every conversation’s final conclusion locally. Reopen a session and read the conclusion first — no need to replay the whole history.',
|
|
173
|
+
saveHint: 'Changes take effect immediately after saving.',
|
|
174
|
+
enabledHint: 'When off, new sessions are no longer captured; existing digests stay readable.',
|
|
175
|
+
engineHint: 'Local rules cost 0 tokens. The API engine calls a model per digest and is capped by the budgets below.',
|
|
176
|
+
onIdleHint: 'Write the digest a few seconds after the agent stops.',
|
|
177
|
+
onSwitchHint: 'Summarize the previous session when you start typing in another one.',
|
|
178
|
+
apiOn: 'On',
|
|
179
|
+
apiOff: 'Off',
|
|
180
|
+
apply: 'Apply',
|
|
181
|
+
rangeInvalid: 'Pick a valid time range (from ≤ to).',
|
|
182
|
+
customHint: 'Leave the end empty to use the current moment.',
|
|
183
|
+
queueHint: 'Sessions waiting for your confirmation before spending tokens.',
|
|
184
|
+
save: 'Save changes',
|
|
153
185
|
},
|
|
154
186
|
}
|
|
155
187
|
|
|
@@ -222,6 +254,82 @@ window.__ModuleLoader__.load({
|
|
|
222
254
|
cardValue: { fontSize: 15, fontWeight: 600, marginTop: 2 },
|
|
223
255
|
warn: { color: '#ffd27a', fontSize: 11 },
|
|
224
256
|
ok: { color: '#4cc38a', fontSize: 11 },
|
|
257
|
+
|
|
258
|
+
// ---- Settings page ----
|
|
259
|
+
page: { display: 'flex', flexDirection: 'column', gap: 14, fontSize: 13, maxWidth: 760, paddingBottom: 8, lineHeight: 1.5 },
|
|
260
|
+
headCard: {
|
|
261
|
+
display: 'flex', flexDirection: 'column', gap: 6, padding: '18px 20px', borderRadius: 14,
|
|
262
|
+
border: '1px solid rgba(255,255,255,0.08)',
|
|
263
|
+
background: 'linear-gradient(135deg, rgba(79,124,255,0.12), rgba(255,255,255,0.02) 62%)',
|
|
264
|
+
},
|
|
265
|
+
headTitle: { display: 'flex', alignItems: 'center', gap: 10, flexWrap: 'wrap', fontSize: 17, fontWeight: 650 },
|
|
266
|
+
headSub: { fontSize: 12.5, lineHeight: 1.6, opacity: 0.7, maxWidth: 560 },
|
|
267
|
+
pill: { display: 'inline-flex', alignItems: 'center', gap: 6, height: 22, padding: '0 10px', borderRadius: 999, fontSize: 11.5, fontWeight: 600, whiteSpace: 'nowrap' },
|
|
268
|
+
pillOn: { background: 'rgba(76,195,138,0.14)', color: '#6fe0a8', border: '1px solid rgba(76,195,138,0.3)' },
|
|
269
|
+
pillOff: { background: 'rgba(255,255,255,0.06)', color: 'rgba(255,255,255,0.62)', border: '1px solid rgba(255,255,255,0.12)' },
|
|
270
|
+
card2: {
|
|
271
|
+
display: 'flex', flexDirection: 'column', gap: 12, padding: '16px 18px', borderRadius: 14,
|
|
272
|
+
border: '1px solid rgba(255,255,255,0.08)', background: 'rgba(255,255,255,0.028)',
|
|
273
|
+
},
|
|
274
|
+
cardHead: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 10 },
|
|
275
|
+
cardTitle: { display: 'flex', alignItems: 'center', gap: 8, fontSize: 13.5, fontWeight: 650 },
|
|
276
|
+
accentBar: { width: 3, height: 14, borderRadius: 2, background: '#4f7cff', display: 'inline-block' },
|
|
277
|
+
hint: { fontSize: 12, lineHeight: 1.6, opacity: 0.6 },
|
|
278
|
+
switchRow: {
|
|
279
|
+
display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 14,
|
|
280
|
+
padding: '10px 12px', borderRadius: 10, border: '1px solid rgba(255,255,255,0.07)',
|
|
281
|
+
background: 'rgba(0,0,0,0.16)', cursor: 'pointer', minHeight: 46, boxSizing: 'border-box',
|
|
282
|
+
},
|
|
283
|
+
switchRowOn: { borderColor: 'rgba(79,124,255,0.45)', background: 'rgba(79,124,255,0.1)' },
|
|
284
|
+
switchTrack: {
|
|
285
|
+
position: 'relative', flex: '0 0 auto', width: 38, height: 22, borderRadius: 999,
|
|
286
|
+
background: 'rgba(255,255,255,0.18)', transition: 'background 120ms ease',
|
|
287
|
+
},
|
|
288
|
+
switchTrackOn: { background: '#4f7cff' },
|
|
289
|
+
switchKnob: {
|
|
290
|
+
position: 'absolute', top: 3, left: 3, width: 16, height: 16, borderRadius: 999,
|
|
291
|
+
background: '#fff', transition: 'transform 120ms ease', boxShadow: '0 1px 3px rgba(0,0,0,0.4)',
|
|
292
|
+
},
|
|
293
|
+
switchKnobOn: { transform: 'translateX(16px)' },
|
|
294
|
+
callout: {
|
|
295
|
+
display: 'flex', gap: 8, padding: '10px 12px', borderRadius: 10,
|
|
296
|
+
border: '1px solid rgba(255,210,122,0.28)', background: 'rgba(255,210,122,0.08)',
|
|
297
|
+
color: '#ffd27a', fontSize: 12, lineHeight: 1.55,
|
|
298
|
+
},
|
|
299
|
+
fieldWide: { display: 'flex', flexDirection: 'column', gap: 5, minWidth: 150, flex: '1 1 150px', maxWidth: 300 },
|
|
300
|
+
inputWide: {
|
|
301
|
+
background: 'rgba(0,0,0,0.3)', color: 'inherit', border: '1px solid rgba(255,255,255,0.14)',
|
|
302
|
+
borderRadius: 8, height: 34, padding: '0 10px', fontSize: 13, width: '100%', boxSizing: 'border-box',
|
|
303
|
+
},
|
|
304
|
+
row2: { display: 'flex', gap: 12, flexWrap: 'wrap', alignItems: 'flex-end' },
|
|
305
|
+
actionsBar: { display: 'flex', alignItems: 'center', justifyContent: 'flex-end', gap: 10, paddingTop: 2 },
|
|
306
|
+
buttonPrimary: {
|
|
307
|
+
display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 6,
|
|
308
|
+
height: 36, minWidth: 104, padding: '0 18px', borderRadius: 9,
|
|
309
|
+
border: '1px solid rgba(79,124,255,0.9)', background: '#4f7cff', color: '#fff',
|
|
310
|
+
fontSize: 13, fontWeight: 650, cursor: 'pointer', boxShadow: '0 2px 10px rgba(79,124,255,0.35)',
|
|
311
|
+
},
|
|
312
|
+
buttonSecondary: {
|
|
313
|
+
display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 6,
|
|
314
|
+
height: 36, minWidth: 84, padding: '0 14px', borderRadius: 9,
|
|
315
|
+
border: '1px solid rgba(255,255,255,0.22)', background: 'rgba(255,255,255,0.05)',
|
|
316
|
+
color: 'inherit', fontSize: 13, fontWeight: 550, cursor: 'pointer',
|
|
317
|
+
},
|
|
318
|
+
buttonDisabled: { opacity: 0.45, cursor: 'not-allowed', boxShadow: 'none' },
|
|
319
|
+
usageGrid: { display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))', gap: 10 },
|
|
320
|
+
usageCard: {
|
|
321
|
+
display: 'flex', flexDirection: 'column', gap: 2, padding: '12px 14px', borderRadius: 12,
|
|
322
|
+
border: '1px solid rgba(255,255,255,0.08)', background: 'rgba(0,0,0,0.18)',
|
|
323
|
+
},
|
|
324
|
+
usageValue: { fontSize: 19, fontWeight: 650, letterSpacing: '-0.01em' },
|
|
325
|
+
listRow: {
|
|
326
|
+
display: 'flex', alignItems: 'center', gap: 10, flexWrap: 'wrap',
|
|
327
|
+
padding: '8px 10px', borderRadius: 8, background: 'rgba(0,0,0,0.16)', fontSize: 12,
|
|
328
|
+
},
|
|
329
|
+
emptyBox: {
|
|
330
|
+
padding: '14px 12px', borderRadius: 10, border: '1px dashed rgba(255,255,255,0.16)',
|
|
331
|
+
color: 'rgba(255,255,255,0.5)', fontSize: 12, textAlign: 'center',
|
|
332
|
+
},
|
|
225
333
|
}
|
|
226
334
|
|
|
227
335
|
/** Read/persist the crash banner acknowledgement. */
|
|
@@ -333,21 +441,21 @@ window.__ModuleLoader__.load({
|
|
|
333
441
|
: digest?.markdown ? h('pre', { style: styles.pre }, digest.markdown)
|
|
334
442
|
: h('div', { style: styles.muted }, tr('empty')),
|
|
335
443
|
h('div', { style: styles.actions },
|
|
336
|
-
h('button', { style: styles.
|
|
444
|
+
h('button', { style: styles.buttonPrimary, onClick: () => void generate(), disabled: loading },
|
|
337
445
|
digest ? tr('regenerate') : tr('generate')),
|
|
338
|
-
digest?.markdown ? h('button', { style: styles.
|
|
339
|
-
digest?.markdown ? h('button', { style: styles.
|
|
340
|
-
h('button', { style: styles.
|
|
446
|
+
digest?.markdown ? h('button', { style: styles.buttonSecondary, onClick: () => void copy() }, copied ? tr('copied') : tr('copy')) : null,
|
|
447
|
+
digest?.markdown ? h('button', { style: styles.buttonSecondary, onClick: () => void download() }, tr('download')) : null,
|
|
448
|
+
h('button', { style: styles.buttonSecondary, onClick: () => setOpen(false) }, tr('close')))) : null
|
|
341
449
|
|
|
342
450
|
return h(React.Fragment, null, h(CrashBanner), h('div', null, chip), panel)
|
|
343
451
|
}
|
|
344
452
|
|
|
345
453
|
/** One labelled number input bound to a form field. */
|
|
346
454
|
function NumberField({ label, value, onChange, step }) {
|
|
347
|
-
return h('label', { style: styles.
|
|
455
|
+
return h('label', { style: styles.fieldWide },
|
|
348
456
|
h('span', { style: styles.label }, label),
|
|
349
457
|
h('input', {
|
|
350
|
-
style: styles.
|
|
458
|
+
style: styles.inputWide,
|
|
351
459
|
type: 'number',
|
|
352
460
|
step: step ?? 1,
|
|
353
461
|
value: value ?? '',
|
|
@@ -362,11 +470,45 @@ window.__ModuleLoader__.load({
|
|
|
362
470
|
h('span', null, label))
|
|
363
471
|
}
|
|
364
472
|
|
|
473
|
+
/** One card section on the settings page. */
|
|
474
|
+
function Card({ title, extra, children }) {
|
|
475
|
+
return h('div', { style: styles.card2 },
|
|
476
|
+
h('div', { style: styles.cardHead },
|
|
477
|
+
h('div', { style: styles.cardTitle }, h('span', { style: styles.accentBar }), title),
|
|
478
|
+
extra ?? null),
|
|
479
|
+
children)
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/** A full-row toggle: the whole row is the click target, the knob is obvious. */
|
|
483
|
+
function SwitchRow({ label, hint, checked, onChange }) {
|
|
484
|
+
const on = checked === true
|
|
485
|
+
const toggle = () => onChange(!on)
|
|
486
|
+
return h('div', {
|
|
487
|
+
role: 'switch',
|
|
488
|
+
'aria-checked': on,
|
|
489
|
+
tabIndex: 0,
|
|
490
|
+
style: on ? { ...styles.switchRow, ...styles.switchRowOn } : styles.switchRow,
|
|
491
|
+
onClick: toggle,
|
|
492
|
+
onKeyDown: event => {
|
|
493
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
494
|
+
event.preventDefault()
|
|
495
|
+
toggle()
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
h('div', { style: { display: 'flex', flexDirection: 'column', gap: 3, minWidth: 0 } },
|
|
500
|
+
h('span', { style: { fontSize: 13 } }, label),
|
|
501
|
+
hint ? h('span', { style: styles.hint }, hint) : null),
|
|
502
|
+
h('div', { style: on ? { ...styles.switchTrack, ...styles.switchTrackOn } : styles.switchTrack },
|
|
503
|
+
h('div', { style: on ? { ...styles.switchKnob, ...styles.switchKnobOn } : styles.switchKnob })))
|
|
504
|
+
}
|
|
505
|
+
|
|
365
506
|
/** Settings page section: engine, triggers, API budget and usage cards. */
|
|
366
507
|
function ColophonSettings() {
|
|
367
508
|
const [form, setForm] = useState(null)
|
|
368
509
|
const [status, setStatus] = useState(null)
|
|
369
510
|
const [custom, setCustom] = useState(null)
|
|
511
|
+
const [range, setRange] = useState({ from: '', to: '' })
|
|
370
512
|
const [message, setMessage] = useState('')
|
|
371
513
|
const [failed, setFailed] = useState('')
|
|
372
514
|
|
|
@@ -426,6 +568,19 @@ window.__ModuleLoader__.load({
|
|
|
426
568
|
} catch { setCustom(null) }
|
|
427
569
|
}
|
|
428
570
|
|
|
571
|
+
const applyRange = () => {
|
|
572
|
+
const from = Date.parse(range.from)
|
|
573
|
+
const to = range.to === '' ? Date.now() : Date.parse(range.to)
|
|
574
|
+
if (!Number.isFinite(from) || !Number.isFinite(to) || from > to) {
|
|
575
|
+
setFailed(tr('rangeInvalid'))
|
|
576
|
+
setMessage('')
|
|
577
|
+
return
|
|
578
|
+
}
|
|
579
|
+
setFailed('')
|
|
580
|
+
setCustom(null)
|
|
581
|
+
void loadCustom(from, to)
|
|
582
|
+
}
|
|
583
|
+
|
|
429
584
|
if (!form) {
|
|
430
585
|
return h('div', { style: styles.section },
|
|
431
586
|
h(CrashBanner),
|
|
@@ -433,72 +588,100 @@ window.__ModuleLoader__.load({
|
|
|
433
588
|
}
|
|
434
589
|
|
|
435
590
|
const usage = status?.usage ?? {}
|
|
436
|
-
const
|
|
591
|
+
const usageCard = (label, range) => h('div', { style: styles.usageCard },
|
|
437
592
|
h('div', { style: styles.label }, label),
|
|
438
|
-
h('div', { style: styles.
|
|
439
|
-
h('div', { style: styles.
|
|
593
|
+
h('div', { style: styles.usageValue }, money(range?.costCNY)),
|
|
594
|
+
h('div', { style: styles.hint }, tr('tokensLabel', { tokens: integer(range?.tokens) }), ' · ', tr('calls', { count: range?.calls ?? 0 })))
|
|
595
|
+
|
|
596
|
+
const queueItems = status?.queueItems ?? []
|
|
597
|
+
const queueCount = Number(status?.queueCount ?? status?.queue ?? 0) || 0
|
|
598
|
+
const enabled = form.enabled === true
|
|
599
|
+
const apiOn = form.engine === 'api'
|
|
600
|
+
const pill = (on, onText, offText) => h('span', { style: on ? { ...styles.pill, ...styles.pillOn } : { ...styles.pill, ...styles.pillOff } },
|
|
601
|
+
h('span', { style: { width: 6, height: 6, borderRadius: 999, background: on ? '#6fe0a8' : 'rgba(255,255,255,0.4)' } }),
|
|
602
|
+
on ? onText : offText)
|
|
440
603
|
|
|
441
|
-
return h('div', { style:
|
|
604
|
+
return h('div', { style: styles.page },
|
|
442
605
|
h(CrashBanner),
|
|
443
|
-
h('div', { style: styles.
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
h(
|
|
455
|
-
|
|
456
|
-
|
|
606
|
+
h('div', { style: styles.headCard },
|
|
607
|
+
h('div', { style: styles.headTitle },
|
|
608
|
+
'卷末 · Colophon',
|
|
609
|
+
pill(enabled, tr('statusOn'), tr('statusOff'))),
|
|
610
|
+
h('div', { style: styles.headSub }, tr('settingsSubtitle')),
|
|
611
|
+
h('div', { style: styles.hint }, tr('saveHint'))),
|
|
612
|
+
h(Card, { title: tr('basicTitle') },
|
|
613
|
+
h(SwitchRow, {
|
|
614
|
+
label: tr('enabled'), hint: tr('enabledHint'), checked: enabled,
|
|
615
|
+
onChange: value => updateTop('enabled', value),
|
|
616
|
+
}),
|
|
617
|
+
h('div', { style: styles.row2 },
|
|
618
|
+
h('label', { style: styles.fieldWide },
|
|
619
|
+
h('span', { style: styles.label }, tr('engine')),
|
|
620
|
+
h('select', { style: styles.inputWide, value: form.engine, onChange: event => updateTop('engine', event.target.value) },
|
|
621
|
+
h('option', { value: 'rules' }, tr('engineRules')),
|
|
622
|
+
h('option', { value: 'api' }, tr('engineApi')))),
|
|
623
|
+
h('div', { style: { ...styles.hint, flex: '1 1 240px', paddingBottom: 6 } }, tr('engineHint')))),
|
|
624
|
+
h(Card, { title: tr('triggers') },
|
|
625
|
+
h(SwitchRow, {
|
|
626
|
+
label: tr('onIdle'), hint: tr('onIdleHint'), checked: form.triggers.onIdle === true,
|
|
627
|
+
onChange: value => update('triggers', 'onIdle', value),
|
|
628
|
+
}),
|
|
629
|
+
h(SwitchRow, {
|
|
630
|
+
label: tr('onSwitch'), hint: tr('onSwitchHint'), checked: form.triggers.onSwitch === true,
|
|
631
|
+
onChange: value => update('triggers', 'onSwitch', value),
|
|
632
|
+
}),
|
|
633
|
+
h(SwitchRow, {
|
|
634
|
+
label: tr('closeBatch'), checked: form.triggers.closeBatch === true,
|
|
635
|
+
onChange: value => update('triggers', 'closeBatch', value),
|
|
636
|
+
}),
|
|
637
|
+
h('div', { style: styles.callout }, tr('closeBatchWarn')),
|
|
457
638
|
h(NumberField, {
|
|
458
639
|
label: tr('closeBatchMax'), value: form.triggers.closeBatchMaxSessions, step: 1,
|
|
459
640
|
onChange: value => update('triggers', 'closeBatchMaxSessions', value),
|
|
460
641
|
})),
|
|
461
|
-
h(
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
642
|
+
h(Card, {
|
|
643
|
+
title: tr('apiSection'),
|
|
644
|
+
extra: pill(apiOn, tr('apiOn'), tr('apiOff')),
|
|
645
|
+
},
|
|
646
|
+
h('div', { style: styles.hint }, tr('apiNote')),
|
|
647
|
+
h('div', { style: styles.row2 },
|
|
648
|
+
h('label', { style: styles.fieldWide },
|
|
466
649
|
h('span', { style: styles.label }, tr('provider')),
|
|
467
|
-
h('input', { style: styles.
|
|
468
|
-
h('label', { style: styles.
|
|
650
|
+
h('input', { style: styles.inputWide, value: form.api.provider, placeholder: 'deepseek', onChange: event => update('api', 'provider', event.target.value) })),
|
|
651
|
+
h('label', { style: styles.fieldWide },
|
|
469
652
|
h('span', { style: styles.label }, tr('model')),
|
|
470
|
-
h('input', { style: styles.
|
|
471
|
-
h('div', { style: styles.
|
|
653
|
+
h('input', { style: styles.inputWide, value: form.api.model, onChange: event => update('api', 'model', event.target.value) }))),
|
|
654
|
+
h('div', { style: styles.row2 },
|
|
472
655
|
h(NumberField, { label: tr('priceIn'), value: form.api.priceInCNYPerM, step: 0.1, onChange: value => update('api', 'priceInCNYPerM', value) }),
|
|
473
656
|
h(NumberField, { label: tr('priceOut'), value: form.api.priceOutCNYPerM, step: 0.1, onChange: value => update('api', 'priceOutCNYPerM', value) })),
|
|
474
|
-
h('div', { style: styles.
|
|
657
|
+
h('div', { style: styles.row2 },
|
|
475
658
|
h(NumberField, { label: tr('perSummaryCap'), value: form.api.maxCostPerSummaryCNY, step: 0.01, onChange: value => update('api', 'maxCostPerSummaryCNY', value) }),
|
|
476
659
|
h(NumberField, { label: tr('dailyBudget'), value: form.api.dailyTokenBudget, step: 1000, onChange: value => update('api', 'dailyTokenBudget', value) }),
|
|
477
|
-
h('label', { style: styles.
|
|
660
|
+
h('label', { style: styles.fieldWide },
|
|
478
661
|
h('span', { style: styles.label }, tr('overCap')),
|
|
479
|
-
h('select', { style: styles.
|
|
662
|
+
h('select', { style: styles.inputWide, value: form.api.overCap, onChange: event => update('api', 'overCap', event.target.value) },
|
|
480
663
|
h('option', { value: 'queue' }, tr('overCapQueue')),
|
|
481
|
-
h('option', { value: 'skip' }, tr('overCapSkip')))))
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
664
|
+
h('option', { value: 'skip' }, tr('overCapSkip'))))),
|
|
665
|
+
apiOn && status && status.apiAvailable === false
|
|
666
|
+
? h('div', { style: styles.callout }, tr('apiUnavailable'))
|
|
667
|
+
: null),
|
|
668
|
+
h(Card, { title: tr('filter') },
|
|
669
|
+
h('div', { style: styles.row2 },
|
|
485
670
|
h(NumberField, { label: tr('minMessages'), value: form.filter.minMessages, onChange: value => update('filter', 'minMessages', value) }),
|
|
486
671
|
h(NumberField, { label: tr('minTokens'), value: form.filter.minTokens, step: 500, onChange: value => update('filter', 'minTokens', value) }))),
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
item.sessionId, ' · ', item.reason, ' · ', new Date(item.at).toLocaleString()))),
|
|
498
|
-
h('div', { style: styles.actions },
|
|
672
|
+
h(Card, { title: tr('queueTitle'), extra: pill(queueCount > 0, String(queueCount), String(queueCount)) },
|
|
673
|
+
h('div', { style: styles.hint }, tr('queueHint')),
|
|
674
|
+
queueItems.length === 0
|
|
675
|
+
? h('div', { style: styles.emptyBox }, tr('queueEmpty'))
|
|
676
|
+
: h('div', { style: { display: 'flex', flexDirection: 'column', gap: 6 } },
|
|
677
|
+
queueItems.map(item => h('div', { key: item.sessionId, style: styles.listRow },
|
|
678
|
+
h('span', { style: { fontWeight: 600 } }, String(item.sessionId).slice(0, 14)),
|
|
679
|
+
h('span', { style: styles.hint }, item.reason),
|
|
680
|
+
h('span', { style: { ...styles.hint, marginLeft: 'auto' } }, new Date(item.at).toLocaleString())))),
|
|
681
|
+
h('div', { style: styles.actionsBar },
|
|
499
682
|
h('button', {
|
|
500
|
-
style: styles.
|
|
501
|
-
disabled:
|
|
683
|
+
style: queueCount === 0 ? { ...styles.buttonSecondary, ...styles.buttonDisabled } : styles.buttonSecondary,
|
|
684
|
+
disabled: queueCount === 0,
|
|
502
685
|
onClick: async () => {
|
|
503
686
|
setFailed('')
|
|
504
687
|
try {
|
|
@@ -510,29 +693,36 @@ window.__ModuleLoader__.load({
|
|
|
510
693
|
}
|
|
511
694
|
},
|
|
512
695
|
}, tr('queueProcess')))),
|
|
513
|
-
h(
|
|
514
|
-
|
|
515
|
-
h('
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
696
|
+
h(Card, {
|
|
697
|
+
title: tr('usage'),
|
|
698
|
+
extra: h('span', { style: styles.hint }, tr('localZero')),
|
|
699
|
+
},
|
|
700
|
+
h('div', { style: styles.usageGrid },
|
|
701
|
+
usageCard(tr('usageHour'), usage.hour),
|
|
702
|
+
usageCard(tr('usageDay'), usage.day),
|
|
703
|
+
usageCard(tr('usageWeek'), usage.week),
|
|
704
|
+
usageCard(tr('usageMonth'), usage.month),
|
|
705
|
+
custom ? usageCard(tr('usageCustom'), custom) : null),
|
|
706
|
+
h('div', { style: styles.row2 },
|
|
707
|
+
h('label', { style: styles.fieldWide },
|
|
523
708
|
h('span', { style: styles.label }, tr('from')),
|
|
524
|
-
h('input', {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
709
|
+
h('input', {
|
|
710
|
+
style: styles.inputWide, type: 'datetime-local', value: range.from,
|
|
711
|
+
onChange: event => setRange(current => ({ ...current, from: event.target.value })),
|
|
712
|
+
})),
|
|
713
|
+
h('label', { style: styles.fieldWide },
|
|
714
|
+
h('span', { style: styles.label }, tr('to')),
|
|
715
|
+
h('input', {
|
|
716
|
+
style: styles.inputWide, type: 'datetime-local', value: range.to,
|
|
717
|
+
onChange: event => setRange(current => ({ ...current, to: event.target.value })),
|
|
718
|
+
})),
|
|
719
|
+
h('button', { style: styles.buttonSecondary, onClick: () => void applyRange() }, tr('apply'))),
|
|
720
|
+
h('div', { style: styles.hint }, tr('customHint')),
|
|
721
|
+
status ? h('div', { style: styles.hint }, tr('dataRoot'), ': ', status.dataRoot) : null),
|
|
722
|
+
failed ? h('div', { style: styles.callout }, failed) : null,
|
|
533
723
|
message ? h('div', { style: styles.ok }, message) : null,
|
|
534
|
-
h('div', { style: styles.
|
|
535
|
-
h('button', { style: styles.
|
|
724
|
+
h('div', { style: styles.actionsBar },
|
|
725
|
+
h('button', { style: styles.buttonPrimary, onClick: () => void save() }, tr('save'))))
|
|
536
726
|
}
|
|
537
727
|
|
|
538
728
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-colophon",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Colophon(卷末)— keep a local, token-free conclusion digest for every conversation, so reopening an old session starts from its final state instead of its full history.",
|
|
5
5
|
"documentation": "README.md",
|
|
6
6
|
"license": "MIT",
|