dsh-team-bots 0.2.289 → 0.2.347
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 +60 -122
- package/docs/README.zh.md +61 -123
- package/docs/assets/channel-redesign.png +0 -0
- package/docs/assets/global-config-dark.png +0 -0
- package/docs/assets/global-config-light.png +0 -0
- package/docs/assets/global-config-light.zh.png +0 -0
- package/docs/assets/global-config-redesign.png +0 -0
- package/docs/assets/secrets-redesign.png +0 -0
- package/docs/assets/tasks.png +0 -0
- package/docs/assets/tasks.zh.png +0 -0
- package/docs/assets/usage-redesign-global.png +0 -0
- package/docs/assets/usage.png +0 -0
- package/docs/assets/usage.zh.png +0 -0
- package/package.json +17 -5
- package/scripts/doctor.mjs +4 -4
- package/src/api.js +6 -3
- package/src/botmsg.js +1 -1
- package/src/config.js +18 -8
- package/src/db-migrations.js +76 -9
- package/src/db.js +28 -2
- package/src/http.js +22 -3
- package/src/paths.js +32 -1
- package/src/pricing.js +2 -2
- package/src/runtime.js +1 -1
- package/src/secrets.js +4 -4
- package/src/service.js +14 -5
- package/src/services/approvals.js +109 -24
- package/src/services/backoff.js +34 -0
- package/src/services/bot-quota.js +242 -0
- package/src/services/bots.js +35 -6
- package/src/services/chat.js +15 -9
- package/src/services/core.js +33 -5
- package/src/services/hygiene.js +8 -4
- package/src/services/locale.js +17 -0
- package/src/services/memory.js +112 -1
- package/src/services/message-images.js +3 -3
- package/src/services/notify.js +169 -0
- package/src/services/projects.js +119 -10
- package/src/services/proposals.js +2 -3
- package/src/services/questions.js +75 -32
- package/src/services/review-watchdog.js +261 -30
- package/src/services/run-finish.js +186 -17
- package/src/services/runs.js +42 -13
- package/src/services/runtime/lifecycle.js +3 -1
- package/src/services/runtime/model-restore.js +5 -5
- package/src/services/runtime/prompt.js +106 -45
- package/src/services/runtime/session.js +38 -14
- package/src/services/runtime/trajectory.js +1 -1
- package/src/services/scheduler.js +146 -19
- package/src/services/secrets.js +1 -1
- package/src/services/system.js +23 -6
- package/src/services/task-dispatch.js +315 -0
- package/src/services/task-notify.js +55 -11
- package/src/services/task-runs.js +179 -0
- package/src/services/task-stage.js +4 -0
- package/src/services/tasks.js +51 -399
- package/src/services/terminal.js +2 -2
- package/src/services/vision-proxy.js +3 -3
- package/src/services/wechat.js +228 -7
- package/src/services/workspace-groups.js +4 -3
- package/src/skill-parse.js +1 -1
- package/src/skills.js +1 -1
- package/src/tools.js +275 -6
- package/src/updater.js +52 -0
- package/src/usage-reconcile.js +1 -1
- package/src/usage.js +52 -11
- package/src/wechat/channel.js +14 -20
- package/src/wechat/commands.js +129 -81
- package/src/wechat/format.js +247 -0
- package/src/wechat/store.js +30 -2
- package/ui/app.js +57 -53
- package/ui/i18n/en/chat.js +140 -0
- package/ui/i18n/en/common.js +187 -0
- package/ui/i18n/en/nav.js +89 -0
- package/ui/i18n/en/settings.js +352 -0
- package/ui/i18n/en/tasks.js +229 -0
- package/ui/i18n/en/usage.js +141 -0
- package/ui/i18n/en/wechat.js +23 -0
- package/ui/i18n/en.js +17 -237
- package/ui/i18n/zh/chat.js +140 -0
- package/ui/i18n/zh/common.js +187 -0
- package/ui/i18n/zh/nav.js +89 -0
- package/ui/i18n/zh/settings.js +352 -0
- package/ui/i18n/zh/tasks.js +229 -0
- package/ui/i18n/zh/usage.js +141 -0
- package/ui/i18n/zh/wechat.js +23 -0
- package/ui/i18n/zh.js +17 -236
- package/ui/modules/api.js +4 -3
- package/ui/modules/bot-quota.js +27 -0
- package/ui/modules/cards.js +96 -58
- package/ui/modules/chat.js +28 -30
- package/ui/modules/composer.js +41 -37
- package/ui/modules/dom-morph.js +292 -0
- package/ui/modules/events-board.js +22 -22
- package/ui/modules/events-click.js +100 -68
- package/ui/modules/events-misc.js +34 -34
- package/ui/modules/events-submit.js +28 -28
- package/ui/modules/global-pages.js +125 -116
- package/ui/modules/i18n.js +0 -5
- package/ui/modules/icons.js +0 -1
- package/ui/modules/markdown.js +1 -1
- package/ui/modules/modal-forms.js +196 -203
- package/ui/modules/modal-layer.js +6 -9
- package/ui/modules/page-shell.js +62 -0
- package/ui/modules/settings.js +211 -198
- package/ui/modules/solo-archive.js +0 -4
- package/ui/modules/state.js +57 -50
- package/ui/modules/tasks.js +167 -171
- package/ui/modules/typing-linger.js +1 -4
- package/ui/modules/usage.js +65 -78
- package/ui/modules/util.js +92 -25
- package/ui/styles/avatars.css +14 -0
- package/ui/styles/cards.css +49 -0
- package/ui/styles/chat-cards.css +17 -21
- package/ui/styles/global-config.css +56 -2
- package/ui/styles/modal.css +13 -0
- package/ui/styles/usage.css +3 -61
- package/CONTRIBUTING.md +0 -20
- package/docs/assets/usage-dark.png +0 -0
package/ui/modules/settings.js
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
// settings.js —— 设置/全局域:全局用量面板(含模型价格规则卡)、运行时效卡、运维卡、
|
|
2
|
-
// 项目设置页与全局配置页(renderGlobal,含 DSH 路径/DSH 服务卡)。通道/密钥页见 global-pages.js。
|
|
3
1
|
import { state } from './state.js'
|
|
4
2
|
import { t } from './i18n.js'
|
|
5
3
|
import { icon } from './icons.js'
|
|
6
4
|
import { activeBots, activeProject, attr, botById, esc, pathCode, tildePath } from './util.js'
|
|
7
5
|
import { notifyToggleView } from './cards.js'
|
|
8
6
|
import { usageBotRow, usageCurrency, usageDayPanel, usageDayTitle, usageListPanel, usageMetricCards, usageModelPanel, usagePageHead, usageProjectRow, usageRunRow, usageSection, usageSnapshot, usageWindowText } from './usage.js'
|
|
7
|
+
import { pageHead, pageNav, pageSection, pageShell, refreshAction, slot } from './page-shell.js'
|
|
9
8
|
import { refresh, noProject } from '../app.js'
|
|
10
9
|
import { renderPriceCard } from './modal-forms.js'
|
|
11
10
|
|
|
11
|
+
// 分布面板的槽位排布:偶数张半宽成两列,奇数张时最后一张整行,避免留空网格单元。
|
|
12
|
+
// panels 可为数组或键值对象,order 给出展示顺序。
|
|
13
|
+
function usagePanelSlots(panels, order) {
|
|
14
|
+
const list = order.map(key => panels[key])
|
|
15
|
+
const last = list.length - 1
|
|
16
|
+
return list.map((body, index) => slot(index === last && list.length % 2 === 1 ? 'full' : 'half', body)).join('')
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// 分组导航:只列当前视图真实存在的分组,避免死锚点。
|
|
20
|
+
function usageNav(items) {
|
|
21
|
+
return pageNav(items, t('usage.navLabel'))
|
|
22
|
+
}
|
|
23
|
+
|
|
12
24
|
function renderUsageGlobal() {
|
|
13
25
|
const usage = usageSnapshot()
|
|
14
26
|
const tier = usage.tiers?.global
|
|
@@ -27,9 +39,9 @@ function renderUsageGlobal() {
|
|
|
27
39
|
const unpriced = Number(totals.unpricedCalls ?? 0)
|
|
28
40
|
const panels = {
|
|
29
41
|
days: usageDayPanel(days),
|
|
30
|
-
model: usageModelPanel(byModel, '分模型', `<span class="meta">${byModel.length}
|
|
31
|
-
bot: usageListPanel('分 Bot', byBot.map(item => usageBotRow(item, maxBot, false, currency)), 'Bot'),
|
|
32
|
-
project: usageListPanel('分项目', byProject.map(item => usageProjectRow(item, maxProject, currency)), '
|
|
42
|
+
model: usageModelPanel(byModel, t('分模型'), `<span class="meta">${t('usage.count', { count: byModel.length })}</span>`, currency),
|
|
43
|
+
bot: usageListPanel(t('分 Bot'), byBot.map(item => usageBotRow(item, maxBot, false, currency)), 'Bot'),
|
|
44
|
+
project: usageListPanel(t('分项目'), byProject.map(item => usageProjectRow(item, maxProject, currency)), t('usage.colProject')),
|
|
33
45
|
}
|
|
34
46
|
// 口径切换只调展示顺序,四个维度始终可见(关键信息不折叠)。
|
|
35
47
|
const order = {
|
|
@@ -39,36 +51,33 @@ function renderUsageGlobal() {
|
|
|
39
51
|
project: ['project', 'days', 'model', 'bot'],
|
|
40
52
|
}[focus]
|
|
41
53
|
const overviewNotes = [
|
|
42
|
-
unpriced > 0 ? `<div class="note warn-note">${unpriced}
|
|
43
|
-
Number(reconciliation?.mismatched ?? 0) > 0 ? `<div class="usage-note">${Number(reconciliation.mismatched)}
|
|
54
|
+
unpriced > 0 ? `<div class="note warn-note">${t('usage.unpricedNote', { count: unpriced })}</div>` : '',
|
|
55
|
+
Number(reconciliation?.mismatched ?? 0) > 0 ? `<div class="usage-note">${t('次运行的用量记录对不上,数据可能不完整。', { count: Number(reconciliation.mismatched) })}</div>` : '',
|
|
44
56
|
].join('')
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
'
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
'
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
renderPriceCard(),
|
|
70
|
-
)}
|
|
71
|
-
`
|
|
57
|
+
return pageShell(
|
|
58
|
+
usagePageHead(usage, t('usage.headGlobalHint')),
|
|
59
|
+
usageNav([
|
|
60
|
+
{ id: 'u-overview', label: t('usage.overview') },
|
|
61
|
+
{ id: 'u-distribution', label: t('usage.distTitle') },
|
|
62
|
+
{ id: 'u-price', label: t('usage.priceTitle') },
|
|
63
|
+
]),
|
|
64
|
+
[
|
|
65
|
+
usageSection('01', 'u-overview', t('usage.overview'), t('usage.overviewGlobalDesc', { window: windowText }),
|
|
66
|
+
slot('full', `${overviewNotes}${usageMetricCards(totals, t('usage.scopeGlobal'), usage)}`)),
|
|
67
|
+
usageSection('02', 'u-distribution', t('usage.distTitle'), t('usage.distGlobalDesc', { dayTitle, window: windowText }),
|
|
68
|
+
usagePanelSlots(panels, order),
|
|
69
|
+
`<div class="usage-seg">
|
|
70
|
+
<span class="usage-seg-label">${t('usage.panelOrder')}</span>
|
|
71
|
+
<div class="seg" role="group" aria-label="${t('usage.panelOrder')}">
|
|
72
|
+
<button data-action="usage-scope" data-scope="global" aria-pressed="${focus === 'global'}">${t('usage.orderGlobal')}</button>
|
|
73
|
+
<button data-action="usage-scope" data-scope="model" aria-pressed="${focus === 'model'}">${t('usage.orderModel')}</button>
|
|
74
|
+
<button data-action="usage-scope" data-scope="bot" aria-pressed="${focus === 'bot'}">${t('usage.orderBot')}</button>
|
|
75
|
+
<button data-action="usage-scope" data-scope="project" aria-pressed="${focus === 'project'}">${t('usage.orderProject')}</button>
|
|
76
|
+
</div>
|
|
77
|
+
</div>`),
|
|
78
|
+
usageSection('03', 'u-price', t('usage.priceTitle'), t('usage.priceDesc'), slot('full', renderPriceCard())),
|
|
79
|
+
],
|
|
80
|
+
)
|
|
72
81
|
}
|
|
73
82
|
|
|
74
83
|
// 群聊「用量」tab:本群消耗汇总 + 本群分模型 + 本群各 bot,内容严格限本群。
|
|
@@ -89,34 +98,33 @@ function renderUsageDomain() {
|
|
|
89
98
|
: []
|
|
90
99
|
const unpriced = Number(totals.unpricedCalls ?? 0)
|
|
91
100
|
const overviewNotes = [
|
|
92
|
-
unpriced > 0 ? `<div class="note warn-note">${unpriced}
|
|
93
|
-
tier ? '' :
|
|
101
|
+
unpriced > 0 ? `<div class="note warn-note">${t('usage.unpricedNote', { count: unpriced })}</div>` : '',
|
|
102
|
+
tier ? '' : `<div class="usage-note">${t('下方分组明细暂不可用,上方汇总仍按本群统计。')}</div>`,
|
|
94
103
|
].join('')
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
)}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
'
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
</
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
`
|
|
104
|
+
const panels = [
|
|
105
|
+
usageDayPanel(days),
|
|
106
|
+
usageModelPanel(byModel, t('本群分模型'), '', currency),
|
|
107
|
+
usageListPanel(t('本群各 Bot'), byBot.map(item => usageBotRow(item, maxBot, true, currency)), 'Bot'),
|
|
108
|
+
]
|
|
109
|
+
const nav = [
|
|
110
|
+
{ id: 'u-overview', label: t('usage.overview') },
|
|
111
|
+
{ id: 'u-distribution', label: t('usage.distTitle') },
|
|
112
|
+
]
|
|
113
|
+
const sections = [
|
|
114
|
+
usageSection('01', 'u-overview', t('usage.overview'), t('usage.overviewDomainDesc', { window: windowText }),
|
|
115
|
+
slot('full', `${overviewNotes}${usageMetricCards(totals, t('usage.scopeDomain'), usage)}`)),
|
|
116
|
+
usageSection('02', 'u-distribution', t('usage.distTitleDomain'), t('usage.distDomainDesc', { dayTitle, window: windowText }),
|
|
117
|
+
usagePanelSlots(panels, panels.map((_, index) => index))),
|
|
118
|
+
]
|
|
119
|
+
if (drillBot) {
|
|
120
|
+
nav.push({ id: 'u-runs', label: t('usage.drillRunsShort') })
|
|
121
|
+
sections.push(usageSection('03', 'u-runs', t('usage.drillRunsTitle', { name: drillBot.name }), t('usage.drillRunsDesc'),
|
|
122
|
+
slot('full', `<div class="card usage-panel">
|
|
123
|
+
${drillRuns.length === 0 ? `<div class="faint">${t('usage.drillEmpty')}</div>` : `<div class="run-list">${drillRuns.map(usageRunRow).join('')}</div>`}
|
|
124
|
+
</div>`),
|
|
125
|
+
`<button class="btn small" data-action="usage-clear-drill">${icon('close')}${t('usage.clearDrill')}</button>`))
|
|
126
|
+
}
|
|
127
|
+
return pageShell(usagePageHead(usage, t('usage.headDomainHint'), t('usage.scopeDomain')), usageNav(nav), sections)
|
|
120
128
|
}
|
|
121
129
|
|
|
122
130
|
// 单聊「用量」tab:本 bot 汇总 + 本 bot 分模型,内容严格限本 bot。
|
|
@@ -133,33 +141,28 @@ function renderUsageSolo() {
|
|
|
133
141
|
.filter(run => run.bot_id === state.soloBotId && (run.project_id ?? null) === null)
|
|
134
142
|
const unpriced = Number(totals.unpricedCalls ?? 0)
|
|
135
143
|
const overviewNotes = [
|
|
136
|
-
unpriced > 0 ? `<div class="note warn-note">${unpriced}
|
|
137
|
-
usage.solo && tier ? '' :
|
|
144
|
+
unpriced > 0 ? `<div class="note warn-note">${t('usage.unpricedNote', { count: unpriced })}</div>` : '',
|
|
145
|
+
usage.solo && tier ? '' : `<div class="usage-note">${t('该 Bot 的单聊明细暂不可用。')}</div>`,
|
|
138
146
|
].join('')
|
|
139
|
-
return
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
'
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
'
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
<div class="card-head"><h3>运行明细</h3><span class="meta">${runs.length} 条</span></div>
|
|
159
|
-
${runs.length === 0 ? '<div class="faint">该 Bot 在项目外还没有运行记录。</div>' : `<div class="run-list">${runs.map(usageRunRow).join('')}</div>`}
|
|
160
|
-
</div>`,
|
|
161
|
-
)}
|
|
162
|
-
`
|
|
147
|
+
return pageShell(
|
|
148
|
+
usagePageHead(usage, t('usage.headSoloHint'), t('usage.scopeSolo')),
|
|
149
|
+
usageNav([
|
|
150
|
+
{ id: 'u-overview', label: t('usage.overview') },
|
|
151
|
+
{ id: 'u-distribution', label: t('usage.distTitle') },
|
|
152
|
+
{ id: 'u-runs', label: t('usage.runDetailTitle') },
|
|
153
|
+
]),
|
|
154
|
+
[
|
|
155
|
+
usageSection('01', 'u-overview', t('usage.overview'), t('usage.overviewSoloDesc', { window: windowText }),
|
|
156
|
+
slot('full', `${overviewNotes}${usageMetricCards(totals, t('usage.scopeSolo'), usage)}`)),
|
|
157
|
+
usageSection('02', 'u-distribution', t('usage.distTitleSolo'), t('usage.distSoloDesc', { dayTitle, window: windowText }),
|
|
158
|
+
usagePanelSlots({ days: usageDayPanel(days), model: usageModelPanel(byModel, t('该 Bot 分模型'), '', currency) }, ['days', 'model'])),
|
|
159
|
+
usageSection('03', 'u-runs', t('usage.soloRunsTitle'), t('usage.soloRunsDesc'),
|
|
160
|
+
slot('full', `<div class="card usage-panel">
|
|
161
|
+
<div class="card-head"><h3>${t('usage.runDetailTitle')}</h3><span class="meta">${t('usage.runCount', { count: runs.length })}</span></div>
|
|
162
|
+
${runs.length === 0 ? `<div class="faint">${t('usage.soloRunsEmpty')}</div>` : `<div class="run-list">${runs.map(usageRunRow).join('')}</div>`}
|
|
163
|
+
</div>`)),
|
|
164
|
+
],
|
|
165
|
+
)
|
|
163
166
|
}
|
|
164
167
|
|
|
165
168
|
// 全局配置页「运行时效」卡:超时中止与无进展看门狗(分钟),保存走 update_settings。
|
|
@@ -169,26 +172,43 @@ function renderRunLimitsCard() {
|
|
|
169
172
|
const limits = state.data.runLimits ?? {}
|
|
170
173
|
const savedRun = settings.run_timeout_minutes ?? ''
|
|
171
174
|
const savedStall = settings.stall_watchdog_minutes ?? ''
|
|
175
|
+
const savedReviewIdle = settings.review_idle_minutes ?? ''
|
|
176
|
+
const savedAutoClose = settings.review_auto_close ?? ''
|
|
172
177
|
const runValue = savedRun !== '' ? savedRun : String(limits.runTimeoutMinutes ?? 120)
|
|
173
178
|
// 看门狗保存值 '0'(关闭)合法,不能用 || 短路吞掉。
|
|
174
179
|
const stallValue = savedStall !== '' ? savedStall : String(limits.stallTimeoutMinutes ?? 30)
|
|
180
|
+
// 验收滞留阈值(DSHBOTS-235):未保存回填生效值;'0'(关闭守门)同样合法不短路。
|
|
181
|
+
const reviewIdleValue = savedReviewIdle !== '' ? savedReviewIdle : String(limits.reviewIdleMinutes ?? 30)
|
|
182
|
+
const autoCloseOn = savedAutoClose !== '0'
|
|
175
183
|
const envNames = [
|
|
176
184
|
limits.runTimeoutEnv ? 'DSH_TEAM_RUN_TIMEOUT_MS' : '',
|
|
177
185
|
limits.stallTimeoutEnv ? 'DSH_TEAM_STALL_TIMEOUT_MS' : '',
|
|
178
186
|
].filter(Boolean).join(' / ')
|
|
179
|
-
const stallText = limits.stallTimeoutMinutes === 0
|
|
187
|
+
const stallText = limits.stallTimeoutMinutes === 0
|
|
188
|
+
? t('global.stallOff')
|
|
189
|
+
: t('global.stallMinutes', { minutes: limits.stallTimeoutMinutes ?? 30 })
|
|
180
190
|
return `
|
|
181
191
|
<div class="card form-card g-card">
|
|
182
|
-
<div class="card-head"><h3
|
|
192
|
+
<div class="card-head"><h3>${t('global.cardRunLimits')}</h3><span class="meta">${t('global.runLimitsCurrent', { timeout: limits.runTimeoutMinutes ?? 120, stall: stallText })}</span></div>
|
|
193
|
+
<div class="field-row">
|
|
194
|
+
<div class="field"><label id="settings-run-timeout-label" for="settings-run-timeout">${t('global.runTimeoutLabel')}</label><input class="input mono" style="text-align:right" type="number" min="1" max="360" id="settings-run-timeout" name="run_timeout_minutes" value="${attr(runValue)}"></div>
|
|
195
|
+
<div class="field"><label id="settings-stall-watchdog-label" for="settings-stall-watchdog">${t('global.stallWatchdogLabel')}</label><input class="input mono" style="text-align:right" type="number" min="0" max="360" id="settings-stall-watchdog" name="stall_watchdog_minutes" value="${attr(stallValue)}"></div>
|
|
196
|
+
</div>
|
|
183
197
|
<div class="field-row">
|
|
184
|
-
<div class="field"><label id="settings-
|
|
185
|
-
<div class="field"><label id="settings-
|
|
198
|
+
<div class="field"><label id="settings-review-idle-label" for="settings-review-idle">${t('global.reviewIdleLabel')}</label><input class="input mono" style="text-align:right" type="number" min="0" max="1440" id="settings-review-idle" name="review_idle_minutes" value="${attr(reviewIdleValue)}"></div>
|
|
199
|
+
<div class="field"><label id="settings-review-auto-close-label" for="settings-review-auto-close">${t('global.reviewAutoCloseLabel')}</label>
|
|
200
|
+
<select class="select" id="settings-review-auto-close" name="review_auto_close">
|
|
201
|
+
<option value="1" ${autoCloseOn ? 'selected' : ''}>${t('global.on')}</option>
|
|
202
|
+
<option value="0" ${!autoCloseOn ? 'selected' : ''}>${t('global.off')}</option>
|
|
203
|
+
</select>
|
|
204
|
+
</div>
|
|
186
205
|
</div>
|
|
187
|
-
<div class="hint"
|
|
188
|
-
<div class="hint"
|
|
189
|
-
|
|
206
|
+
<div class="hint">${t('global.runLimitsHint1')}</div>
|
|
207
|
+
<div class="hint">${t('global.reviewIdleHint')}</div>
|
|
208
|
+
<div class="hint">${t('新值只对之后启动的运行生效,进行中的运行不追溯。')}</div>
|
|
209
|
+
${envNames ? `<div class="hint">${t('global.runLimitsEnv', { names: envNames })}</div>` : ''}
|
|
190
210
|
<div class="btn-row" style="margin-top:12px">
|
|
191
|
-
<button class="btn small" type="button" data-action="save-run-limits"
|
|
211
|
+
<button class="btn small" type="button" data-action="save-run-limits">${t('global.saveRunLimits')}</button>
|
|
192
212
|
</div>
|
|
193
213
|
</div>`
|
|
194
214
|
}
|
|
@@ -199,34 +219,34 @@ function renderOpsCard() {
|
|
|
199
219
|
const num = value => (value === '' || value === undefined || value === null ? '' : String(value))
|
|
200
220
|
return `
|
|
201
221
|
<div class="card form-card g-card">
|
|
202
|
-
<div class="card-head"><h3
|
|
222
|
+
<div class="card-head"><h3>${t('global.cardOps')}</h3></div>
|
|
203
223
|
<div class="field-row">
|
|
204
224
|
<div class="field">
|
|
205
|
-
<label id="settings-currency-label" for="settings-currency"
|
|
225
|
+
<label id="settings-currency-label" for="settings-currency">${t('global.budgetCurrency')}</label>
|
|
206
226
|
<select class="select" id="settings-currency" name="budget_currency">
|
|
207
227
|
${['CNY', 'USD'].map(code => `<option value="${code}" ${code === currency ? 'selected' : ''}>${code}</option>`).join('')}
|
|
208
228
|
</select>
|
|
209
229
|
</div>
|
|
210
230
|
<div class="field">
|
|
211
|
-
<label id="settings-memory-review-label" for="settings-memory-review"
|
|
231
|
+
<label id="settings-memory-review-label" for="settings-memory-review">${t('global.memoryReview')}</label>
|
|
212
232
|
<select class="select" id="settings-memory-review" name="memory_review">
|
|
213
|
-
<option value="1" ${settings.memory_review !== '0' ? 'selected' : ''}
|
|
214
|
-
<option value="0" ${settings.memory_review === '0' ? 'selected' : ''}
|
|
233
|
+
<option value="1" ${settings.memory_review !== '0' ? 'selected' : ''}>${t('global.on')}</option>
|
|
234
|
+
<option value="0" ${settings.memory_review === '0' ? 'selected' : ''}>${t('global.off')}</option>
|
|
215
235
|
</select>
|
|
216
236
|
</div>
|
|
217
237
|
</div>
|
|
218
238
|
<div class="field-row">
|
|
219
|
-
<div class="field"><label id="settings-global-token-budget-label" for="settings-global-token-budget"
|
|
220
|
-
<div class="field"><label id="settings-global-cost-budget-label" for="settings-global-cost-budget"
|
|
239
|
+
<div class="field"><label id="settings-global-token-budget-label" for="settings-global-token-budget">${t('global.tokenBudget')}</label><input class="input mono" style="text-align:right" type="number" min="0" id="settings-global-token-budget" name="global_token_budget" value="${attr(num(settings.global_token_budget))}" placeholder="${t('global.unlimited')}"></div>
|
|
240
|
+
<div class="field"><label id="settings-global-cost-budget-label" for="settings-global-cost-budget">${t('global.costBudget')}</label><input class="input mono" style="text-align:right" type="number" min="0" step="0.01" id="settings-global-cost-budget" name="global_cost_budget" value="${attr(num(settings.global_cost_budget))}" placeholder="${t('global.unlimited')}"></div>
|
|
221
241
|
</div>
|
|
222
242
|
<div class="field-row">
|
|
223
|
-
<div class="field"><label id="settings-retention-usage-label" for="settings-retention-usage"
|
|
224
|
-
<div class="field"><label id="settings-retention-run-label" for="settings-retention-run"
|
|
243
|
+
<div class="field"><label id="settings-retention-usage-label" for="settings-retention-usage">${t('global.retentionUsage')}</label><input class="input mono" style="text-align:right" type="number" min="0" id="settings-retention-usage" name="retention_usage_days" value="${attr(num(settings.retention_usage_days))}" placeholder="${t('global.forever')}"></div>
|
|
244
|
+
<div class="field"><label id="settings-retention-run-label" for="settings-retention-run">${t('global.retentionRun')}</label><input class="input mono" style="text-align:right" type="number" min="0" id="settings-retention-run" name="retention_run_event_days" value="${attr(num(settings.retention_run_event_days))}" placeholder="${t('global.forever')}"></div>
|
|
225
245
|
</div>
|
|
226
|
-
<div class="field"><label id="settings-retention-message-label" for="settings-retention-message"
|
|
227
|
-
<div class="hint"
|
|
246
|
+
<div class="field"><label id="settings-retention-message-label" for="settings-retention-message">${t('global.retentionMessage')}</label><input class="input mono" style="text-align:right" type="number" min="0" id="settings-retention-message" name="retention_message_days" value="${attr(num(settings.retention_message_days))}" placeholder="${t('global.forever')}"></div>
|
|
247
|
+
<div class="hint">${t('global.opsHint')}</div>
|
|
228
248
|
<div class="btn-row" style="margin-top:12px">
|
|
229
|
-
<button class="btn small" type="button" data-action="save-settings"
|
|
249
|
+
<button class="btn small" type="button" data-action="save-settings">${t('global.saveSettings')}</button>
|
|
230
250
|
</div>
|
|
231
251
|
</div>`
|
|
232
252
|
}
|
|
@@ -234,46 +254,55 @@ function renderOpsCard() {
|
|
|
234
254
|
// DSH 路径卡:只读展示本机 DSH 目录、工作区、共享技能根与数据目录。
|
|
235
255
|
function dshPathsCard() {
|
|
236
256
|
const paths = state.data.paths ?? {}
|
|
237
|
-
const copyPath = value => `<button class="btn icon small" type="button" data-action="copy" data-copy="${attr(value)}" title="
|
|
257
|
+
const copyPath = value => `<button class="btn icon small" type="button" data-action="copy" data-copy="${attr(value)}" title="${t('common.copyPath')}" aria-label="${t('common.copyPath')}">${icon('copy')}</button>`
|
|
238
258
|
return `
|
|
239
259
|
<div class="card form-card g-card">
|
|
240
|
-
<div class="card-head"><h3
|
|
241
|
-
<div class="path-row"><span
|
|
242
|
-
<div class="path-row"><span
|
|
243
|
-
<div class="path-row"><span
|
|
244
|
-
<div class="path-row"><span
|
|
245
|
-
<div class="hint"
|
|
260
|
+
<div class="card-head"><h3>${t('global.cardDshPaths')}</h3><span class="meta">${t('global.readonly')}</span></div>
|
|
261
|
+
<div class="path-row"><span>${t('global.pathDshHome')}</span>${pathCode(paths.dshHome ?? '~/.dsh')}${copyPath(paths.dshHome ?? '')}</div>
|
|
262
|
+
<div class="path-row"><span>${t('global.pathWorkspace')}</span>${pathCode(tildePath(paths.workspace))}${copyPath(paths.workspace)}</div>
|
|
263
|
+
<div class="path-row"><span>${t('global.pathSkills')}</span>${pathCode(paths.skillRoot)}${copyPath(paths.skillRoot)}</div>
|
|
264
|
+
<div class="path-row"><span>${t('global.pathData')}</span>${pathCode(paths.dataDir)}${copyPath(paths.dataDir)}</div>
|
|
265
|
+
<div class="hint">${t('global.dshPathsHint')}</div>
|
|
246
266
|
</div>`
|
|
247
267
|
}
|
|
248
268
|
|
|
269
|
+
// 版本行(DSHBOTS-253):取不到真值(缺失/null/'unknown'/空串/纯空白)时整行不渲染,
|
|
270
|
+
// 不显示 unknown 或空占位;两个「最新版本」行行为不变。
|
|
271
|
+
function versionRow(labelKey, value) {
|
|
272
|
+
const version = typeof value === 'string' ? value.trim() : ''
|
|
273
|
+
return version && version !== 'unknown'
|
|
274
|
+
? `<div class="kv"><span>${t(labelKey)}</span><strong>${esc(version)}</strong></div>`
|
|
275
|
+
: ''
|
|
276
|
+
}
|
|
277
|
+
|
|
249
278
|
// DSH 服务卡:版本检查 + 投递失败提示(投递失败 kv 落在本卡尾部)。
|
|
250
279
|
function dshServiceCard() {
|
|
251
280
|
const data = state.data
|
|
252
|
-
// 「DSH 服务」卡检查结果:loadState 只换 state.data,dshUpdate 存这里不被轮询盖掉。
|
|
281
|
+
// @ts-ignore 「DSH 服务」卡检查结果:loadState 只换 state.data,dshUpdate 存这里不被轮询盖掉。
|
|
253
282
|
const update = state.dshUpdate
|
|
254
283
|
const latestCell = (latest, available) => latest == null
|
|
255
284
|
? '<strong>—</strong>'
|
|
256
285
|
: available
|
|
257
|
-
? `<strong>${esc(latest)} <span class="pill amber"
|
|
258
|
-
: `<strong>${esc(latest)} <span class="pill green"
|
|
286
|
+
? `<strong>${esc(latest)} <span class="pill amber">${t('可升级')}</span></strong>`
|
|
287
|
+
: `<strong>${esc(latest)} <span class="pill green">${t('global.latest')}</span></strong>`
|
|
259
288
|
const outbox = data.outbox ?? { pending: 0, failed: 0, delivered: 0 }
|
|
260
289
|
return `
|
|
261
290
|
<div class="card form-card g-card">
|
|
262
291
|
<div class="card-head">
|
|
263
|
-
<h3
|
|
264
|
-
<button class="btn small" data-action="check-dsh-update">${icon('refresh')}
|
|
292
|
+
<h3>${t('global.cardDshService')}</h3>
|
|
293
|
+
<button class="btn small" data-action="check-dsh-update">${icon('refresh')}${t('global.checkUpdate')}</button>
|
|
265
294
|
</div>
|
|
266
|
-
|
|
267
|
-
<div class="kv"><span
|
|
268
|
-
|
|
269
|
-
<div class="kv"><span
|
|
270
|
-
${Number(outbox.failed ?? 0) > 0 ? `<div class="kv" style="margin-top:12px"><span
|
|
295
|
+
${versionRow('global.dshCurrentVersion', data.dsh?.version)}
|
|
296
|
+
<div class="kv"><span>${t('global.dshLatestVersion')}</span>${latestCell(update?.latest, update?.updateAvailable)}</div>
|
|
297
|
+
${versionRow('global.pluginCurrentVersion', data.pluginVersion)}
|
|
298
|
+
<div class="kv"><span>${t('global.pluginLatestVersion')}</span>${latestCell(update?.pluginLatest, update?.pluginUpdateAvailable)}</div>
|
|
299
|
+
${Number(outbox.failed ?? 0) > 0 ? `<div class="kv" style="margin-top:12px"><span>${t('global.outboxQueue')}</span><strong>${t('global.outboxFailed', { count: outbox.failed })}</strong></div>` : ''}
|
|
271
300
|
</div>`
|
|
272
301
|
}
|
|
273
302
|
|
|
274
303
|
function renderSettings() {
|
|
275
304
|
const project = activeProject()
|
|
276
|
-
const copyPath = value => `<button class="btn icon small" type="button" data-action="copy" data-copy="${attr(value)}" title="复制路径" aria-label="复制路径">${icon('copy')}</button>`
|
|
305
|
+
const copyPath = value => `<button class="btn icon small" type="button" data-action="copy" data-copy="${attr(value)}" title="${t("复制路径")}" aria-label="${t("复制路径")}">${icon('copy')}</button>`
|
|
277
306
|
if (!project) return noProject()
|
|
278
307
|
const members = activeBots()
|
|
279
308
|
const owner = botById(project.owner_bot_id)
|
|
@@ -282,22 +311,22 @@ function renderSettings() {
|
|
|
282
311
|
<div class="settings-grid">
|
|
283
312
|
<div>
|
|
284
313
|
<div class="card form-card">
|
|
285
|
-
<div class="card-head"><h3
|
|
314
|
+
<div class="card-head"><h3>${t("项目资料")}</h3><span class="meta">${esc(project.key ?? project.id)}</span></div>
|
|
286
315
|
<input type="hidden" name="projectId" value="${attr(project.id)}">
|
|
287
|
-
<div class="field"><label id="settings-name-label" for="settings-name"
|
|
288
|
-
<div class="field"><label id="settings-description-label" for="settings-description"
|
|
316
|
+
<div class="field"><label id="settings-name-label" for="settings-name">${t("项目名称")}</label><input class="input" id="settings-name" name="name" value="${attr(project.name)}" maxlength="80"></div>
|
|
317
|
+
<div class="field"><label id="settings-description-label" for="settings-description">${t("项目描述")}</label><textarea class="textarea" id="settings-description" name="description">${esc(project.description || '')}</textarea></div>
|
|
289
318
|
<div class="field-row">
|
|
290
|
-
<div class="field"><label id="settings-owner-label" for="settings-owner"
|
|
291
|
-
<div class="field"><label id="settings-reply-mode-label" for="settings-reply-mode"
|
|
319
|
+
<div class="field"><label id="settings-owner-label" for="settings-owner">${t("总监")} Bot</label><select class="select" id="settings-owner" name="ownerBotId">${members.map(bot => `<option value="${attr(bot.id)}" ${bot.id === project.owner_bot_id ? 'selected' : ''}>${esc(bot.name)}</option>`).join('')}</select></div>
|
|
320
|
+
<div class="field"><label id="settings-reply-mode-label" for="settings-reply-mode">${t("群聊回复模式")}</label><select class="select" id="settings-reply-mode" name="replyMode"><option value="owner_first" ${project.group?.reply_mode !== 'everyone' ? 'selected' : ''}>${t("总监优先")}</option><option value="everyone" ${project.group?.reply_mode === 'everyone' ? 'selected' : ''}>${t("全员响应")}</option></select></div>
|
|
292
321
|
</div>
|
|
293
322
|
</div>
|
|
294
323
|
<div class="card form-card" style="margin-top:12px">
|
|
295
|
-
<div class="card-head"><h3
|
|
324
|
+
<div class="card-head"><h3>${t("月度预算")}</h3></div>
|
|
296
325
|
<div class="field-row">
|
|
297
|
-
<div class="field"><label id="settings-token-budget-label" for="settings-token-budget">Token
|
|
298
|
-
<div class="field"><label id="settings-cost-budget-label" for="settings-cost-budget"
|
|
326
|
+
<div class="field"><label id="settings-token-budget-label" for="settings-token-budget">Token ${t("预算")}</label><input class="input mono" style="text-align:right" type="number" min="0" id="settings-token-budget" name="tokenBudget" value="${project.token_budget ?? ''}" placeholder="${t("不限制")}"></div>
|
|
327
|
+
<div class="field"><label id="settings-cost-budget-label" for="settings-cost-budget">${t("成本预算")}</label><input class="input mono" style="text-align:right" type="number" min="0" step="0.01" id="settings-cost-budget" name="costBudget" value="${project.cost_budget ?? ''}" placeholder="${t("不限制")}"></div>
|
|
299
328
|
</div>
|
|
300
|
-
<div class="hint"
|
|
329
|
+
<div class="hint">${t("超出预算时项目会提示预算已用尽。成本预算与模型价格使用同一币种计价。")}</div>
|
|
301
330
|
</div>
|
|
302
331
|
<div class="card form-card" style="margin-top:12px">
|
|
303
332
|
<div class="card-head"><h3>${t('settings.codeHygieneTitle')}</h3></div>
|
|
@@ -310,25 +339,25 @@ function renderSettings() {
|
|
|
310
339
|
</div>
|
|
311
340
|
<div>
|
|
312
341
|
<div class="card form-card">
|
|
313
|
-
<div class="card-head"><h3
|
|
342
|
+
<div class="card-head"><h3>${t("工作区路径")}</h3></div>
|
|
314
343
|
<div class="field">
|
|
315
|
-
<label id="settings-production-label" for="settings-production"
|
|
316
|
-
<div style="display:flex;gap:8px"><input class="input mono" style="flex:1" id="settings-production" name="productionDir" value="${attr(project.production_dir ?? '')}" placeholder="/Users/you/repos/my-game(可选)"><button class="btn" type="button" data-action="pick-dir-open" data-picker-for="settings-production">${icon('folder')}
|
|
317
|
-
<div class="hint">Bots
|
|
344
|
+
<label id="settings-production-label" for="settings-production">${t("生产目录")}</label>
|
|
345
|
+
<div style="display:flex;gap:8px"><input class="input mono" style="flex:1" id="settings-production" name="productionDir" value="${attr(project.production_dir ?? '')}" placeholder="/Users/you/repos/my-game${t("(可选)")}"><button class="btn" type="button" data-action="pick-dir-open" data-picker-for="settings-production">${icon('folder')}${t("选择")}</button></div>
|
|
346
|
+
<div class="hint">Bots ${t("的工作目录,可指向既有代码库;留空则用默认管理目录,切换后已有密钥会自动迁移并清理旧目录。")}</div>
|
|
318
347
|
<div class="dir-picker" id="dir-picker-settings-production" hidden></div>
|
|
319
348
|
</div>
|
|
320
|
-
<div class="path-row"><span
|
|
321
|
-
<div class="path-row"><span
|
|
349
|
+
<div class="path-row"><span>${t("当前生效")}</span>${pathCode(tildePath(project.workspace_path))}${copyPath(project.workspace_path)}</div>
|
|
350
|
+
<div class="path-row"><span>${t("管理数据")}</span>${pathCode(project.data_path ?? '')}${copyPath(project.data_path ?? '')}</div>
|
|
322
351
|
</div>
|
|
323
352
|
<div class="card form-card" style="margin-top:12px">
|
|
324
|
-
<div class="card-head"><h3
|
|
325
|
-
<div class="kv"><span
|
|
326
|
-
<div class="kv"><span
|
|
327
|
-
<div class="kv"><span
|
|
353
|
+
<div class="card-head"><h3>${t("项目状态")}</h3>${project.status === 'active' ? `<span class="pill green">${t("运行中")}</span>` : `<span class="pill amber">${t("已归档")}</span>`}</div>
|
|
354
|
+
<div class="kv"><span>${t("总监")}</span><strong>${esc(owner?.name ?? t("未设置"))}</strong></div>
|
|
355
|
+
<div class="kv"><span>${t("任务总数")}</span><strong>${project.stats.tasks}</strong></div>
|
|
356
|
+
<div class="kv"><span>${t("运行总数")}</span><strong>${project.stats.runs}</strong></div>
|
|
328
357
|
${project.status === 'active'
|
|
329
|
-
? `<div class="btn-row settings-danger-row" style="margin-top:12px;justify-content:flex-end"><button class="btn small danger" type="button" data-action="archive-project" data-project-id="${attr(project.id)}"
|
|
330
|
-
: `<div class="hint" style="margin-top:10px"
|
|
331
|
-
<div class="btn-row" style="margin-top:12px;justify-content:flex-end"><button class="btn small" type="button" data-action="remove-tracking-open" data-project-id="${attr(project.id)}" data-project-name="${attr(project.name)}"
|
|
358
|
+
? `<div class="btn-row settings-danger-row" style="margin-top:12px;justify-content:flex-end"><button class="btn small danger" type="button" data-action="archive-project" data-project-id="${attr(project.id)}">${t("归档项目")}</button></div>`
|
|
359
|
+
: `<div class="hint" style="margin-top:10px">${t("已归档项目停止新运行,工作区文件保留。项目再开会恢复为进行中;移除追踪会清理本项目的管理数据。")}</div>
|
|
360
|
+
<div class="btn-row" style="margin-top:12px;justify-content:flex-end"><button class="btn small" type="button" data-action="remove-tracking-open" data-project-id="${attr(project.id)}" data-project-name="${attr(project.name)}">${t("移除追踪")}</button><button class="btn small primary" type="button" data-action="reopen-project" data-project-id="${attr(project.id)}">${t("项目再开")}</button></div>`}
|
|
332
361
|
</div>
|
|
333
362
|
</div>
|
|
334
363
|
</div>
|
|
@@ -341,22 +370,6 @@ function currentScale() {
|
|
|
341
370
|
return Number.isFinite(value) && value > 0 ? value : 1
|
|
342
371
|
}
|
|
343
372
|
|
|
344
|
-
// 分组信息架构(DSHBOTS-184):一节 = 一组 = 一个锚点;组内是 12 列槽位,
|
|
345
|
-
// 槽位负责跨列排布,modal-forms 的价格卡因此不必改自己的结构。
|
|
346
|
-
function gsec(index, id, title, desc, body) {
|
|
347
|
-
return `
|
|
348
|
-
<section class="gsec" id="${id}" aria-labelledby="${id}-title">
|
|
349
|
-
<div class="gsec-head">
|
|
350
|
-
<span class="gsec-index mono">${index}</span>
|
|
351
|
-
<div class="gsec-copy">
|
|
352
|
-
<h3 class="gsec-title" id="${id}-title">${title}</h3>
|
|
353
|
-
<p class="gsec-desc">${desc}</p>
|
|
354
|
-
</div>
|
|
355
|
-
</div>
|
|
356
|
-
<div class="gsec-body">${body}</div>
|
|
357
|
-
</section>`
|
|
358
|
-
}
|
|
359
|
-
|
|
360
373
|
function renderGlobal() {
|
|
361
374
|
const data = state.data
|
|
362
375
|
const scale = currentScale()
|
|
@@ -364,47 +377,41 @@ function renderGlobal() {
|
|
|
364
377
|
// 用 || 而非 ??:settingsView() 对未保存键返回 ''(见 core.js),空串必须回落 auto,否则三选项都不选中。
|
|
365
378
|
const uiLanguage = data.settings?.ui_language || 'auto'
|
|
366
379
|
const notify = notifyToggleView()
|
|
367
|
-
return
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
<a class="global-nav-item" href="#g-runtime">运行与预算</a>
|
|
379
|
-
<a class="global-nav-item" href="#g-about">关于与系统状态</a>
|
|
380
|
-
</nav>
|
|
381
|
-
${gsec('01', 'g-pref', '偏好', '只影响这台机器上的显示方式,保存后立即生效。', `
|
|
382
|
-
<div class="g-slot g-slot--full">
|
|
383
|
-
<div class="card form-card g-card">
|
|
380
|
+
return pageShell(
|
|
381
|
+
pageHead('GLOBAL CONFIGURATION', t('global.title'), t('global.desc'), refreshAction()),
|
|
382
|
+
pageNav([
|
|
383
|
+
{ id: 'g-pref', label: t('global.groupPref') },
|
|
384
|
+
{ id: 'g-runtime', label: t('global.groupRuntime') },
|
|
385
|
+
{ id: 'g-about', label: t('global.groupAbout') },
|
|
386
|
+
], t('global.navLabel')),
|
|
387
|
+
[
|
|
388
|
+
pageSection({
|
|
389
|
+
index: '01', id: 'g-pref', title: t('global.groupPref'), desc: t('global.groupPrefDesc'),
|
|
390
|
+
body: slot('full', `<div class="card form-card g-card">
|
|
384
391
|
<div class="card-head">
|
|
385
|
-
<h3
|
|
386
|
-
<div class="btn-row"><button class="btn small" type="button" data-action="reset-scale">${icon('refresh')}
|
|
392
|
+
<h3>${t('global.cardUi')}</h3>
|
|
393
|
+
<div class="btn-row"><button class="btn small" type="button" data-action="reset-scale">${icon('refresh')}${t('global.reset')}</button></div>
|
|
387
394
|
</div>
|
|
388
395
|
<div class="g-fields">
|
|
389
396
|
<div class="field">
|
|
390
|
-
<label id="ui-scale-label" for="ui-scale"
|
|
397
|
+
<label id="ui-scale-label" for="ui-scale">${t('global.uiScale')} <span class="mono" id="ui-scale-value">${Math.round(scale * 100)}%</span></label>
|
|
391
398
|
<input type="range" id="ui-scale" class="range" min="1" max="1.4" step="0.05" value="${scale}">
|
|
392
399
|
<div class="scale-row">
|
|
393
|
-
<span class="faint"
|
|
394
|
-
<span class="faint" style="margin-left:auto"
|
|
400
|
+
<span class="faint">${t('global.uiScaleSmall')}</span>
|
|
401
|
+
<span class="faint" style="margin-left:auto">${t('global.uiScaleLarge')}</span>
|
|
395
402
|
</div>
|
|
396
403
|
</div>
|
|
397
404
|
<div class="field">
|
|
398
|
-
<span class="field-label" id="ui-theme-label"
|
|
405
|
+
<span class="field-label" id="ui-theme-label">${t('global.theme')}</span>
|
|
399
406
|
<div class="seg" role="group" aria-labelledby="ui-theme-label">
|
|
400
407
|
<button data-action="set-theme" data-theme="dsh" aria-pressed="${state.theme === 'dsh'}">DSH</button>
|
|
401
408
|
<button data-action="set-theme" data-theme="catppuccin" aria-pressed="${state.theme === 'catppuccin'}">Catppuccin</button>
|
|
402
409
|
</div>
|
|
403
410
|
</div>
|
|
404
411
|
<div class="field">
|
|
405
|
-
<span class="field-label" id="desktop-notify-label"
|
|
406
|
-
<div><button class="btn small" type="button" data-action="toggle-notify" aria-labelledby="desktop-notify-label" aria-pressed="${notify.on ? 'true' : 'false'}"${notify.disabled ? ' disabled' : ''}>${esc(notify.label)}</button></div>
|
|
407
|
-
<div class="hint">${esc(notify.hint)}</div>
|
|
412
|
+
<span class="field-label" id="desktop-notify-label">${t('桌面通知')}</span>
|
|
413
|
+
<div><button class="btn small" type="button" data-action="toggle-notify" aria-labelledby="desktop-notify-label" aria-pressed="${notify.on ? 'true' : 'false'}"${notify.disabled ? ' disabled' : ''}>${esc(t(notify.label))}</button></div>
|
|
414
|
+
<div class="hint">${esc(t(notify.hint))}</div>
|
|
408
415
|
</div>
|
|
409
416
|
<div class="field">
|
|
410
417
|
<label id="settings-ui-language-label" for="settings-ui-language">${t('settings.uiLanguage')}</label>
|
|
@@ -418,17 +425,23 @@ function renderGlobal() {
|
|
|
418
425
|
</div>
|
|
419
426
|
<div class="g-foot">
|
|
420
427
|
<div class="g-kvs">
|
|
421
|
-
<div class="kv"><span
|
|
422
|
-
<div class="kv"><span
|
|
428
|
+
<div class="kv"><span>${t('global.scaleRange')}</span><strong>100% – 140%</strong></div>
|
|
429
|
+
<div class="kv"><span>${t('global.prefStorage')}</span><strong>${t('global.prefStorageValue')}</strong></div>
|
|
423
430
|
</div>
|
|
424
431
|
<div class="btn-row"><button class="btn small primary" type="button" data-action="save-ui-language">${esc(t('settings.uiLanguageSave'))}</button></div>
|
|
425
432
|
</div>
|
|
426
|
-
</div
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
433
|
+
</div>`),
|
|
434
|
+
}),
|
|
435
|
+
pageSection({
|
|
436
|
+
index: '02', id: 'g-runtime', title: t('global.groupRuntime'), desc: t('global.groupRuntimeDesc'),
|
|
437
|
+
body: `${slot('half', renderRunLimitsCard())}${slot('half', renderOpsCard())}`,
|
|
438
|
+
}),
|
|
439
|
+
pageSection({
|
|
440
|
+
index: '03', id: 'g-about', title: t('global.groupAbout'), desc: t('global.groupAboutDesc'),
|
|
441
|
+
body: `${slot('half', dshPathsCard())}${slot('half', dshServiceCard())}`,
|
|
442
|
+
}),
|
|
443
|
+
],
|
|
444
|
+
)
|
|
432
445
|
}
|
|
433
446
|
|
|
434
|
-
export { renderUsageGlobal, renderUsageDomain, renderUsageSolo, renderRunLimitsCard, renderOpsCard,
|
|
447
|
+
export { renderUsageGlobal, renderUsageDomain, renderUsageSolo, renderRunLimitsCard, renderOpsCard, renderSettings, currentScale, renderGlobal }
|