dsh-gemini-web 0.0.0-stage → 0.2.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.en.md +317 -0
- package/README.md +315 -2
- package/SKILL.md +94 -0
- package/SKILL.zh-CN.md +94 -0
- package/client.js +1805 -0
- package/cordis.patch.yml +8 -0
- package/index.js +1437 -0
- package/locale/en-US.json +65 -0
- package/locale/en.json +65 -0
- package/locale/zh-CN.json +65 -0
- package/locale/zh.json +65 -0
- package/package.json +56 -3
- package/references/agentlimb.md +164 -0
- package/references/director_prompt.md +67 -0
- package/references/models.md +38 -0
- package/references/playbooks/academic_deep_research.md +20 -0
- package/references/playbooks/content_video_media.md +21 -0
- package/references/playbooks/data_office_automation.md +22 -0
- package/references/playbooks/interactive_game_studio.md +20 -0
- package/references/playbooks/web_fullstack_app.md +23 -0
- package/requirements.txt +2 -0
- package/scripts/agentlimb_client.py +119 -0
- package/scripts/dsh_sprite_slicer.py +140 -0
- package/scripts/gemini_agentlimb.py +1696 -0
- package/scripts/gemini_web.py +4281 -0
- package/scripts/inspect_antigravity.py +1663 -0
- package/scripts/platform_utils.py +822 -0
- package/scripts/setup_skill.py +707 -0
- package/scripts/sync_upstream.py +148 -0
package/client.js
ADDED
|
@@ -0,0 +1,1805 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-gemini-web browser client
|
|
3
|
+
* Hand-written ModuleLoader bundle: 100% self-contained, no external runtime dependencies.
|
|
4
|
+
* Full multi-language support (zh-CN first, zh-TW, en-US) with dynamic DSH language auto-detection.
|
|
5
|
+
*/
|
|
6
|
+
window.__ModuleLoader__.load({
|
|
7
|
+
id: 'dsh-gemini-web',
|
|
8
|
+
factory: (require) => {
|
|
9
|
+
const module = { exports: {} }
|
|
10
|
+
const exports = module.exports
|
|
11
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' })
|
|
12
|
+
|
|
13
|
+
const React = require('react')
|
|
14
|
+
const { createElement: h, useState, useEffect, useRef } = React
|
|
15
|
+
|
|
16
|
+
const NS = 'gemini-web'
|
|
17
|
+
const PKG = 'dsh-gemini-web'
|
|
18
|
+
|
|
19
|
+
// 1. 原創 Gemini 漸層風格樣式與白天/黑夜適配 (針對 DSH 564px 設定欄寬度全面優化)
|
|
20
|
+
const STYLES = `
|
|
21
|
+
.gw-root {
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
width: 100%;
|
|
24
|
+
max-width: 100%;
|
|
25
|
+
min-width: 0;
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 0 2px 24px 2px;
|
|
28
|
+
container-type: inline-size;
|
|
29
|
+
}
|
|
30
|
+
.gw-root *, .gw-root *::before, .gw-root *::after {
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
}
|
|
33
|
+
.gw-header-split {
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: space-between;
|
|
36
|
+
align-items: center;
|
|
37
|
+
flex-wrap: wrap;
|
|
38
|
+
gap: 8px;
|
|
39
|
+
}
|
|
40
|
+
.gw-grid-2 {
|
|
41
|
+
display: grid;
|
|
42
|
+
grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
|
|
43
|
+
gap: 10px;
|
|
44
|
+
margin-top: 8px;
|
|
45
|
+
}
|
|
46
|
+
.gw-grid-4 {
|
|
47
|
+
display: grid;
|
|
48
|
+
grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
|
|
49
|
+
gap: 8px;
|
|
50
|
+
margin-top: 8px;
|
|
51
|
+
}
|
|
52
|
+
.gw-btn-row {
|
|
53
|
+
display: flex;
|
|
54
|
+
gap: 8px;
|
|
55
|
+
flex-wrap: wrap;
|
|
56
|
+
align-items: center;
|
|
57
|
+
}
|
|
58
|
+
.gw-code {
|
|
59
|
+
background: rgba(0, 0, 0, 0.35);
|
|
60
|
+
padding: 3px 6px;
|
|
61
|
+
border-radius: 4px;
|
|
62
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
63
|
+
font-size: 11px;
|
|
64
|
+
word-break: break-all;
|
|
65
|
+
overflow-wrap: anywhere;
|
|
66
|
+
max-width: 100%;
|
|
67
|
+
display: inline-block;
|
|
68
|
+
user-select: all;
|
|
69
|
+
}
|
|
70
|
+
.gw-setting-row {
|
|
71
|
+
display: flex;
|
|
72
|
+
justify-content: space-between;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: 14px;
|
|
75
|
+
padding: 10px 0;
|
|
76
|
+
border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.05));
|
|
77
|
+
flex-wrap: wrap;
|
|
78
|
+
}
|
|
79
|
+
.gw-setting-row:last-child {
|
|
80
|
+
border-bottom: none;
|
|
81
|
+
padding-bottom: 0;
|
|
82
|
+
}
|
|
83
|
+
.gw-setting-info {
|
|
84
|
+
flex: 1 1 240px;
|
|
85
|
+
min-width: 0;
|
|
86
|
+
}
|
|
87
|
+
.gw-setting-ctrl {
|
|
88
|
+
flex: 0 1 auto;
|
|
89
|
+
display: flex;
|
|
90
|
+
justify-content: flex-end;
|
|
91
|
+
align-items: center;
|
|
92
|
+
min-width: 160px;
|
|
93
|
+
max-width: 100%;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.gw-dot {
|
|
97
|
+
width: 7px;
|
|
98
|
+
height: 7px;
|
|
99
|
+
border-radius: 50%;
|
|
100
|
+
display: inline-block;
|
|
101
|
+
flex-shrink: 0;
|
|
102
|
+
}
|
|
103
|
+
.gw-dot-ok {
|
|
104
|
+
background: #10b981;
|
|
105
|
+
box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
|
|
106
|
+
}
|
|
107
|
+
.gw-dot-warn {
|
|
108
|
+
background: #f59e0b;
|
|
109
|
+
box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
|
|
110
|
+
}
|
|
111
|
+
.gw-dot-err {
|
|
112
|
+
background: #ef4444;
|
|
113
|
+
box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
|
|
114
|
+
}
|
|
115
|
+
.gw-card {
|
|
116
|
+
box-sizing: border-box;
|
|
117
|
+
width: 100%;
|
|
118
|
+
padding: 14px 16px;
|
|
119
|
+
border-radius: 8px;
|
|
120
|
+
background: var(--dsw-alias-bg-layer-2, rgba(255, 255, 255, 0.04));
|
|
121
|
+
border: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.08));
|
|
122
|
+
margin-bottom: 12px;
|
|
123
|
+
font-size: 13px;
|
|
124
|
+
transition: border-color 0.2s ease, background 0.2s ease;
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
word-break: break-word;
|
|
127
|
+
}
|
|
128
|
+
.gw-card:hover {
|
|
129
|
+
border-color: var(--dsw-alias-border-l2, rgba(255, 255, 255, 0.16));
|
|
130
|
+
}
|
|
131
|
+
.gw-title {
|
|
132
|
+
font-weight: 600;
|
|
133
|
+
margin-bottom: 8px;
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
gap: 6px;
|
|
137
|
+
}
|
|
138
|
+
.gw-desc {
|
|
139
|
+
color: var(--dsw-alias-text-secondary, rgba(255, 255, 255, 0.7));
|
|
140
|
+
font-size: 12px;
|
|
141
|
+
line-height: 1.5;
|
|
142
|
+
}
|
|
143
|
+
.gw-badge {
|
|
144
|
+
display: inline-flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
gap: 4px;
|
|
147
|
+
padding: 2px 7px;
|
|
148
|
+
border-radius: 9999px;
|
|
149
|
+
font-size: 11px;
|
|
150
|
+
font-weight: 500;
|
|
151
|
+
background: var(--dsw-alias-badge-bg, rgba(99, 102, 241, 0.15));
|
|
152
|
+
color: var(--dsw-alias-badge-text, #818cf8);
|
|
153
|
+
border: 1px solid rgba(99, 102, 241, 0.3);
|
|
154
|
+
white-space: nowrap;
|
|
155
|
+
flex-shrink: 0;
|
|
156
|
+
}
|
|
157
|
+
.gw-badge-warn {
|
|
158
|
+
background: rgba(245, 158, 11, 0.15);
|
|
159
|
+
color: #f59e0b;
|
|
160
|
+
border-color: rgba(245, 158, 11, 0.3);
|
|
161
|
+
}
|
|
162
|
+
.gw-badge-err {
|
|
163
|
+
background: rgba(239, 68, 68, 0.15);
|
|
164
|
+
color: #ef4444;
|
|
165
|
+
border-color: rgba(239, 68, 68, 0.3);
|
|
166
|
+
}
|
|
167
|
+
.gw-progress-bar {
|
|
168
|
+
width: 100%;
|
|
169
|
+
height: 6px;
|
|
170
|
+
border-radius: 9999px;
|
|
171
|
+
background: var(--dsw-alias-bg-layer-3, rgba(255, 255, 255, 0.1));
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
margin: 6px 0;
|
|
174
|
+
}
|
|
175
|
+
.gw-progress-fill {
|
|
176
|
+
height: 100%;
|
|
177
|
+
background: linear-gradient(90deg, #10b981 0%, #34d399 50%, #6ee7b7 100%);
|
|
178
|
+
border-radius: 9999px;
|
|
179
|
+
transition: width 0.3s ease;
|
|
180
|
+
}
|
|
181
|
+
.gw-btn {
|
|
182
|
+
display: inline-flex;
|
|
183
|
+
align-items: center;
|
|
184
|
+
justify-content: center;
|
|
185
|
+
gap: 6px;
|
|
186
|
+
padding: 6px 12px;
|
|
187
|
+
border-radius: 6px;
|
|
188
|
+
font-size: 12px;
|
|
189
|
+
font-weight: 500;
|
|
190
|
+
cursor: pointer;
|
|
191
|
+
border: none;
|
|
192
|
+
background: #4f46e5;
|
|
193
|
+
color: #ffffff;
|
|
194
|
+
transition: opacity 0.2s ease, transform 0.1s ease;
|
|
195
|
+
}
|
|
196
|
+
.gw-btn:hover {
|
|
197
|
+
opacity: 0.9;
|
|
198
|
+
}
|
|
199
|
+
.gw-btn:active {
|
|
200
|
+
transform: scale(0.98);
|
|
201
|
+
}
|
|
202
|
+
.gw-btn:disabled {
|
|
203
|
+
opacity: 0.5;
|
|
204
|
+
cursor: not-allowed;
|
|
205
|
+
}
|
|
206
|
+
.gw-btn-secondary {
|
|
207
|
+
background: var(--dsw-alias-bg-layer-3, rgba(255, 255, 255, 0.08));
|
|
208
|
+
color: var(--dsw-alias-text-primary, #ffffff);
|
|
209
|
+
border: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.12));
|
|
210
|
+
}
|
|
211
|
+
.gw-select, .gw-input {
|
|
212
|
+
background: var(--dsw-alias-input-bg, #1e222b);
|
|
213
|
+
color: var(--dsw-alias-text-primary, #f1f5f9);
|
|
214
|
+
border: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.16));
|
|
215
|
+
border-radius: 6px;
|
|
216
|
+
padding: 5px 8px;
|
|
217
|
+
font-size: 12px;
|
|
218
|
+
outline: none;
|
|
219
|
+
}
|
|
220
|
+
.gw-select option, .gw-select optgroup {
|
|
221
|
+
background-color: var(--dsw-alias-input-bg, #1e222b);
|
|
222
|
+
color: var(--dsw-alias-text-primary, #f1f5f9);
|
|
223
|
+
}
|
|
224
|
+
.gw-select:focus, .gw-input:focus {
|
|
225
|
+
border-color: #6366f1;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* 白天主題專用適配 (Light Mode) */
|
|
229
|
+
@media (prefers-color-scheme: light) {
|
|
230
|
+
.gw-card {
|
|
231
|
+
background: #ffffff !important;
|
|
232
|
+
border-color: #e2e8f0 !important;
|
|
233
|
+
color: #0f172a !important;
|
|
234
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
235
|
+
}
|
|
236
|
+
.gw-desc {
|
|
237
|
+
color: #475569 !important;
|
|
238
|
+
}
|
|
239
|
+
.gw-title {
|
|
240
|
+
color: #0f172a !important;
|
|
241
|
+
}
|
|
242
|
+
.gw-select, .gw-input {
|
|
243
|
+
background: #f8fafc !important;
|
|
244
|
+
color: #0f172a !important;
|
|
245
|
+
border-color: #cbd5e1 !important;
|
|
246
|
+
}
|
|
247
|
+
.gw-select option, .gw-select optgroup {
|
|
248
|
+
background-color: #ffffff !important;
|
|
249
|
+
color: #0f172a !important;
|
|
250
|
+
}
|
|
251
|
+
.gw-btn-secondary {
|
|
252
|
+
background: #f1f5f9 !important;
|
|
253
|
+
color: #1e293b !important;
|
|
254
|
+
border-color: #cbd5e1 !important;
|
|
255
|
+
}
|
|
256
|
+
.gw-setting-row {
|
|
257
|
+
border-bottom-color: #e2e8f0 !important;
|
|
258
|
+
}
|
|
259
|
+
.gw-code {
|
|
260
|
+
background: #f1f5f9 !important;
|
|
261
|
+
color: #0f172a !important;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
[data-theme="light"] .gw-card, .theme-light .gw-card, body.light-theme .gw-card {
|
|
265
|
+
background: #ffffff !important;
|
|
266
|
+
border-color: #e2e8f0 !important;
|
|
267
|
+
color: #0f172a !important;
|
|
268
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
269
|
+
}
|
|
270
|
+
[data-theme="light"] .gw-desc, .theme-light .gw-desc, body.light-theme .gw-desc {
|
|
271
|
+
color: #475569 !important;
|
|
272
|
+
}
|
|
273
|
+
[data-theme="light"] .gw-title, .theme-light .gw-title, body.light-theme .gw-title {
|
|
274
|
+
color: #0f172a !important;
|
|
275
|
+
}
|
|
276
|
+
[data-theme="light"] .gw-select, .theme-light .gw-select, body.light-theme .gw-select,
|
|
277
|
+
[data-theme="light"] .gw-input, .theme-light .gw-input, body.light-theme .gw-input {
|
|
278
|
+
background: #f8fafc !important;
|
|
279
|
+
color: #0f172a !important;
|
|
280
|
+
border-color: #cbd5e1 !important;
|
|
281
|
+
}
|
|
282
|
+
[data-theme="light"] .gw-select option, .theme-light .gw-select option, body.light-theme .gw-select option,
|
|
283
|
+
[data-theme="light"] .gw-select optgroup, .theme-light .gw-select optgroup, body.light-theme .gw-select optgroup {
|
|
284
|
+
background-color: #ffffff !important;
|
|
285
|
+
color: #0f172a !important;
|
|
286
|
+
}
|
|
287
|
+
[data-theme="light"] .gw-btn-secondary, .theme-light .gw-btn-secondary, body.light-theme .gw-btn-secondary {
|
|
288
|
+
background: #f1f5f9 !important;
|
|
289
|
+
color: #1e293b !important;
|
|
290
|
+
border-color: #cbd5e1 !important;
|
|
291
|
+
}
|
|
292
|
+
[data-theme="light"] .gw-setting-row, .theme-light .gw-setting-row, body.light-theme .gw-setting-row {
|
|
293
|
+
border-bottom-color: #e2e8f0 !important;
|
|
294
|
+
}
|
|
295
|
+
[data-theme="light"] .gw-code, .theme-light .gw-code, body.light-theme .gw-code {
|
|
296
|
+
background: #f1f5f9 !important;
|
|
297
|
+
color: #0f172a !important;
|
|
298
|
+
}
|
|
299
|
+
`
|
|
300
|
+
|
|
301
|
+
const API_BASE = (() => {
|
|
302
|
+
try { return new URL('api/gemini-web', document.baseURI).pathname } catch { return '/api/gemini-web' }
|
|
303
|
+
})()
|
|
304
|
+
|
|
305
|
+
async function api(path, options) {
|
|
306
|
+
const { timeout = 25000, body, ...fetchOptions } = options ?? {}
|
|
307
|
+
const ctrl = new AbortController()
|
|
308
|
+
const timer = setTimeout(() => ctrl.abort(), timeout)
|
|
309
|
+
try {
|
|
310
|
+
const fullUrl = `${API_BASE.replace(/\/$/, '')}/${path.replace(/^\//, '')}`
|
|
311
|
+
const res = await fetch(fullUrl, {
|
|
312
|
+
...fetchOptions,
|
|
313
|
+
headers: { 'content-type': 'application/json', ...(fetchOptions.headers || {}) },
|
|
314
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
315
|
+
signal: ctrl.signal,
|
|
316
|
+
})
|
|
317
|
+
return await res.json()
|
|
318
|
+
} finally {
|
|
319
|
+
clearTimeout(timer)
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// 2. 多語言字典 (i18n: zh-CN, zh-TW, en-US)
|
|
324
|
+
const I18N = {
|
|
325
|
+
'zh-CN': {
|
|
326
|
+
title: '✨ Gemini 网页端调度中心 (Agent 模式)',
|
|
327
|
+
unauthed_title: '⚠️ Google 账号尚未登录 / 状态过期',
|
|
328
|
+
unauthed_desc: '检测到浏览器尚未登录 Google 或当前标签页被重定向至登录页。请点击下方按钮登录后再使用:',
|
|
329
|
+
unauthed_btn: '🔑 一键打开浏览器 Google 登录',
|
|
330
|
+
bridge_title: '浏览器底层通信通道 (Bridge):',
|
|
331
|
+
bridge_al_preferred: '🟢 AgentLimb 优先 (免弹窗)',
|
|
332
|
+
bridge_cdp_mode: '🟡 CDP 模式 (备用)',
|
|
333
|
+
bridge_disconnected: '🔴 未连接',
|
|
334
|
+
route_al: '🚀 当前生效优先路由:通道 A (AgentLimb) ⚡ 完全静默・零 Allow 弹窗・CDP 备用通道完全休眠',
|
|
335
|
+
route_cdp: '⚠️ 当前生效优先路由:通道 B (CDP {port}) — 备用模式,每次连接需手动点击浏览器 Allow 弹窗',
|
|
336
|
+
route_none: '❌ 目前双通道皆未连接,请参考下方配置指引完成连接',
|
|
337
|
+
multi_instance_title: '⚠️ 检测到多个开启远程调试的浏览器实例:',
|
|
338
|
+
multi_instance_tip: '💡 建议关闭多余的浏览器窗口以避免通信冲突,或在下方「CDP 调试端口」指定您想使用的端口。',
|
|
339
|
+
channel_a_title: '通道 A: AgentLimb (推荐)',
|
|
340
|
+
channel_a_connected: '已连接 (零弹窗/永久授权)',
|
|
341
|
+
channel_a_offline: '未在线',
|
|
342
|
+
channel_b_title: '通道 B: Chromium CDP (备用)',
|
|
343
|
+
channel_b_connected: '已连接 (需点击 Allow)',
|
|
344
|
+
channel_b_dormant: '已休眠 (零弹窗保护)',
|
|
345
|
+
channel_b_offline: '未连接',
|
|
346
|
+
status_prefix: '状态:',
|
|
347
|
+
port_prefix: '端口:',
|
|
348
|
+
config_prefix: '配置:',
|
|
349
|
+
browser_prefix: '浏览器:',
|
|
350
|
+
probing: '探测中 (正轮询 Gemini 与 Flow)...',
|
|
351
|
+
probe_all_btn: '🔄 重新探测全部通道与站点',
|
|
352
|
+
sending: '发送中...',
|
|
353
|
+
test_al_btn: '⚡ 测试 AgentLimb (Say 侧边栏)',
|
|
354
|
+
executing: 'Agent 执行中...',
|
|
355
|
+
test_agent_btn: '🤖 测试 Agent 跑任务',
|
|
356
|
+
clear_cache_btn: '🧹 清除缓存',
|
|
357
|
+
al_sending_msg: '⏳ 正在向 AgentLimb 侧边栏发送通知...',
|
|
358
|
+
al_success_msg: '🎉 已向浏览器侧边栏成功发送即时通知!请看侧边栏',
|
|
359
|
+
al_failed_prefix: '❌ 测试失败:',
|
|
360
|
+
agent_executing_msg: '⏳ 正在通过 AgentLimb/CDP 调度 AI Studio 执行任务...',
|
|
361
|
+
agent_success_title: '✅ 任务完成 ({channel} 通道 · 模型: {model} · 耗时 {duration}ms){fallback}',
|
|
362
|
+
agent_fallback_tag: ' [塞车自动降级]',
|
|
363
|
+
agent_failed_prefix: '❌ 调度失败:',
|
|
364
|
+
guide_title: '📖 浏览器连接配置指引(依需求二选一)',
|
|
365
|
+
guide_a_title: '🟢 方案 A(强烈推荐・100% 免弹窗)',
|
|
366
|
+
guide_a_1: '1. 在常用 Chromium 浏览器(Chrome / Edge / Brave 等)安装 AgentLimb 扩展。',
|
|
367
|
+
guide_a_2: '2. 点击扩展功能面板的「Pair」完成一次性本机配对。',
|
|
368
|
+
guide_a_3: '3. 永久免弹窗、不改快捷方式、重启电脑直接可用!',
|
|
369
|
+
guide_a_btn: '🔗 下载 AgentLimb 扩展套件',
|
|
370
|
+
guide_b_title: '🟡 方案 B(免安装扩展・本机内置调试)',
|
|
371
|
+
guide_b_1: '1. 在现有 Chromium 浏览器地址栏输入:',
|
|
372
|
+
guide_b_2: '2. 勾选启用调试开关(或快捷方式启动时加上 --remote-debugging-port=9222)。',
|
|
373
|
+
guide_b_3: '3. 点击上方「重新探测通道」即可自动连接。',
|
|
374
|
+
quota_title: '📊 实时网页端免费额度大盘',
|
|
375
|
+
quota_polling_tip: '⏳ 正在轮询 Gemini 与 Google Flow 独立点数...',
|
|
376
|
+
quota_refresh_btn: '🔄 刷新额度 (含 Flow)',
|
|
377
|
+
quota_refreshing: '探测中...',
|
|
378
|
+
quota_isolated_badge: '3 大站点额度完全独立・绝不扣款',
|
|
379
|
+
aistudio_title: '🌐 Google AI Studio (aistudio.google.com)',
|
|
380
|
+
aistudio_badge: 'key_off 免费层级',
|
|
381
|
+
aistudio_desc: '• 免费无限轮询层级:支持 1M Token 长输出(Argon / Hydrogen / Flash),未挂载 API Key 时直接享受网页免费无限额度,绝对不会扣除付费账号额度!',
|
|
382
|
+
gemini_title: '📈 Gemini 官网 5小时滚动池 ({plan})',
|
|
383
|
+
gemini_plan_pro: 'PRO',
|
|
384
|
+
gemini_plan_free: '免费版',
|
|
385
|
+
gemini_plan_default: '一般方案',
|
|
386
|
+
gemini_used_pct: '{pct}% 已使用',
|
|
387
|
+
gemini_reset: '重置周期:{time} (独立对话额度)',
|
|
388
|
+
flow_title: '🎨 Google Flow (flow.google.com)',
|
|
389
|
+
flow_connected_badge: '🟢 已连通',
|
|
390
|
+
flow_pending_badge: '🟡 待刷新',
|
|
391
|
+
flow_offline_badge: '🔴 未连通',
|
|
392
|
+
flow_credits_unit: '可用点数:{credits} 点(🎨 生图免扣点・完全免费)',
|
|
393
|
+
flow_desc_p1: '• 点数用途:免费享有独立点数,专门用于 Veo / Omni 视频生成(每部视频仅消耗少量点数)。',
|
|
394
|
+
flow_desc_p2: '• 生图特权:使用 Nano Banana 2.1 生成 2K 高清图片时“完全不扣除点数”(单张消耗 0 点,等同无限免费生图)!',
|
|
395
|
+
flow_reset_label: '重置时间:',
|
|
396
|
+
flow_desc_p3_daily: '• 额度重置:每日自动刷新({text})。',
|
|
397
|
+
flow_desc_p3_monthly: '• 额度重置:每月自动补满({text})。',
|
|
398
|
+
flow_desc_p3_generic: '• 额度重置:依方案自动刷新({text})。',
|
|
399
|
+
flow_desc_p3_empty: '• 额度重置:依官方方案自动刷新。',
|
|
400
|
+
probe_err_title: '浏览器通道探测失败 / 通信中断',
|
|
401
|
+
probe_err_tip: '💡 提示:请确认 Chrome / Edge / Brave 浏览器是否已启动,且 AgentLimb 扩展功能处于连线状态,或 CDP 调试端口已开启。',
|
|
402
|
+
probe_err_no_browser: '未检测到任何正在运行的浏览器实例 (请开启 Chrome / Edge / Brave 浏览器)',
|
|
403
|
+
probe_err_failed: '额度探测失败,浏览器可能未响应或已关闭',
|
|
404
|
+
probe_err_timeout: '探测超时 (15s):浏览器未能在时限内响应,请检查浏览器是否卡住或已关闭',
|
|
405
|
+
retry_btn: '🔄 重新探测',
|
|
406
|
+
quota_offline_warning: '⚠️ 浏览器当前未连线:下方用量显示为离线预设值。请启动浏览器并点击重新探测。',
|
|
407
|
+
settings_section_title: '⚙️ Agent 调度与浏览器通道设置',
|
|
408
|
+
dispatch_mode_title: 'Agent 调度执行模式:',
|
|
409
|
+
dispatch_mode_ask_first_desc: '🛡️ 先问后用(原作者推荐):发包前呈现渠道与参数提案,待确认后执行;支持「例外直通」(指定直接发包直接跑)',
|
|
410
|
+
dispatch_mode_fast_track_desc: '⚡ 极速直通:收到任务后第一步直接调用 gemini_web_agent 委派执行,跳过前置确认卡',
|
|
411
|
+
dispatch_mode_ask_first: '🛡️ 先问后用模式 (原作者推荐・安全控费)',
|
|
412
|
+
dispatch_mode_fast_track: '⚡ 极速直通模式 (Fast-Track・免确认)',
|
|
413
|
+
lang_label: '界面语言 (Language):',
|
|
414
|
+
lang_desc: '默认自动跟随 DSH 系统语言,亦可在此手动指定',
|
|
415
|
+
lang_auto: '🌐 自动 (跟随 DSH 系统)',
|
|
416
|
+
lang_zhcn: '简体中文',
|
|
417
|
+
lang_zhtw: '繁體中文',
|
|
418
|
+
lang_en: 'English',
|
|
419
|
+
conn_strategy_title: '浏览器连接通道策略:',
|
|
420
|
+
conn_strategy_desc: 'auto 模式优先走 AgentLimb,成功则完全不碰 CDP',
|
|
421
|
+
conn_auto: '🌟 自动 (AgentLimb 优先)',
|
|
422
|
+
conn_al: '⚡ 强制 AgentLimb (零弹窗)',
|
|
423
|
+
conn_cdp: '🛠️ 强制 CDP (9222 端口)',
|
|
424
|
+
default_model_title: 'Agent 默认首选模型:',
|
|
425
|
+
sync_models_btn: '🔄 刷新网页模型池',
|
|
426
|
+
syncing: '同步中...',
|
|
427
|
+
models_classified: '已分类 {count} 个模型(已锁定多模态专用与付费项)',
|
|
428
|
+
models_default_note: '已加载标准模型池(多模态专用模型已锁定,由 AI 自动调用)',
|
|
429
|
+
group_text: '💬 文字与推理对话池 (可选为聊天首选)',
|
|
430
|
+
group_media: '🔒 多模态专用池(非日常聊天・AI自动调用)',
|
|
431
|
+
group_paid: '🔒 付费模型池 (付费层级・默认保护防扣款)',
|
|
432
|
+
tag_media: '[多模态专用]',
|
|
433
|
+
tag_paid: '[付费层级]',
|
|
434
|
+
thinking_policy_title: '思考阈值与降级策略:',
|
|
435
|
+
thinking_policy_adaptive_desc: '🌟 智能自适应:复杂架构/算法任务自动给予 150s 思考 / 300s 总时;思维链心跳防杀;遇塞车阶梯备援',
|
|
436
|
+
thinking_policy_custom_desc: '⏱️ 自定义超时:严格遵循下方设定的任务超时秒数;思维链心跳防杀;遇塞车阶梯备援',
|
|
437
|
+
thinking_policy_strict_desc: '🛑 严格模式:坚守所选模型绝不降级;遇超时或塞车立即中止并提醒,绝不偷偷切换轻量模型',
|
|
438
|
+
thinking_policy_adaptive_opt: '🌟 智能自适应模式 (推荐)',
|
|
439
|
+
thinking_policy_custom_opt: '⏱️ 自定义超时模式',
|
|
440
|
+
thinking_policy_strict_opt: '🛑 严格模式 (绝不降级)',
|
|
441
|
+
fallback_ladder_title: '降级阶梯序列 (Fallback Ladder):',
|
|
442
|
+
fallback_ladder_badge: '1~5 级备援',
|
|
443
|
+
fallback_ladder_desc: '🌟 遇排队拥塞时按此顺序自动降级尝试。可自由配置备选顺序,支持选用 gemini.google.com 兜底。',
|
|
444
|
+
fallback_ladder_add_btn: '+ 添加备援',
|
|
445
|
+
fallback_ladder_reset_btn: '恢复默认',
|
|
446
|
+
ladder_tier_label: '第 {level} 级备援',
|
|
447
|
+
ladder_move_up: '上移优先级 (升至前一级备援)',
|
|
448
|
+
ladder_move_down: '下移优先级 (降至后一级备援)',
|
|
449
|
+
ladder_remove_tip: '移除此级备援',
|
|
450
|
+
thinking_level_title: '推理思考等级 (Thinking Level):',
|
|
451
|
+
thinking_high: 'High (推荐默认)',
|
|
452
|
+
thinking_extra_high: 'Extra High (🔒 已上锁 - 免费池防 403)',
|
|
453
|
+
thinking_medium: 'Medium (折衷)',
|
|
454
|
+
thinking_low: 'Low (低思考速回)',
|
|
455
|
+
timeout_title: '任务超时限制:',
|
|
456
|
+
timeout_active_badge: '⏱️ 自定义模式生效中',
|
|
457
|
+
timeout_adaptive_badge: '🌟 智能自适应基准',
|
|
458
|
+
timeout_strict_badge: '🛑 严格模式基准',
|
|
459
|
+
timeout_custom_hint: '⏱️ 自定义模式:思考与总任务超时严格遵循此设定值,不进行自适应放宽。',
|
|
460
|
+
timeout_adaptive_hint: '🌟 基准为 180 秒;遇复杂架构/算法 (C++、红黑树等) 自动放宽至 300 秒。',
|
|
461
|
+
timeout_strict_hint: '🛑 坚守所选模型,深度思考上限 150 秒,超时直接中止提醒。',
|
|
462
|
+
sec_unit: '秒',
|
|
463
|
+
auto_saved_tip: '✅ 已自动永久保存',
|
|
464
|
+
cdp_port_title: 'CDP 调试端口 (仅 CDP 模式生效):',
|
|
465
|
+
save_btn: '💾 保存并应用设置',
|
|
466
|
+
saving: '保存中...',
|
|
467
|
+
save_success: '✅ 设置已保存生效!',
|
|
468
|
+
save_failed_prefix: '❌ 保存失败: ',
|
|
469
|
+
links_title: '🔗 官方工作台直达',
|
|
470
|
+
link_aistudio: '🌐 Google AI Studio',
|
|
471
|
+
link_flow: '🎨 Google Flow',
|
|
472
|
+
link_gemini: '📈 Gemini 额度大盘',
|
|
473
|
+
link_accounts: '🔑 Google 账号中心',
|
|
474
|
+
safety_title: '🛡️ 运行机制与自用原则声明',
|
|
475
|
+
safety_item1: '• 🛡️ 不算反代,不导出 API,不抽 Cookie:纯本机浏览器自动化 Agent,等同于让 AI 替你打开本机已登录的 Chromium 浏览器(如 Chrome / Edge / Brave 等)。',
|
|
476
|
+
safety_item2: '• 🌐 官方真实渲染:所有请求皆通过官方真实网页打字与接收结果,相对更稳,完全绕开本地 Token 与模型限制。',
|
|
477
|
+
safety_item3: '• ⚡ 频率控制建议:日常自用建议保持合理调度频率,避免极高频并发刷网页端;遇到高峰排队塞车时,建议切换为 Flash Lite 备用。',
|
|
478
|
+
safety_item4: '• 🔒 100% 回环安全:所有通信限制于本机 127.0.0.1 回环,零凭证外泄风险。',
|
|
479
|
+
nav_label: '✨ Gemini 网页端 (Agent 调度中心)'
|
|
480
|
+
},
|
|
481
|
+
'en-US': {
|
|
482
|
+
title: '✨ Gemini Web Orchestration (Agent Mode)',
|
|
483
|
+
unauthed_title: '⚠️ Google Account Not Logged In / Session Expired',
|
|
484
|
+
unauthed_desc: 'Browser has not logged in to Google or active tab was redirected to login page. Please log in before proceeding:',
|
|
485
|
+
unauthed_btn: '🔑 Open Browser Google Login',
|
|
486
|
+
bridge_title: 'Browser Communication Bridge:',
|
|
487
|
+
bridge_al_preferred: '🟢 AgentLimb Preferred (Zero-Popup)',
|
|
488
|
+
bridge_cdp_mode: '🟡 CDP Mode (Fallback)',
|
|
489
|
+
bridge_disconnected: '🔴 Disconnected',
|
|
490
|
+
route_al: '🚀 Active Primary Route: Channel A (AgentLimb) ⚡ Fully Silent · Zero Allow Popups · CDP Fallback Dormant',
|
|
491
|
+
route_cdp: '⚠️ Active Primary Route: Channel B (CDP {port}) — Fallback Mode, requires clicking browser Allow prompt',
|
|
492
|
+
route_none: '❌ Both channels disconnected. Please follow setup instructions below to connect.',
|
|
493
|
+
multi_instance_title: '⚠️ Multiple Remote Debugging Browser Instances Detected:',
|
|
494
|
+
multi_instance_tip: '💡 Recommended to close extra browser windows to avoid port conflicts, or specify your port below.',
|
|
495
|
+
channel_a_title: 'Channel A: AgentLimb (Recommended)',
|
|
496
|
+
channel_a_connected: 'Connected (Zero-Popup / Permanent Auth)',
|
|
497
|
+
channel_a_offline: 'Offline',
|
|
498
|
+
channel_b_title: 'Channel B: Chromium CDP (Fallback)',
|
|
499
|
+
channel_b_connected: 'Connected (Requires Allow prompt)',
|
|
500
|
+
channel_b_dormant: 'Dormant (Zero-Popup Guard)',
|
|
501
|
+
channel_b_offline: 'Disconnected',
|
|
502
|
+
status_prefix: 'Status: ',
|
|
503
|
+
port_prefix: 'Port: ',
|
|
504
|
+
config_prefix: 'Config: ',
|
|
505
|
+
browser_prefix: 'Browser: ',
|
|
506
|
+
probing: 'Probing (Polling Gemini & Flow)...',
|
|
507
|
+
probe_all_btn: '🔄 Probe All Channels & Sites',
|
|
508
|
+
sending: 'Sending...',
|
|
509
|
+
test_al_btn: '⚡ Test AgentLimb (Sidebar Say)',
|
|
510
|
+
executing: 'Agent Executing...',
|
|
511
|
+
test_agent_btn: '🤖 Test Agent Task Execution',
|
|
512
|
+
clear_cache_btn: '🧹 Clear Cache',
|
|
513
|
+
al_sending_msg: '⏳ Sending notification to AgentLimb sidebar...',
|
|
514
|
+
al_success_msg: '🎉 Successfully sent live notification to browser sidebar! Check sidebar.',
|
|
515
|
+
al_failed_prefix: '❌ Test Failed: ',
|
|
516
|
+
agent_executing_msg: '⏳ Orchestrating AI Studio task via AgentLimb/CDP...',
|
|
517
|
+
agent_success_title: '✅ Task Completed ({channel} channel · Model: {model} · Elapsed: {duration}ms){fallback}',
|
|
518
|
+
agent_fallback_tag: ' [Congestion Auto-Fallback]',
|
|
519
|
+
agent_failed_prefix: '❌ Orchestration Failed: ',
|
|
520
|
+
guide_title: '📖 Browser Connection Guide (Choose Either)',
|
|
521
|
+
guide_a_title: '🟢 Option A (Highly Recommended · 100% Zero-Popup)',
|
|
522
|
+
guide_a_1: '1. Install AgentLimb extension in your Chromium browser (Chrome / Edge / Brave).',
|
|
523
|
+
guide_a_2: '2. Click "Pair" in the extension popup for a one-time local pairing.',
|
|
524
|
+
guide_a_3: '3. Permanent zero-popup, no shortcut changes, survives reboots!',
|
|
525
|
+
guide_a_btn: '🔗 Download AgentLimb Extension',
|
|
526
|
+
guide_b_title: '🟡 Option B (No Extension · Built-in Debugging)',
|
|
527
|
+
guide_b_1: '1. In your Chromium browser address bar, navigate to:',
|
|
528
|
+
guide_b_2: '2. Check "Enable remote debugging" (or add --remote-debugging-port=9222 to shortcut).',
|
|
529
|
+
guide_b_3: '3. Click "Probe Channels" above to connect automatically.',
|
|
530
|
+
quota_title: '📊 Real-Time Web Free Quota Dashboard',
|
|
531
|
+
quota_polling_tip: '⏳ Polling Gemini & Google Flow independent credits...',
|
|
532
|
+
quota_refresh_btn: '🔄 Refresh Quota (incl. Flow)',
|
|
533
|
+
quota_refreshing: 'Probing...',
|
|
534
|
+
quota_isolated_badge: '3 Sites Quotas Isolated · Zero Charges',
|
|
535
|
+
aistudio_title: '🌐 Google AI Studio (aistudio.google.com)',
|
|
536
|
+
aistudio_badge: 'key_off Free Tier',
|
|
537
|
+
aistudio_desc: '• Free Unlimited Polling Tier: Supports 1M token output (Argon / Hydrogen / Flash). Directly uses web free quota without API key, never charges paid accounts!',
|
|
538
|
+
gemini_title: '📈 Gemini Web 5-Hour Rolling Pool ({plan})',
|
|
539
|
+
gemini_plan_pro: 'PRO',
|
|
540
|
+
gemini_plan_free: 'Free Tier',
|
|
541
|
+
gemini_plan_default: 'Standard',
|
|
542
|
+
gemini_used_pct: '{pct}% Used',
|
|
543
|
+
gemini_reset: 'Reset Cycle: {time} (Independent chat quota)',
|
|
544
|
+
flow_title: '🎨 Google Flow (flow.google.com)',
|
|
545
|
+
flow_connected_badge: '🟢 Connected',
|
|
546
|
+
flow_pending_badge: '🟡 Pending',
|
|
547
|
+
flow_offline_badge: '🔴 Disconnected',
|
|
548
|
+
flow_credits_unit: 'Available: {credits} Credits (🎨 Images: 100% Free / 0 Cost)',
|
|
549
|
+
flow_desc_p1: '• Credit Purpose: Free dedicated credits for Veo / Omni video generation (costs few credits per video).',
|
|
550
|
+
flow_desc_p2: '• Free Image Gen: 2K HD image generation via Nano Banana 2.1 costs 0 credits (completely free, unlimited generation)!',
|
|
551
|
+
flow_reset_label: 'Reset: ',
|
|
552
|
+
flow_desc_p3_daily: '• Balance Reset: Daily auto-refresh ({text}).',
|
|
553
|
+
flow_desc_p3_monthly: '• Balance Reset: Monthly auto-refresh ({text}).',
|
|
554
|
+
flow_desc_p3_generic: '• Balance Reset: Replenished according to plan ({text}).',
|
|
555
|
+
flow_desc_p3_empty: '• Balance Reset: Automatically refreshed according to plan.',
|
|
556
|
+
probe_err_title: 'Browser Channel Probe Failed / Communication Lost',
|
|
557
|
+
probe_err_tip: '💡 Tip: Please ensure Chrome / Edge / Brave is running, and AgentLimb extension is paired/connected, or CDP debugging port is active.',
|
|
558
|
+
probe_err_no_browser: 'No running browser instance detected (please launch Chrome / Edge / Brave)',
|
|
559
|
+
probe_err_failed: 'Quota probe failed; browser might not be responding or is closed',
|
|
560
|
+
probe_err_timeout: 'Probe timeout (15s): Browser did not respond in time; please verify browser status',
|
|
561
|
+
retry_btn: '🔄 Retry Probe',
|
|
562
|
+
quota_offline_warning: '⚠️ Browser currently offline: Quotas below show default offline values. Launch browser and retry.',
|
|
563
|
+
settings_section_title: '⚙️ Agent Orchestration & Channel Settings',
|
|
564
|
+
dispatch_mode_title: 'Agent Dispatch Mode:',
|
|
565
|
+
dispatch_mode_ask_first_desc: '🛡️ Ask-Before-Dispatch (Author Recommended): Presents proposal before execution; bypasses on explicit direct request',
|
|
566
|
+
dispatch_mode_fast_track_desc: '⚡ Fast-Track: Directly calls gemini_web_agent upon task arrival without confirmation card',
|
|
567
|
+
dispatch_mode_ask_first: '🛡️ Ask-Before-Dispatch (Author Recommended)',
|
|
568
|
+
dispatch_mode_fast_track: '⚡ Fast-Track Mode (Direct Execution)',
|
|
569
|
+
lang_label: 'Interface Language (Language):',
|
|
570
|
+
lang_desc: 'Default follows DSH system language, or choose manually here',
|
|
571
|
+
lang_auto: '🌐 Auto (Follow DSH System)',
|
|
572
|
+
lang_zhcn: 'Simplified Chinese',
|
|
573
|
+
lang_zhtw: 'Traditional Chinese',
|
|
574
|
+
lang_en: 'English',
|
|
575
|
+
conn_strategy_title: 'Browser Connection Strategy:',
|
|
576
|
+
conn_strategy_desc: 'Auto mode prioritizes AgentLimb; if successful, leaves CDP dormant',
|
|
577
|
+
conn_auto: '🌟 Auto (AgentLimb Preferred)',
|
|
578
|
+
conn_al: '⚡ Force AgentLimb (Zero-Popup)',
|
|
579
|
+
conn_cdp: '🛠️ Force CDP (Port 9222)',
|
|
580
|
+
default_model_title: 'Agent Default Preferred Model:',
|
|
581
|
+
sync_models_btn: '🔄 Refresh Web Models',
|
|
582
|
+
syncing: 'Syncing...',
|
|
583
|
+
models_classified: 'Classified {count} models (Multimodal & Paid models locked)',
|
|
584
|
+
models_default_note: 'Standard model pool loaded (Multimodal models locked for AI invocation)',
|
|
585
|
+
group_text: '💬 Text & Reasoning Models (Chat Preferred)',
|
|
586
|
+
group_media: '🔒 Multimodal Dedicated Pool (Non-chat · AI Invoked)',
|
|
587
|
+
group_paid: '🔒 Paid Models Pool (Paid Tier · Guarded)',
|
|
588
|
+
tag_media: '[Multimodal Only]',
|
|
589
|
+
tag_paid: '[Paid Tier]',
|
|
590
|
+
thinking_policy_title: 'Thinking Threshold & Fallback Policy:',
|
|
591
|
+
thinking_policy_adaptive_desc: '🌟 Smart Adaptive: Auto-allocates 150s thinking / 300s total for complex architecture/algorithms; liveness heartbeat; ladder fallback on congestion',
|
|
592
|
+
thinking_policy_custom_desc: '⏱️ Custom Timeout: Strictly follows the timeout seconds specified below; liveness heartbeat; ladder fallback on congestion',
|
|
593
|
+
thinking_policy_strict_desc: '🛑 Strict Mode: Strictly maintains requested model; aborts immediately on timeout or congestion without falling back to lightweight models',
|
|
594
|
+
thinking_policy_adaptive_opt: '🌟 Smart Adaptive Mode (Recommended)',
|
|
595
|
+
thinking_policy_custom_opt: '⏱️ Custom Timeout Mode',
|
|
596
|
+
thinking_policy_strict_opt: '🛑 Strict Mode (No Fallback)',
|
|
597
|
+
fallback_ladder_title: 'Fallback Ladder Sequence:',
|
|
598
|
+
fallback_ladder_badge: '1~5 Tiers',
|
|
599
|
+
fallback_ladder_desc: '🌟 Sequentially falls back on congestion. Reorder or customize freely, choose gemini.google.com as safety net.',
|
|
600
|
+
fallback_ladder_add_btn: '+ Add Tier',
|
|
601
|
+
fallback_ladder_reset_btn: 'Reset',
|
|
602
|
+
ladder_tier_label: 'Tier #{level}',
|
|
603
|
+
ladder_move_up: 'Move up priority',
|
|
604
|
+
ladder_move_down: 'Move down priority',
|
|
605
|
+
ladder_remove_tip: 'Remove tier',
|
|
606
|
+
thinking_level_title: 'Reasoning Thinking Level:',
|
|
607
|
+
thinking_high: 'High (Recommended Default)',
|
|
608
|
+
thinking_extra_high: 'Extra High (🔒 Locked - Free Tier Safe)',
|
|
609
|
+
thinking_medium: 'Medium (Balanced)',
|
|
610
|
+
thinking_low: 'Low (Fast Response)',
|
|
611
|
+
timeout_title: 'Task Timeout Limit:',
|
|
612
|
+
timeout_active_badge: '⏱️ Custom Mode Active',
|
|
613
|
+
timeout_adaptive_badge: '🌟 Adaptive Base',
|
|
614
|
+
timeout_strict_badge: '🛑 Strict Base',
|
|
615
|
+
timeout_custom_hint: '⏱️ Custom mode: Thinking and total task timeout will strictly obey this value without scaling.',
|
|
616
|
+
timeout_adaptive_hint: '🌟 Base is 180s; automatically relaxed to 300s for complex architecture/algorithms.',
|
|
617
|
+
timeout_strict_hint: '🛑 Maintains target model; thinking cap 150s, aborts immediately on timeout.',
|
|
618
|
+
sec_unit: 'sec',
|
|
619
|
+
auto_saved_tip: '✅ Auto-saved permanently',
|
|
620
|
+
cdp_port_title: 'CDP Debug Port (CDP Mode Only):',
|
|
621
|
+
save_btn: '💾 Save & Apply Settings',
|
|
622
|
+
saving: 'Saving...',
|
|
623
|
+
save_success: '✅ Settings saved and applied!',
|
|
624
|
+
save_failed_prefix: '❌ Save failed: ',
|
|
625
|
+
links_title: '🔗 Official Consoles Quick Access',
|
|
626
|
+
link_aistudio: '🌐 Google AI Studio',
|
|
627
|
+
link_flow: '🎨 Google Flow',
|
|
628
|
+
link_gemini: '📈 Gemini Quota Dashboard',
|
|
629
|
+
link_accounts: '🔑 Google Account Center',
|
|
630
|
+
safety_title: '🛡️ Operational Mechanism & Fair-Use Statement',
|
|
631
|
+
safety_item1: '• 🛡️ Not a proxy, no API export, no Cookie extraction: Pure local browser automation agent, equivalent to letting AI use your logged-in Chromium browser (Chrome / Edge / Brave, etc.).',
|
|
632
|
+
safety_item2: '• 🌐 Authentic official rendering: All requests are typed and rendered directly on official web pages, bypassing token limits.',
|
|
633
|
+
safety_item3: '• ⚡ Rate limit recommendations: Keep a reasonable request frequency for daily personal use; switch to Flash Lite during peak congestion.',
|
|
634
|
+
safety_item4: '• 🔒 100% Loopback Security: All communications are restricted to 127.0.0.1 loopback with zero credential exposure.',
|
|
635
|
+
nav_label: '✨ Gemini Web (Agent Orchestration Center)'
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
function resolveDshLanguage() {
|
|
640
|
+
try {
|
|
641
|
+
const l = ((typeof document !== 'undefined' && document.documentElement?.lang) || (typeof navigator !== 'undefined' && navigator.language) || '').toLowerCase()
|
|
642
|
+
if (l.startsWith('en')) return 'en-US'
|
|
643
|
+
} catch {}
|
|
644
|
+
return 'zh-CN'
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
// 3. 視覺化設定與控制主面板 (嵌入 DSH Settings)
|
|
648
|
+
function SettingsPanel({ isModal, onClose }) {
|
|
649
|
+
const [status, setStatus] = useState(null)
|
|
650
|
+
const [usage, setUsage] = useState(null)
|
|
651
|
+
|
|
652
|
+
const DEFAULT_LOCAL_CONFIG = {
|
|
653
|
+
connectionMode: 'auto',
|
|
654
|
+
defaultModel: 'gemini-3.5-flash-lite',
|
|
655
|
+
autoFallback: true,
|
|
656
|
+
fallbackMode: 'ladder',
|
|
657
|
+
fallbackLadder: [
|
|
658
|
+
'gemini-4-hydrogen',
|
|
659
|
+
'gemini-3.8-flash',
|
|
660
|
+
'gemini-3.5-flash-lite',
|
|
661
|
+
'gemini.google.com',
|
|
662
|
+
],
|
|
663
|
+
thinkingPolicy: 'adaptive',
|
|
664
|
+
thinkingLevel: 'high',
|
|
665
|
+
timeoutSec: 180,
|
|
666
|
+
port: 9222,
|
|
667
|
+
preferredBrowser: 'auto',
|
|
668
|
+
flowCount: 1,
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
// 优先从 localStorage 读取已保存设定,首帧即载入用户选择,杜绝刷新倒退回 flash lite
|
|
672
|
+
const [config, setConfig] = useState(() => {
|
|
673
|
+
try {
|
|
674
|
+
const cached = localStorage.getItem('dsh_gemini_web_config')
|
|
675
|
+
if (cached) {
|
|
676
|
+
const parsed = JSON.parse(cached)
|
|
677
|
+
return {
|
|
678
|
+
...DEFAULT_LOCAL_CONFIG,
|
|
679
|
+
...parsed,
|
|
680
|
+
fallbackLadder: Array.isArray(parsed.fallbackLadder) && parsed.fallbackLadder.length > 0
|
|
681
|
+
? parsed.fallbackLadder
|
|
682
|
+
: DEFAULT_LOCAL_CONFIG.fallbackLadder
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
} catch {}
|
|
686
|
+
return DEFAULT_LOCAL_CONFIG
|
|
687
|
+
})
|
|
688
|
+
|
|
689
|
+
const [loading, setLoading] = useState(false)
|
|
690
|
+
const [saving, setSaving] = useState(false)
|
|
691
|
+
const [testResult, setTestResult] = useState(null)
|
|
692
|
+
const [alTestResult, setAlTestResult] = useState(null)
|
|
693
|
+
const [saveNotice, setSaveNotice] = useState('')
|
|
694
|
+
const [availableModels, setAvailableModels] = useState([])
|
|
695
|
+
const [syncingModels, setSyncingModels] = useState(false)
|
|
696
|
+
const [probeError, setProbeError] = useState(null)
|
|
697
|
+
|
|
698
|
+
// 即時設定寫死器:更新 React State 同步寫入 localStorage 並背景 POST 後端永久保存
|
|
699
|
+
const updateConfig = (patch) => {
|
|
700
|
+
setConfig((prev) => {
|
|
701
|
+
const next = { ...prev, ...patch }
|
|
702
|
+
try {
|
|
703
|
+
localStorage.setItem('dsh_gemini_web_config', JSON.stringify(next))
|
|
704
|
+
} catch {}
|
|
705
|
+
api('/config', { method: 'POST', body: next })
|
|
706
|
+
.then((res) => {
|
|
707
|
+
if (res?.ok) {
|
|
708
|
+
setSaveNotice(t('auto_saved_tip'))
|
|
709
|
+
setTimeout(() => setSaveNotice(''), 2500)
|
|
710
|
+
}
|
|
711
|
+
})
|
|
712
|
+
.catch(() => {})
|
|
713
|
+
return next
|
|
714
|
+
})
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// 語言狀態管理 (支援 auto, zh-CN, zh-TW, en-US)
|
|
718
|
+
const [langChoice, setLangChoice] = useState(() => {
|
|
719
|
+
try {
|
|
720
|
+
return localStorage.getItem('dsh_gemini_web_lang') || 'auto'
|
|
721
|
+
} catch {
|
|
722
|
+
return 'auto'
|
|
723
|
+
}
|
|
724
|
+
})
|
|
725
|
+
const [dshLang, setDshLang] = useState(resolveDshLanguage)
|
|
726
|
+
|
|
727
|
+
useEffect(() => {
|
|
728
|
+
if (typeof MutationObserver !== 'undefined' && typeof document !== 'undefined' && document.documentElement) {
|
|
729
|
+
const obs = new MutationObserver(() => {
|
|
730
|
+
setDshLang(resolveDshLanguage())
|
|
731
|
+
})
|
|
732
|
+
obs.observe(document.documentElement, { attributes: true, attributeFilter: ['lang'] })
|
|
733
|
+
return () => obs.disconnect()
|
|
734
|
+
}
|
|
735
|
+
}, [])
|
|
736
|
+
|
|
737
|
+
const activeLang = langChoice === 'auto' ? dshLang : langChoice
|
|
738
|
+
const dict = I18N[activeLang] || I18N['zh-CN']
|
|
739
|
+
const t = (k, params) => {
|
|
740
|
+
let text = dict[k] ?? I18N['zh-CN'][k] ?? k
|
|
741
|
+
if (params) {
|
|
742
|
+
for (const [pk, pv] of Object.entries(params)) {
|
|
743
|
+
text = text.replaceAll(`{${pk}}`, String(pv))
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
return text
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
const syncModels = async () => {
|
|
750
|
+
setSyncingModels(true)
|
|
751
|
+
try {
|
|
752
|
+
const m = await api('/models', { timeout: 20000 })
|
|
753
|
+
if (m?.ok && Array.isArray(m.models)) {
|
|
754
|
+
setAvailableModels(m.models)
|
|
755
|
+
}
|
|
756
|
+
} catch (e) {
|
|
757
|
+
console.error(e)
|
|
758
|
+
} finally {
|
|
759
|
+
setSyncingModels(false)
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
const loadData = async () => {
|
|
764
|
+
setLoading(true)
|
|
765
|
+
setProbeError(null)
|
|
766
|
+
setAlTestResult(null)
|
|
767
|
+
try {
|
|
768
|
+
const s = await api('/status', { timeout: 8000 })
|
|
769
|
+
setStatus(s)
|
|
770
|
+
let localCfg = {}
|
|
771
|
+
try {
|
|
772
|
+
const cached = localStorage.getItem('dsh_gemini_web_config')
|
|
773
|
+
if (cached) localCfg = JSON.parse(cached)
|
|
774
|
+
} catch {}
|
|
775
|
+
if (s?.config) {
|
|
776
|
+
// 用户本地主动选取的配置优先于后端未设定之默认值,杜绝刷新回落
|
|
777
|
+
const merged = { ...s.config, ...localCfg }
|
|
778
|
+
if (!Array.isArray(merged.fallbackLadder) || merged.fallbackLadder.length === 0) {
|
|
779
|
+
merged.fallbackLadder = DEFAULT_LOCAL_CONFIG.fallbackLadder
|
|
780
|
+
}
|
|
781
|
+
setConfig(merged)
|
|
782
|
+
if (JSON.stringify(merged) !== JSON.stringify(s.config)) {
|
|
783
|
+
api('/config', { method: 'POST', body: merged }).catch(() => {})
|
|
784
|
+
}
|
|
785
|
+
} else if (Object.keys(localCfg).length > 0) {
|
|
786
|
+
setConfig(prev => ({ ...prev, ...localCfg }))
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
// 通道状态校验:若 AgentLimb 与 CDP 皆未就绪(浏览器未开或死掉),快速报错,绝不阻塞盲等
|
|
790
|
+
const hasLiveChannel = Boolean(s?.agentlimb?.ready || s?.cdp?.connected || s?.dual?.agentlimb?.ready || s?.dual?.cdp?.connected)
|
|
791
|
+
if (!hasLiveChannel) {
|
|
792
|
+
const detail = s?.agentlimb?.error || s?.cdp?.error || s?.dual?.agentlimb?.error || s?.dual?.cdp?.error || t('probe_err_no_browser')
|
|
793
|
+
setProbeError(detail)
|
|
794
|
+
setUsage({ ok: false, error: detail })
|
|
795
|
+
return
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
const u = await api('/usage?force=1', { timeout: 16000 })
|
|
799
|
+
setUsage(u)
|
|
800
|
+
if (!u?.ok) {
|
|
801
|
+
setProbeError(u?.error || t('probe_err_failed'))
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
const m = await api('/models', { timeout: 10000 })
|
|
805
|
+
if (m?.ok && Array.isArray(m.models)) {
|
|
806
|
+
setAvailableModels(m.models)
|
|
807
|
+
}
|
|
808
|
+
} catch (e) {
|
|
809
|
+
console.error(e)
|
|
810
|
+
const errText = e.name === 'AbortError'
|
|
811
|
+
? t('probe_err_timeout')
|
|
812
|
+
: (e.message || String(e))
|
|
813
|
+
setProbeError(errText)
|
|
814
|
+
} finally {
|
|
815
|
+
setLoading(false)
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
const saveSettings = async () => {
|
|
820
|
+
setSaving(true)
|
|
821
|
+
setSaveNotice('')
|
|
822
|
+
try {
|
|
823
|
+
try {
|
|
824
|
+
localStorage.setItem('dsh_gemini_web_config', JSON.stringify(config))
|
|
825
|
+
} catch {}
|
|
826
|
+
const res = await api('/config', { method: 'POST', body: config })
|
|
827
|
+
if (res?.ok) {
|
|
828
|
+
setSaveNotice(t('save_success'))
|
|
829
|
+
loadData()
|
|
830
|
+
}
|
|
831
|
+
} catch (e) {
|
|
832
|
+
setSaveNotice(t('save_failed_prefix') + e.message)
|
|
833
|
+
} finally {
|
|
834
|
+
setSaving(false)
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
const clearCache = async () => {
|
|
839
|
+
try {
|
|
840
|
+
await api('/clear-cache', { method: 'POST' })
|
|
841
|
+
loadData()
|
|
842
|
+
} catch {}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
const openUrl = (url) => {
|
|
846
|
+
api('/open-url', { method: 'POST', body: { url } })
|
|
847
|
+
.catch(() => {
|
|
848
|
+
if (typeof window !== 'undefined') window.open(url, '_blank')
|
|
849
|
+
})
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
const runAlTest = async () => {
|
|
853
|
+
setAlTestResult({ testing: true })
|
|
854
|
+
try {
|
|
855
|
+
const res = await api('/test-agentlimb', { method: 'POST', timeout: 10000 })
|
|
856
|
+
if (res?.ok) {
|
|
857
|
+
setAlTestResult({ ok: true, message: t('al_success_msg') })
|
|
858
|
+
} else {
|
|
859
|
+
setAlTestResult({ ok: false, error: res?.error || 'AgentLimb error' })
|
|
860
|
+
}
|
|
861
|
+
} catch (err) {
|
|
862
|
+
setAlTestResult({ ok: false, error: err.message })
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
const runAgentTaskTest = async () => {
|
|
867
|
+
setTestResult({ testing: true })
|
|
868
|
+
try {
|
|
869
|
+
const res = await api('/execute', {
|
|
870
|
+
method: 'POST',
|
|
871
|
+
body: { task: 'Please say hello in one sentence: Gemini Web Agent is operational!', model: config.defaultModel },
|
|
872
|
+
timeout: (config.timeoutSec + 20) * 1000
|
|
873
|
+
})
|
|
874
|
+
if (res?.ok) {
|
|
875
|
+
setTestResult({
|
|
876
|
+
ok: true,
|
|
877
|
+
duration: res.elapsedSec ? Math.round(res.elapsedSec * 1000) : 0,
|
|
878
|
+
reply: res.output,
|
|
879
|
+
model: res.model,
|
|
880
|
+
fellBack: res.fellBack,
|
|
881
|
+
channel: res.channel,
|
|
882
|
+
})
|
|
883
|
+
} else {
|
|
884
|
+
setTestResult({ ok: false, error: res?.error || 'Task failed' })
|
|
885
|
+
}
|
|
886
|
+
} catch (err) {
|
|
887
|
+
setTestResult({ ok: false, error: err.message })
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
useEffect(() => {
|
|
892
|
+
loadData()
|
|
893
|
+
}, [])
|
|
894
|
+
|
|
895
|
+
const rootRef = useRef(null)
|
|
896
|
+
const [containerWidth, setContainerWidth] = useState(560)
|
|
897
|
+
|
|
898
|
+
useEffect(() => {
|
|
899
|
+
if (!rootRef.current) return
|
|
900
|
+
const updateWidth = () => {
|
|
901
|
+
if (rootRef.current) {
|
|
902
|
+
const w = rootRef.current.getBoundingClientRect().width
|
|
903
|
+
if (w > 0) setContainerWidth(w)
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
updateWidth()
|
|
907
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
908
|
+
const ro = new ResizeObserver((entries) => {
|
|
909
|
+
for (const entry of entries) {
|
|
910
|
+
if (entry.contentRect.width > 0) {
|
|
911
|
+
setContainerWidth(entry.contentRect.width)
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
})
|
|
915
|
+
ro.observe(rootRef.current)
|
|
916
|
+
return () => ro.disconnect()
|
|
917
|
+
}
|
|
918
|
+
}, [])
|
|
919
|
+
|
|
920
|
+
const alConnected = Boolean(status?.agentlimb?.ready || status?.dual?.agentlimb?.ready)
|
|
921
|
+
const cdpConnected = Boolean(status?.cdp?.connected || status?.dual?.cdp?.connected)
|
|
922
|
+
const isAnyConnected = alConnected || cdpConnected
|
|
923
|
+
const activeChannel = status?.activeChannel || (alConnected ? 'agentlimb' : (cdpConnected ? 'cdp' : 'none'))
|
|
924
|
+
const isUnauthed = usage?.status === 'unauthenticated' || (!usage?.geminiPlan && isAnyConnected && usage?.plan === null)
|
|
925
|
+
|
|
926
|
+
// 模型筛选函数与分类
|
|
927
|
+
const isMediaModel = (id = '', name = '') => {
|
|
928
|
+
const s = (id + ' ' + name).toLowerCase()
|
|
929
|
+
return s.includes('nano') || s.includes('banana') || s.includes('omni') || s.includes('veo') ||
|
|
930
|
+
s.includes('lyria') || s.includes('music') || s.includes('tts') || s.includes('transcribe') ||
|
|
931
|
+
s.includes('生图') || s.includes('视频') || s.includes('音乐') || s.includes('配音') || s.includes('转写')
|
|
932
|
+
}
|
|
933
|
+
const isPaidModel = (m) => {
|
|
934
|
+
if (m.paid) return true
|
|
935
|
+
const s = ((m.id || '') + ' ' + (m.name || '')).toLowerCase()
|
|
936
|
+
return s.includes('paid') || s.includes('carbon') || s.includes('antigravity-preview')
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
let textGroup = []
|
|
940
|
+
let mediaGroup = []
|
|
941
|
+
let paidGroup = []
|
|
942
|
+
|
|
943
|
+
if (availableModels.length > 0) {
|
|
944
|
+
textGroup = availableModels.filter(m => !isMediaModel(m.id, m.name) && !isPaidModel(m))
|
|
945
|
+
mediaGroup = availableModels.filter(m => isMediaModel(m.id, m.name) && !isPaidModel(m))
|
|
946
|
+
paidGroup = availableModels.filter(m => isPaidModel(m))
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
const selectableLadderModels = textGroup.length > 0 ? textGroup.map(m => ({ id: m.id, name: m.name })) : [
|
|
950
|
+
{ id: 'gemini-4-argon', name: 'Gemini 4 Argon' },
|
|
951
|
+
{ id: 'gemini-4-hydrogen', name: 'Gemini 4 Hydrogen' },
|
|
952
|
+
{ id: 'gemini-3.8-flash', name: 'Gemini 3.8 Flash' },
|
|
953
|
+
{ id: 'gemini-3.5-flash-lite', name: 'Gemini 3.5 Flash Lite' },
|
|
954
|
+
]
|
|
955
|
+
if (!selectableLadderModels.some(m => m.id === 'gemini.google.com')) {
|
|
956
|
+
selectableLadderModels.push({ id: 'gemini.google.com', name: 'gemini.google.com' })
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
return h('div', {
|
|
960
|
+
ref: rootRef,
|
|
961
|
+
className: 'gw-root',
|
|
962
|
+
style: {
|
|
963
|
+
maxHeight: isModal ? '72vh' : 'none',
|
|
964
|
+
overflowY: 'auto'
|
|
965
|
+
}
|
|
966
|
+
}, [
|
|
967
|
+
// 標題欄
|
|
968
|
+
h('div', { className: 'gw-header-split', style: { marginBottom: 14 } }, [
|
|
969
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8 } }, [
|
|
970
|
+
h('span', { style: { fontWeight: 600, fontSize: 16 } }, t('title')),
|
|
971
|
+
h('span', {
|
|
972
|
+
style: {
|
|
973
|
+
fontSize: 11,
|
|
974
|
+
padding: '1px 6px',
|
|
975
|
+
borderRadius: 4,
|
|
976
|
+
background: 'rgba(99, 102, 241, 0.15)',
|
|
977
|
+
color: '#818cf8',
|
|
978
|
+
border: '1px solid rgba(99, 102, 241, 0.3)',
|
|
979
|
+
fontWeight: 500,
|
|
980
|
+
}
|
|
981
|
+
}, 'v0.2.1'),
|
|
982
|
+
]),
|
|
983
|
+
isModal && h('button', {
|
|
984
|
+
onClick: onClose,
|
|
985
|
+
style: { background: 'none', border: 'none', cursor: 'pointer', fontSize: 18, opacity: 0.7, color: 'inherit' }
|
|
986
|
+
}, '✕')
|
|
987
|
+
]),
|
|
988
|
+
|
|
989
|
+
// 登入狀態警告
|
|
990
|
+
isUnauthed && h('div', {
|
|
991
|
+
className: 'gw-card',
|
|
992
|
+
style: { background: 'rgba(245, 158, 11, 0.1)', borderColor: 'rgba(245, 158, 11, 0.4)' }
|
|
993
|
+
}, [
|
|
994
|
+
h('div', { className: 'gw-title', style: { color: '#f59e0b' } }, t('unauthed_title')),
|
|
995
|
+
h('div', { className: 'gw-desc' }, t('unauthed_desc')),
|
|
996
|
+
h('div', { style: { marginTop: 10 } }, [
|
|
997
|
+
h('button', {
|
|
998
|
+
className: 'gw-btn',
|
|
999
|
+
style: { background: '#f59e0b', color: '#000' },
|
|
1000
|
+
onClick: () => openUrl('https://accounts.google.com')
|
|
1001
|
+
}, t('unauthed_btn'))
|
|
1002
|
+
])
|
|
1003
|
+
]),
|
|
1004
|
+
|
|
1005
|
+
// 探測異常或瀏覽器斷線報錯機制 (Probe Error Banner)
|
|
1006
|
+
probeError && h('div', {
|
|
1007
|
+
className: 'gw-card',
|
|
1008
|
+
style: {
|
|
1009
|
+
background: 'rgba(239, 68, 68, 0.1)',
|
|
1010
|
+
borderColor: 'rgba(239, 68, 68, 0.45)',
|
|
1011
|
+
marginBottom: 10
|
|
1012
|
+
}
|
|
1013
|
+
}, [
|
|
1014
|
+
h('div', { className: 'gw-title', style: { color: '#f87171', display: 'flex', alignItems: 'center', gap: 6 } }, [
|
|
1015
|
+
h('span', null, '❌'),
|
|
1016
|
+
h('span', null, t('probe_err_title'))
|
|
1017
|
+
]),
|
|
1018
|
+
h('div', { className: 'gw-desc', style: { color: '#fca5a5', lineHeight: 1.6 } }, probeError),
|
|
1019
|
+
h('div', { style: { fontSize: 11, opacity: 0.85, marginTop: 4, color: '#fecaca' } }, t('probe_err_tip')),
|
|
1020
|
+
h('div', { style: { marginTop: 10, display: 'flex', gap: 8 } }, [
|
|
1021
|
+
h('button', {
|
|
1022
|
+
className: 'gw-btn',
|
|
1023
|
+
style: { background: '#ef4444', color: '#fff' },
|
|
1024
|
+
onClick: loadData,
|
|
1025
|
+
disabled: loading
|
|
1026
|
+
}, loading ? t('probing') : t('retry_btn')),
|
|
1027
|
+
h('button', {
|
|
1028
|
+
className: 'gw-btn gw-btn-secondary',
|
|
1029
|
+
onClick: () => openUrl('https://accounts.google.com')
|
|
1030
|
+
}, t('unauthed_btn'))
|
|
1031
|
+
])
|
|
1032
|
+
]),
|
|
1033
|
+
|
|
1034
|
+
// 卡片 1: 雙通道智慧連線面板 (Dual-Channel Smart Bridge)
|
|
1035
|
+
h('div', { className: 'gw-card', style: { borderColor: alConnected ? 'rgba(16, 185, 129, 0.4)' : 'rgba(99, 102, 241, 0.3)' } }, [
|
|
1036
|
+
h('div', { className: 'gw-title gw-header-split' }, [
|
|
1037
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: 6 } }, [
|
|
1038
|
+
h('span', { className: `gw-dot ${alConnected ? 'gw-dot-ok' : (cdpConnected ? 'gw-dot-warn' : 'gw-dot-err')}` }),
|
|
1039
|
+
h('span', null, t('bridge_title')),
|
|
1040
|
+
]),
|
|
1041
|
+
h('span', {
|
|
1042
|
+
className: alConnected ? 'gw-badge' : (cdpConnected ? 'gw-badge-warn' : 'gw-badge-err'),
|
|
1043
|
+
style: alConnected ? { background: '#059669', color: '#fff' } : (cdpConnected ? { background: '#d97706', color: '#fff' } : {})
|
|
1044
|
+
}, alConnected ? t('bridge_al_preferred') : (cdpConnected ? t('bridge_cdp_mode') : t('bridge_disconnected')))
|
|
1045
|
+
]),
|
|
1046
|
+
|
|
1047
|
+
// 優先路由提示條
|
|
1048
|
+
h('div', {
|
|
1049
|
+
style: {
|
|
1050
|
+
margin: '8px 0',
|
|
1051
|
+
padding: '6px 10px',
|
|
1052
|
+
borderRadius: 6,
|
|
1053
|
+
fontSize: 11,
|
|
1054
|
+
background: alConnected ? 'rgba(16, 185, 129, 0.1)' : (cdpConnected ? 'rgba(217, 119, 6, 0.1)' : 'rgba(239, 68, 68, 0.1)'),
|
|
1055
|
+
border: alConnected ? '1px solid rgba(16, 185, 129, 0.3)' : (cdpConnected ? '1px solid rgba(217, 119, 6, 0.3)' : '1px solid rgba(239, 68, 68, 0.3)'),
|
|
1056
|
+
color: alConnected ? '#34d399' : (cdpConnected ? '#fbbf24' : '#f87171')
|
|
1057
|
+
}
|
|
1058
|
+
}, alConnected
|
|
1059
|
+
? t('route_al')
|
|
1060
|
+
: (cdpConnected ? t('route_cdp', { port: status?.cdp?.port || config.port }) : t('route_none'))),
|
|
1061
|
+
|
|
1062
|
+
// 多實例衝突提示
|
|
1063
|
+
status?.cdp?.multipleInstances && h('div', {
|
|
1064
|
+
style: {
|
|
1065
|
+
margin: '8px 0',
|
|
1066
|
+
padding: '8px 12px',
|
|
1067
|
+
borderRadius: 6,
|
|
1068
|
+
background: 'rgba(245, 158, 11, 0.12)',
|
|
1069
|
+
border: '1px solid rgba(245, 158, 11, 0.35)',
|
|
1070
|
+
color: '#fbbf24',
|
|
1071
|
+
fontSize: 11,
|
|
1072
|
+
lineHeight: 1.6
|
|
1073
|
+
}
|
|
1074
|
+
}, [
|
|
1075
|
+
h('div', { style: { fontWeight: 600, marginBottom: 2 } }, t('multi_instance_title')),
|
|
1076
|
+
h('div', null, (status?.cdp?.instances || []).map((i) => `• ${i.name} (Port: ${i.port})`).join(' | ')),
|
|
1077
|
+
h('div', { style: { opacity: 0.85, marginTop: 4 } }, t('multi_instance_tip'))
|
|
1078
|
+
]),
|
|
1079
|
+
|
|
1080
|
+
// 通道 A 與 通道 B 狀態明細網格
|
|
1081
|
+
h('div', { className: 'gw-grid-2' }, [
|
|
1082
|
+
// 通道 A: AgentLimb
|
|
1083
|
+
h('div', {
|
|
1084
|
+
style: {
|
|
1085
|
+
padding: '8px 10px',
|
|
1086
|
+
borderRadius: 6,
|
|
1087
|
+
background: alConnected ? 'rgba(16, 185, 129, 0.05)' : 'rgba(255, 255, 255, 0.03)',
|
|
1088
|
+
border: alConnected ? '1px solid rgba(16, 185, 129, 0.25)' : '1px solid rgba(255, 255, 255, 0.08)'
|
|
1089
|
+
}
|
|
1090
|
+
}, [
|
|
1091
|
+
h('div', { style: { fontWeight: 600, fontSize: 12, marginBottom: 4, display: 'flex', alignItems: 'center', gap: 4 } }, [
|
|
1092
|
+
h('span', null, alConnected ? '🟢' : '⚪'),
|
|
1093
|
+
h('span', null, t('channel_a_title'))
|
|
1094
|
+
]),
|
|
1095
|
+
h('div', { style: { fontSize: 11, opacity: 0.8, lineHeight: 1.5 } }, [
|
|
1096
|
+
h('div', null, `${t('status_prefix')}${alConnected ? t('channel_a_connected') : t('channel_a_offline')}`),
|
|
1097
|
+
h('div', null, `${t('port_prefix')}127.0.0.1:${status?.agentlimb?.port || status?.dual?.agentlimb?.port || 8765}`),
|
|
1098
|
+
alConnected && h('div', null, `${t('config_prefix')}v${status?.agentlimb?.version || status?.dual?.agentlimb?.version || '0.8.2'} (${status?.agentlimb?.activeProfile || status?.dual?.agentlimb?.activeProfile || 'Profile'})`),
|
|
1099
|
+
])
|
|
1100
|
+
]),
|
|
1101
|
+
|
|
1102
|
+
// 通道 B: Chromium CDP
|
|
1103
|
+
h('div', {
|
|
1104
|
+
style: {
|
|
1105
|
+
padding: '8px 10px',
|
|
1106
|
+
borderRadius: 6,
|
|
1107
|
+
background: cdpConnected ? 'rgba(217, 119, 6, 0.05)' : 'rgba(255, 255, 255, 0.03)',
|
|
1108
|
+
border: cdpConnected ? '1px solid rgba(217, 119, 6, 0.25)' : '1px solid rgba(255, 255, 255, 0.08)'
|
|
1109
|
+
}
|
|
1110
|
+
}, [
|
|
1111
|
+
h('div', { style: { fontWeight: 600, fontSize: 12, marginBottom: 4, display: 'flex', alignItems: 'center', gap: 4 } }, [
|
|
1112
|
+
h('span', null, cdpConnected ? '🟡' : '⚪'),
|
|
1113
|
+
h('span', null, t('channel_b_title'))
|
|
1114
|
+
]),
|
|
1115
|
+
h('div', { style: { fontSize: 11, opacity: 0.8, lineHeight: 1.5 } }, [
|
|
1116
|
+
h('div', null, `${t('status_prefix')}${cdpConnected ? t('channel_b_connected') : (alConnected ? t('channel_b_dormant') : t('channel_b_offline'))}`),
|
|
1117
|
+
h('div', null, `${t('port_prefix')}127.0.0.1:${status?.cdp?.port || status?.dual?.cdp?.port || config.port}`),
|
|
1118
|
+
cdpConnected && h('div', null, `${t('browser_prefix')}${status?.cdp?.browserType || status?.dual?.cdp?.browserType || 'Chrome'}`),
|
|
1119
|
+
])
|
|
1120
|
+
]),
|
|
1121
|
+
]),
|
|
1122
|
+
|
|
1123
|
+
// 操作按鈕列
|
|
1124
|
+
h('div', { className: 'gw-btn-row', style: { marginTop: 12 } }, [
|
|
1125
|
+
h('button', { className: 'gw-btn', onClick: loadData, disabled: loading }, loading ? t('probing') : t('probe_all_btn')),
|
|
1126
|
+
alConnected && h('button', {
|
|
1127
|
+
className: 'gw-btn',
|
|
1128
|
+
style: { background: '#059669' },
|
|
1129
|
+
onClick: runAlTest,
|
|
1130
|
+
disabled: alTestResult?.testing
|
|
1131
|
+
}, alTestResult?.testing ? t('sending') : t('test_al_btn')),
|
|
1132
|
+
h('button', {
|
|
1133
|
+
className: 'gw-btn',
|
|
1134
|
+
style: { background: '#4f46e5' },
|
|
1135
|
+
onClick: runAgentTaskTest,
|
|
1136
|
+
disabled: !isAnyConnected || testResult?.testing
|
|
1137
|
+
}, testResult?.testing ? t('executing') : t('test_agent_btn')),
|
|
1138
|
+
h('button', { className: 'gw-btn gw-btn-secondary', onClick: clearCache }, t('clear_cache_btn'))
|
|
1139
|
+
]),
|
|
1140
|
+
|
|
1141
|
+
alTestResult && h('div', {
|
|
1142
|
+
style: {
|
|
1143
|
+
marginTop: 8,
|
|
1144
|
+
padding: '6px 8px',
|
|
1145
|
+
borderRadius: 4,
|
|
1146
|
+
fontSize: 11,
|
|
1147
|
+
background: alTestResult.ok ? 'rgba(16, 185, 129, 0.1)' : 'rgba(239, 68, 68, 0.1)',
|
|
1148
|
+
color: alTestResult.ok ? '#34d399' : '#f87171'
|
|
1149
|
+
}
|
|
1150
|
+
}, [
|
|
1151
|
+
alTestResult.testing && t('al_sending_msg'),
|
|
1152
|
+
alTestResult.ok && alTestResult.message,
|
|
1153
|
+
alTestResult.error && `${t('al_failed_prefix')}${alTestResult.error}`
|
|
1154
|
+
]),
|
|
1155
|
+
|
|
1156
|
+
testResult && h('div', {
|
|
1157
|
+
style: {
|
|
1158
|
+
marginTop: 8,
|
|
1159
|
+
padding: '6px 8px',
|
|
1160
|
+
borderRadius: 4,
|
|
1161
|
+
fontSize: 11,
|
|
1162
|
+
background: testResult.ok ? 'rgba(99, 102, 241, 0.1)' : 'rgba(239, 68, 68, 0.1)',
|
|
1163
|
+
border: '1px solid rgba(99, 102, 241, 0.25)'
|
|
1164
|
+
}
|
|
1165
|
+
}, [
|
|
1166
|
+
testResult.testing && t('agent_executing_msg'),
|
|
1167
|
+
testResult.ok && h('div', null, [
|
|
1168
|
+
h('div', { style: { fontWeight: 600, color: '#818cf8', marginBottom: 2 } },
|
|
1169
|
+
t('agent_success_title', {
|
|
1170
|
+
channel: testResult.channel.toUpperCase(),
|
|
1171
|
+
model: testResult.model,
|
|
1172
|
+
duration: testResult.duration,
|
|
1173
|
+
fallback: testResult.fellBack ? t('agent_fallback_tag') : ''
|
|
1174
|
+
})),
|
|
1175
|
+
h('div', { style: { opacity: 0.9, whiteSpace: 'pre-wrap' } }, testResult.reply)
|
|
1176
|
+
]),
|
|
1177
|
+
testResult.error && h('div', { style: { color: '#f87171' } }, `${t('agent_failed_prefix')}${testResult.error}`)
|
|
1178
|
+
])
|
|
1179
|
+
]),
|
|
1180
|
+
|
|
1181
|
+
// 尚未連線時的配置與教學指引卡片
|
|
1182
|
+
!isAnyConnected && h('div', {
|
|
1183
|
+
className: 'gw-card',
|
|
1184
|
+
style: { background: 'rgba(255, 255, 255, 0.02)', borderColor: 'rgba(99, 102, 241, 0.3)' }
|
|
1185
|
+
}, [
|
|
1186
|
+
h('div', { className: 'gw-title', style: { color: '#818cf8', fontSize: 13 } }, t('guide_title')),
|
|
1187
|
+
h('div', { className: 'gw-grid-2' }, [
|
|
1188
|
+
// 方案 A
|
|
1189
|
+
h('div', { style: { padding: '10px 12px', borderRadius: 6, background: 'rgba(16, 185, 129, 0.05)', border: '1px solid rgba(16, 185, 129, 0.2)' } }, [
|
|
1190
|
+
h('div', { style: { fontWeight: 600, color: '#34d399', fontSize: 12, marginBottom: 6 } }, t('guide_a_title')),
|
|
1191
|
+
h('div', { style: { fontSize: 11, opacity: 0.85, lineHeight: 1.6 } }, [
|
|
1192
|
+
h('div', null, t('guide_a_1')),
|
|
1193
|
+
h('div', null, t('guide_a_2')),
|
|
1194
|
+
h('div', null, t('guide_a_3')),
|
|
1195
|
+
h('div', { style: { marginTop: 8 } }, [
|
|
1196
|
+
h('button', {
|
|
1197
|
+
className: 'gw-btn',
|
|
1198
|
+
style: { padding: '3px 8px', fontSize: 10, background: '#059669' },
|
|
1199
|
+
onClick: () => openUrl('https://github.com/hooosberg/AgentLimb')
|
|
1200
|
+
}, t('guide_a_btn'))
|
|
1201
|
+
])
|
|
1202
|
+
])
|
|
1203
|
+
]),
|
|
1204
|
+
// 方案 B
|
|
1205
|
+
h('div', { style: { padding: '10px 12px', borderRadius: 6, background: 'rgba(245, 158, 11, 0.05)', border: '1px solid rgba(245, 158, 11, 0.2)' } }, [
|
|
1206
|
+
h('div', { style: { fontWeight: 600, color: '#fbbf24', fontSize: 12, marginBottom: 6 } }, t('guide_b_title')),
|
|
1207
|
+
h('div', { style: { fontSize: 11, opacity: 0.85, lineHeight: 1.6 } }, [
|
|
1208
|
+
h('div', null, t('guide_b_1')),
|
|
1209
|
+
h('code', { className: 'gw-code', style: { margin: '4px 0' } }, 'chrome://inspect/#remote-debugging'),
|
|
1210
|
+
h('div', null, t('guide_b_2')),
|
|
1211
|
+
h('div', null, t('guide_b_3'))
|
|
1212
|
+
])
|
|
1213
|
+
]),
|
|
1214
|
+
])
|
|
1215
|
+
]),
|
|
1216
|
+
|
|
1217
|
+
// 卡片 2: 即時額度大盤 (3 大站點額度完全獨立)
|
|
1218
|
+
h('div', { className: 'gw-card' }, [
|
|
1219
|
+
h('div', { className: 'gw-title gw-header-split' }, [
|
|
1220
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: 6 } }, [
|
|
1221
|
+
h('span', null, t('quota_title')),
|
|
1222
|
+
loading && h('span', { style: { fontSize: 11, color: '#f59e0b', fontWeight: 400 } }, t('quota_polling_tip'))
|
|
1223
|
+
]),
|
|
1224
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: 6 } }, [
|
|
1225
|
+
h('button', {
|
|
1226
|
+
className: 'gw-btn',
|
|
1227
|
+
style: { padding: '2px 8px', fontSize: 11, background: '#10b981' },
|
|
1228
|
+
onClick: loadData,
|
|
1229
|
+
disabled: loading
|
|
1230
|
+
}, loading ? t('quota_refreshing') : t('quota_refresh_btn')),
|
|
1231
|
+
h('span', { className: 'gw-badge' }, t('quota_isolated_badge'))
|
|
1232
|
+
])
|
|
1233
|
+
]),
|
|
1234
|
+
h('div', { className: 'gw-desc', style: { display: 'flex', flexDirection: 'column', gap: 10 } }, [
|
|
1235
|
+
!isAnyConnected && h('div', {
|
|
1236
|
+
style: {
|
|
1237
|
+
padding: '6px 10px',
|
|
1238
|
+
borderRadius: 5,
|
|
1239
|
+
background: 'rgba(239, 68, 68, 0.1)',
|
|
1240
|
+
border: '1px solid rgba(239, 68, 68, 0.3)',
|
|
1241
|
+
color: '#f87171',
|
|
1242
|
+
fontSize: 11,
|
|
1243
|
+
lineHeight: 1.5,
|
|
1244
|
+
}
|
|
1245
|
+
}, t('quota_offline_warning')),
|
|
1246
|
+
// 站點 1: AI Studio
|
|
1247
|
+
h('div', { style: { padding: '8px 10px', borderRadius: 6, background: 'rgba(99, 102, 241, 0.08)', border: '1px solid rgba(99, 102, 241, 0.2)' } }, [
|
|
1248
|
+
h('div', { className: 'gw-header-split', style: { marginBottom: 4 } }, [
|
|
1249
|
+
h('span', { style: { fontWeight: 600, color: '#818cf8', whiteSpace: 'nowrap' } }, t('aistudio_title')),
|
|
1250
|
+
h('span', { className: 'gw-badge', style: { background: '#4f46e5', color: '#fff' } }, t('aistudio_badge'))
|
|
1251
|
+
]),
|
|
1252
|
+
h('div', { style: { fontSize: 11, opacity: 0.85, lineHeight: 1.5 } }, t('aistudio_desc'))
|
|
1253
|
+
]),
|
|
1254
|
+
|
|
1255
|
+
// 站點 2: Gemini 官網
|
|
1256
|
+
h('div', { style: { padding: '8px 10px', borderRadius: 6, background: 'rgba(16, 185, 129, 0.05)', border: '1px solid rgba(16, 185, 129, 0.2)' } }, [
|
|
1257
|
+
h('div', { className: 'gw-header-split', style: { marginBottom: 2 } }, [
|
|
1258
|
+
h('span', { style: { fontWeight: 600, color: '#34d399', whiteSpace: 'nowrap' } },
|
|
1259
|
+
t('gemini_title', {
|
|
1260
|
+
plan: usage?.geminiPlan
|
|
1261
|
+
? (usage.geminiPlan === 'PRO' ? t('gemini_plan_pro') : (usage.geminiPlan === 'FREE' ? t('gemini_plan_free') : usage.geminiPlan))
|
|
1262
|
+
: t('gemini_plan_default')
|
|
1263
|
+
})),
|
|
1264
|
+
h('span', { style: { fontWeight: 600, whiteSpace: 'nowrap' } }, t('gemini_used_pct', { pct: usage?.geminiUsedPct ?? 0 })),
|
|
1265
|
+
]),
|
|
1266
|
+
h('div', { className: 'gw-progress-bar' }, [
|
|
1267
|
+
h('div', { className: 'gw-progress-fill', style: { width: `${100 - (usage?.geminiUsedPct ?? 0)}%` } })
|
|
1268
|
+
]),
|
|
1269
|
+
h('div', { style: { fontSize: 11, opacity: 0.7 } }, t('gemini_reset', { time: usage?.geminiResetTime || '即時更新' })),
|
|
1270
|
+
]),
|
|
1271
|
+
|
|
1272
|
+
// 站點 3: Flow (分行優化:行 1 標題+狀態,行 2 獨立點數與免扣點特權)
|
|
1273
|
+
h('div', { style: { padding: '8px 10px', borderRadius: 6, background: 'rgba(245, 158, 11, 0.05)', border: '1px solid rgba(245, 158, 11, 0.2)' } }, [
|
|
1274
|
+
// 行 1: 標題與連通狀態徽章 (左右分開,永不擠壓換行)
|
|
1275
|
+
h('div', { className: 'gw-header-split', style: { marginBottom: 6 } }, [
|
|
1276
|
+
h('span', { style: { fontWeight: 600, color: '#fbbf24', whiteSpace: 'nowrap' } }, t('flow_title')),
|
|
1277
|
+
h('span', {
|
|
1278
|
+
className: 'gw-badge',
|
|
1279
|
+
style: (usage?.flowResetTime || (usage?.flowCredits !== undefined && usage?.flowCredits !== null))
|
|
1280
|
+
? { background: '#059669', color: '#fff' }
|
|
1281
|
+
: (isAnyConnected ? { background: 'rgba(245, 158, 11, 0.2)', color: '#f59e0b' } : { background: 'rgba(239, 68, 68, 0.2)', color: '#ef4444' })
|
|
1282
|
+
}, (usage?.flowResetTime || (usage?.flowCredits !== undefined && usage?.flowCredits !== null))
|
|
1283
|
+
? t('flow_connected_badge')
|
|
1284
|
+
: (isAnyConnected ? t('flow_pending_badge') : t('flow_offline_badge')))
|
|
1285
|
+
]),
|
|
1286
|
+
// 行 2: 獨立一行的可用點數與免扣點特權標籤 (單獨佔一行,空間充裕絕不截斷)
|
|
1287
|
+
h('div', {
|
|
1288
|
+
style: {
|
|
1289
|
+
display: 'flex',
|
|
1290
|
+
alignItems: 'center',
|
|
1291
|
+
padding: '5px 9px',
|
|
1292
|
+
borderRadius: 5,
|
|
1293
|
+
background: 'rgba(16, 185, 129, 0.08)',
|
|
1294
|
+
border: '1px solid rgba(16, 185, 129, 0.22)',
|
|
1295
|
+
marginBottom: 8
|
|
1296
|
+
}
|
|
1297
|
+
}, [
|
|
1298
|
+
h('span', { style: { fontWeight: 600, color: '#10b981', fontSize: 12, lineHeight: 1.4, whiteSpace: 'nowrap' } },
|
|
1299
|
+
t('flow_credits_unit', { credits: usage?.flowCredits !== undefined && usage?.flowCredits !== null ? usage.flowCredits : 50 }))
|
|
1300
|
+
]),
|
|
1301
|
+
// 行 3: 額度用途與重置時間詳細說明
|
|
1302
|
+
h('div', { style: { fontSize: 11, opacity: 0.85, lineHeight: 1.6 } }, [
|
|
1303
|
+
h('div', null, t('flow_desc_p1')),
|
|
1304
|
+
h('div', { style: { color: '#10b981', fontWeight: 500 } }, t('flow_desc_p2')),
|
|
1305
|
+
h('div', { style: { opacity: 0.8 } }, (() => {
|
|
1306
|
+
const resetText = usage?.flowResetTime
|
|
1307
|
+
const period = usage?.flowResetPeriod
|
|
1308
|
+
if (resetText) {
|
|
1309
|
+
const hasPrompt = /refresh|resets?|将于|將於|时间|時間|提示/i.test(resetText)
|
|
1310
|
+
const label = hasPrompt ? resetText : `${t('flow_reset_label')}${resetText}`
|
|
1311
|
+
if (period === 'daily') {
|
|
1312
|
+
return t('flow_desc_p3_daily', { text: label })
|
|
1313
|
+
}
|
|
1314
|
+
if (period === 'monthly') {
|
|
1315
|
+
return t('flow_desc_p3_monthly', { text: label })
|
|
1316
|
+
}
|
|
1317
|
+
return t('flow_desc_p3_generic', { text: label })
|
|
1318
|
+
}
|
|
1319
|
+
return t('flow_desc_p3_empty')
|
|
1320
|
+
})())
|
|
1321
|
+
])
|
|
1322
|
+
]),
|
|
1323
|
+
])
|
|
1324
|
+
]),
|
|
1325
|
+
|
|
1326
|
+
// 卡片 3: 【全自訂調度參數設定項 (Configurable Settings)】
|
|
1327
|
+
h('div', { className: 'gw-card', style: { borderColor: 'rgba(99, 102, 241, 0.4)' } }, [
|
|
1328
|
+
h('div', { className: 'gw-title', style: { color: '#818cf8' } }, t('settings_section_title')),
|
|
1329
|
+
h('div', { className: 'gw-desc', style: { display: 'flex', flexDirection: 'column', gap: 12 } }, [
|
|
1330
|
+
|
|
1331
|
+
// 設定 0: 介面語言選擇 (Language Selection: 簡體中文排第一位,無國旗)
|
|
1332
|
+
h('div', { className: 'gw-setting-row' }, [
|
|
1333
|
+
h('div', { className: 'gw-setting-info' }, [
|
|
1334
|
+
h('div', { style: { fontWeight: 500 } }, t('lang_label')),
|
|
1335
|
+
h('div', { style: { fontSize: 11, opacity: 0.6 } }, t('lang_desc'))
|
|
1336
|
+
]),
|
|
1337
|
+
h('div', { className: 'gw-setting-ctrl' }, [
|
|
1338
|
+
h('select', {
|
|
1339
|
+
className: 'gw-select',
|
|
1340
|
+
style: { minWidth: 160 },
|
|
1341
|
+
value: langChoice,
|
|
1342
|
+
onChange: (e) => {
|
|
1343
|
+
const val = e.target.value
|
|
1344
|
+
setLangChoice(val)
|
|
1345
|
+
try { localStorage.setItem('dsh_gemini_web_lang', val) } catch {}
|
|
1346
|
+
}
|
|
1347
|
+
}, [
|
|
1348
|
+
h('option', { value: 'auto' }, `${t('lang_auto')} [${activeLang}]`),
|
|
1349
|
+
h('option', { value: 'zh-CN' }, t('lang_zhcn')),
|
|
1350
|
+
h('option', { value: 'en-US' }, t('lang_en')),
|
|
1351
|
+
])
|
|
1352
|
+
])
|
|
1353
|
+
]),
|
|
1354
|
+
|
|
1355
|
+
// 設定 1: 通道模式 (Connection Mode)
|
|
1356
|
+
h('div', { className: 'gw-setting-row' }, [
|
|
1357
|
+
h('div', { className: 'gw-setting-info' }, [
|
|
1358
|
+
h('div', { style: { fontWeight: 500 } }, t('conn_strategy_title')),
|
|
1359
|
+
h('div', { style: { fontSize: 11, opacity: 0.6 } }, t('conn_strategy_desc'))
|
|
1360
|
+
]),
|
|
1361
|
+
h('div', { className: 'gw-setting-ctrl' }, [
|
|
1362
|
+
h('select', {
|
|
1363
|
+
className: 'gw-select',
|
|
1364
|
+
style: { minWidth: 160 },
|
|
1365
|
+
value: config.connectionMode || 'auto',
|
|
1366
|
+
onChange: (e) => updateConfig({ connectionMode: e.target.value })
|
|
1367
|
+
}, [
|
|
1368
|
+
h('option', { value: 'auto' }, t('conn_auto')),
|
|
1369
|
+
h('option', { value: 'agentlimb' }, t('conn_al')),
|
|
1370
|
+
h('option', { value: 'cdp' }, t('conn_cdp')),
|
|
1371
|
+
])
|
|
1372
|
+
])
|
|
1373
|
+
]),
|
|
1374
|
+
|
|
1375
|
+
// 设定 2: 预设调度模型 (Default Model) - 即选即写死永久保存
|
|
1376
|
+
h('div', { className: 'gw-setting-row' }, [
|
|
1377
|
+
h('div', { className: 'gw-setting-info' }, [
|
|
1378
|
+
h('div', { style: { fontWeight: 500, display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap' } }, [
|
|
1379
|
+
h('span', null, t('default_model_title')),
|
|
1380
|
+
h('button', {
|
|
1381
|
+
className: 'gw-btn',
|
|
1382
|
+
style: { padding: '2px 6px', fontSize: 10, background: '#4f46e5' },
|
|
1383
|
+
onClick: syncModels,
|
|
1384
|
+
disabled: syncingModels
|
|
1385
|
+
}, syncingModels ? t('syncing') : t('sync_models_btn'))
|
|
1386
|
+
]),
|
|
1387
|
+
h('div', { style: { fontSize: 11, opacity: 0.6 } },
|
|
1388
|
+
availableModels.length > 0
|
|
1389
|
+
? t('models_classified', { count: availableModels.length })
|
|
1390
|
+
: t('models_default_note'))
|
|
1391
|
+
]),
|
|
1392
|
+
h('div', { className: 'gw-setting-ctrl' }, [
|
|
1393
|
+
h('select', {
|
|
1394
|
+
className: 'gw-select',
|
|
1395
|
+
style: { width: '100%', minWidth: 170, maxWidth: 220 },
|
|
1396
|
+
value: config.defaultModel || 'gemini-3.5-flash-lite',
|
|
1397
|
+
onChange: (e) => updateConfig({ defaultModel: e.target.value })
|
|
1398
|
+
}, availableModels.length > 0 ? [
|
|
1399
|
+
h('optgroup', { label: t('group_text') },
|
|
1400
|
+
textGroup.map((m) =>
|
|
1401
|
+
h('option', { key: m.id, value: m.id }, `${m.name} ${m.new ? '🌟' : ''}`)
|
|
1402
|
+
)
|
|
1403
|
+
),
|
|
1404
|
+
mediaGroup.length > 0 && h('optgroup', { label: t('group_media') },
|
|
1405
|
+
mediaGroup.map((m) =>
|
|
1406
|
+
h('option', { key: m.id, value: m.id, disabled: true }, `🔒 ${m.name} ${t('tag_media')}`)
|
|
1407
|
+
)
|
|
1408
|
+
),
|
|
1409
|
+
paidGroup.length > 0 && h('optgroup', { label: t('group_paid') },
|
|
1410
|
+
paidGroup.map((m) =>
|
|
1411
|
+
h('option', { key: m.id, value: m.id, disabled: true }, `💰 ${m.name} ${t('tag_paid')}`)
|
|
1412
|
+
)
|
|
1413
|
+
),
|
|
1414
|
+
] : [
|
|
1415
|
+
h('optgroup', { label: t('group_text') }, [
|
|
1416
|
+
h('option', { key: 'fl', value: 'gemini-3.5-flash-lite' }, '⚡ 3.5 Flash Lite'),
|
|
1417
|
+
h('option', { key: 'f', value: 'gemini-3.8-flash' }, '🚀 3.8 Flash'),
|
|
1418
|
+
h('option', { key: 'h', value: 'gemini-4-hydrogen' }, '🧠 4 Hydrogen (1M)'),
|
|
1419
|
+
h('option', { key: 'a', value: 'gemini-4-argon' }, '🏗️ 4 Argon'),
|
|
1420
|
+
]),
|
|
1421
|
+
h('optgroup', { label: t('group_media') }, [
|
|
1422
|
+
h('option', { key: 'nano', value: 'gemini-nano-banana-2.1', disabled: true }, `🔒 Nano Banana 2.1 ${t('tag_media')}`),
|
|
1423
|
+
h('option', { key: 'omni', value: 'gemini-omni-1.2-flash', disabled: true }, `🔒 Gemini Omni 1.2 Flash ${t('tag_media')}`),
|
|
1424
|
+
h('option', { key: 'lyria', value: 'lyria-3.5', disabled: true }, `🔒 Lyria 3.5 ${t('tag_media')}`),
|
|
1425
|
+
h('option', { key: 'tts', value: 'gemini-3.8-flash-tts', disabled: true }, `🔒 3.8 Flash TTS ${t('tag_media')}`),
|
|
1426
|
+
]),
|
|
1427
|
+
h('optgroup', { label: t('group_paid') }, [
|
|
1428
|
+
h('option', { key: 'carbon', value: 'gemini-4-carbon', disabled: true }, `💰 Gemini 4 Carbon ${t('tag_paid')}`),
|
|
1429
|
+
])
|
|
1430
|
+
])
|
|
1431
|
+
])
|
|
1432
|
+
]),
|
|
1433
|
+
|
|
1434
|
+
// 設定 3: 思考閾值與降級策略 (Thinking Policy)
|
|
1435
|
+
h('div', { className: 'gw-setting-row' }, [
|
|
1436
|
+
h('div', { className: 'gw-setting-info' }, [
|
|
1437
|
+
h('div', { style: { fontWeight: 500 } }, t('thinking_policy_title')),
|
|
1438
|
+
h('div', { style: { fontSize: 11, opacity: 0.6 } },
|
|
1439
|
+
(config.thinkingPolicy === 'strict' || config.fallbackMode === 'strict')
|
|
1440
|
+
? t('thinking_policy_strict_desc')
|
|
1441
|
+
: (config.thinkingPolicy === 'custom'
|
|
1442
|
+
? t('thinking_policy_custom_desc')
|
|
1443
|
+
: t('thinking_policy_adaptive_desc')))
|
|
1444
|
+
]),
|
|
1445
|
+
h('div', { className: 'gw-setting-ctrl' }, [
|
|
1446
|
+
h('select', {
|
|
1447
|
+
className: 'gw-select',
|
|
1448
|
+
style: { minWidth: 160 },
|
|
1449
|
+
value: config.thinkingPolicy || (config.fallbackMode === 'strict' ? 'strict' : 'adaptive'),
|
|
1450
|
+
onChange: (e) => {
|
|
1451
|
+
const policy = e.target.value;
|
|
1452
|
+
updateConfig({
|
|
1453
|
+
thinkingPolicy: policy,
|
|
1454
|
+
fallbackMode: policy === 'strict' ? 'strict' : 'ladder',
|
|
1455
|
+
autoFallback: policy !== 'strict'
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
}, [
|
|
1459
|
+
h('option', { value: 'adaptive' }, t('thinking_policy_adaptive_opt')),
|
|
1460
|
+
h('option', { value: 'custom' }, t('thinking_policy_custom_opt')),
|
|
1461
|
+
h('option', { value: 'strict' }, t('thinking_policy_strict_opt')),
|
|
1462
|
+
])
|
|
1463
|
+
])
|
|
1464
|
+
]),
|
|
1465
|
+
|
|
1466
|
+
// 設定 3.1: 任務超時時間調整框(僅在自定義超時模式時顯式展開,其餘智慧與嚴格模式隱藏以防困惑)
|
|
1467
|
+
config.thinkingPolicy === 'custom' ? h('div', {
|
|
1468
|
+
className: 'gw-setting-row',
|
|
1469
|
+
style: {
|
|
1470
|
+
background: 'rgba(99, 102, 241, 0.08)',
|
|
1471
|
+
borderLeft: '3px solid #6366f1',
|
|
1472
|
+
paddingLeft: '12px',
|
|
1473
|
+
borderRadius: '4px',
|
|
1474
|
+
marginTop: '-4px',
|
|
1475
|
+
marginBottom: '4px'
|
|
1476
|
+
}
|
|
1477
|
+
}, [
|
|
1478
|
+
h('div', { className: 'gw-setting-info' }, [
|
|
1479
|
+
h('div', { style: { fontWeight: 500, display: 'flex', alignItems: 'center', gap: '6px' } }, [
|
|
1480
|
+
h('span', null, t('timeout_title')),
|
|
1481
|
+
h('span', { style: { fontSize: 10, background: '#6366f1', color: '#fff', padding: '1px 6px', borderRadius: 4 } }, t('timeout_active_badge'))
|
|
1482
|
+
]),
|
|
1483
|
+
h('div', { style: { fontSize: 11, opacity: 0.6 } }, t('timeout_custom_hint'))
|
|
1484
|
+
]),
|
|
1485
|
+
h('div', { className: 'gw-setting-ctrl', style: { display: 'flex', alignItems: 'center', gap: '6px' } }, [
|
|
1486
|
+
h('input', {
|
|
1487
|
+
type: 'number',
|
|
1488
|
+
className: 'gw-input',
|
|
1489
|
+
style: { width: 85, borderColor: '#6366f1' },
|
|
1490
|
+
value: config.timeoutSec || 180,
|
|
1491
|
+
onChange: (e) => updateConfig({ timeoutSec: parseInt(e.target.value, 10) || 180 })
|
|
1492
|
+
}),
|
|
1493
|
+
h('span', { style: { fontSize: 12, opacity: 0.7 } }, t('sec_unit'))
|
|
1494
|
+
])
|
|
1495
|
+
]) : null,
|
|
1496
|
+
|
|
1497
|
+
// 设定 3.2: 降级阶梯序列 (Fallback Ladder) — 自适应与自定义超时模式皆启用展开 (严格模式绝不降级自动隐藏)
|
|
1498
|
+
(config.thinkingPolicy !== 'strict') ? h('div', {
|
|
1499
|
+
className: 'gw-setting-row',
|
|
1500
|
+
style: {
|
|
1501
|
+
background: 'rgba(99, 102, 241, 0.08)',
|
|
1502
|
+
borderLeft: '3px solid #6366f1',
|
|
1503
|
+
padding: '12px 14px',
|
|
1504
|
+
borderRadius: '6px',
|
|
1505
|
+
marginTop: '-4px',
|
|
1506
|
+
marginBottom: '6px',
|
|
1507
|
+
display: 'flex',
|
|
1508
|
+
flexDirection: 'column',
|
|
1509
|
+
alignItems: 'stretch',
|
|
1510
|
+
gap: '10px'
|
|
1511
|
+
}
|
|
1512
|
+
}, [
|
|
1513
|
+
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', flexWrap: 'wrap', gap: '8px' } }, [
|
|
1514
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px' } }, [
|
|
1515
|
+
h('span', { style: { fontWeight: 500, fontSize: 13 } }, t('fallback_ladder_title')),
|
|
1516
|
+
h('span', {
|
|
1517
|
+
style: {
|
|
1518
|
+
fontSize: 10,
|
|
1519
|
+
background: '#6366f1',
|
|
1520
|
+
color: '#fff',
|
|
1521
|
+
padding: '1px 6px',
|
|
1522
|
+
borderRadius: 4,
|
|
1523
|
+
fontWeight: 600
|
|
1524
|
+
}
|
|
1525
|
+
}, `${(config.fallbackLadder || DEFAULT_LOCAL_CONFIG.fallbackLadder).length} / 5`)
|
|
1526
|
+
]),
|
|
1527
|
+
h('div', { style: { display: 'flex', gap: '6px' } }, [
|
|
1528
|
+
(config.fallbackLadder || DEFAULT_LOCAL_CONFIG.fallbackLadder).length < 5 && h('button', {
|
|
1529
|
+
className: 'gw-btn',
|
|
1530
|
+
style: { padding: '2px 8px', fontSize: 11, background: '#10b981', color: '#fff' },
|
|
1531
|
+
onClick: () => {
|
|
1532
|
+
const current = config.fallbackLadder || DEFAULT_LOCAL_CONFIG.fallbackLadder
|
|
1533
|
+
if (current.length < 5) {
|
|
1534
|
+
const candidate = selectableLadderModels.find(m => !current.includes(m.id))?.id || 'gemini.google.com'
|
|
1535
|
+
updateConfig({ fallbackLadder: [...current, candidate] })
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
}, t('fallback_ladder_add_btn')),
|
|
1539
|
+
h('button', {
|
|
1540
|
+
className: 'gw-btn gw-btn-secondary',
|
|
1541
|
+
style: { padding: '2px 8px', fontSize: 11 },
|
|
1542
|
+
onClick: () => {
|
|
1543
|
+
updateConfig({ fallbackLadder: [...DEFAULT_LOCAL_CONFIG.fallbackLadder] })
|
|
1544
|
+
}
|
|
1545
|
+
}, t('fallback_ladder_reset_btn')),
|
|
1546
|
+
])
|
|
1547
|
+
]),
|
|
1548
|
+
h('div', { style: { fontSize: 11, opacity: 0.65, lineHeight: 1.4 } }, t('fallback_ladder_desc')),
|
|
1549
|
+
h('div', { style: { display: 'flex', flexDirection: 'column', gap: '6px', marginTop: '2px' } },
|
|
1550
|
+
(config.fallbackLadder || DEFAULT_LOCAL_CONFIG.fallbackLadder).map((modelId, index, arr) => {
|
|
1551
|
+
return h('div', {
|
|
1552
|
+
key: index,
|
|
1553
|
+
style: {
|
|
1554
|
+
display: 'flex',
|
|
1555
|
+
alignItems: 'center',
|
|
1556
|
+
justifyContent: 'space-between',
|
|
1557
|
+
gap: '8px',
|
|
1558
|
+
background: 'rgba(0, 0, 0, 0.12)',
|
|
1559
|
+
padding: '5px 10px',
|
|
1560
|
+
borderRadius: '5px',
|
|
1561
|
+
}
|
|
1562
|
+
}, [
|
|
1563
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', fontSize: 12 } }, [
|
|
1564
|
+
h('span', { style: { opacity: 0.5, fontWeight: 700, minWidth: 24 } }, `#${index + 1}`),
|
|
1565
|
+
h('span', { style: { fontSize: 11, color: '#818cf8', fontWeight: 500 } },
|
|
1566
|
+
t('ladder_tier_label', { level: index + 1 })
|
|
1567
|
+
)
|
|
1568
|
+
]),
|
|
1569
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: '4px' } }, [
|
|
1570
|
+
h('select', {
|
|
1571
|
+
className: 'gw-select',
|
|
1572
|
+
style: { minWidth: 155, maxWidth: 195, fontSize: 12, padding: '3px 6px' },
|
|
1573
|
+
value: modelId,
|
|
1574
|
+
onChange: (e) => {
|
|
1575
|
+
const newLadder = [...(config.fallbackLadder || DEFAULT_LOCAL_CONFIG.fallbackLadder)]
|
|
1576
|
+
newLadder[index] = e.target.value
|
|
1577
|
+
updateConfig({ fallbackLadder: newLadder })
|
|
1578
|
+
}
|
|
1579
|
+
}, selectableLadderModels.map(m =>
|
|
1580
|
+
h('option', { key: m.id, value: m.id }, m.name)
|
|
1581
|
+
)),
|
|
1582
|
+
// 上移优先级按钮 ↑
|
|
1583
|
+
h('button', {
|
|
1584
|
+
className: 'gw-btn gw-btn-secondary',
|
|
1585
|
+
style: {
|
|
1586
|
+
padding: '2px 6px',
|
|
1587
|
+
fontSize: 12,
|
|
1588
|
+
lineHeight: '16px',
|
|
1589
|
+
minWidth: 24,
|
|
1590
|
+
opacity: index === 0 ? 0.3 : 1,
|
|
1591
|
+
cursor: index === 0 ? 'not-allowed' : 'pointer'
|
|
1592
|
+
},
|
|
1593
|
+
disabled: index === 0,
|
|
1594
|
+
title: t('ladder_move_up'),
|
|
1595
|
+
onClick: () => {
|
|
1596
|
+
if (index > 0) {
|
|
1597
|
+
const newLadder = [...(config.fallbackLadder || DEFAULT_LOCAL_CONFIG.fallbackLadder)]
|
|
1598
|
+
const temp = newLadder[index - 1]
|
|
1599
|
+
newLadder[index - 1] = newLadder[index]
|
|
1600
|
+
newLadder[index] = temp
|
|
1601
|
+
updateConfig({ fallbackLadder: newLadder })
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
}, '↑'),
|
|
1605
|
+
// 下移优先级按钮 ↓
|
|
1606
|
+
h('button', {
|
|
1607
|
+
className: 'gw-btn gw-btn-secondary',
|
|
1608
|
+
style: {
|
|
1609
|
+
padding: '2px 6px',
|
|
1610
|
+
fontSize: 12,
|
|
1611
|
+
lineHeight: '16px',
|
|
1612
|
+
minWidth: 24,
|
|
1613
|
+
opacity: index === arr.length - 1 ? 0.3 : 1,
|
|
1614
|
+
cursor: index === arr.length - 1 ? 'not-allowed' : 'pointer'
|
|
1615
|
+
},
|
|
1616
|
+
disabled: index === arr.length - 1,
|
|
1617
|
+
title: t('ladder_move_down'),
|
|
1618
|
+
onClick: () => {
|
|
1619
|
+
if (index < arr.length - 1) {
|
|
1620
|
+
const newLadder = [...(config.fallbackLadder || DEFAULT_LOCAL_CONFIG.fallbackLadder)]
|
|
1621
|
+
const temp = newLadder[index + 1]
|
|
1622
|
+
newLadder[index + 1] = newLadder[index]
|
|
1623
|
+
newLadder[index] = temp
|
|
1624
|
+
updateConfig({ fallbackLadder: newLadder })
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
}, '↓'),
|
|
1628
|
+
// 移除按钮 ✕
|
|
1629
|
+
h('button', {
|
|
1630
|
+
className: 'gw-btn',
|
|
1631
|
+
style: {
|
|
1632
|
+
padding: '2px 6px',
|
|
1633
|
+
fontSize: 12,
|
|
1634
|
+
lineHeight: '16px',
|
|
1635
|
+
minWidth: 24,
|
|
1636
|
+
background: 'rgba(239, 68, 68, 0.15)',
|
|
1637
|
+
color: '#ef4444',
|
|
1638
|
+
border: '1px solid rgba(239, 68, 68, 0.3)',
|
|
1639
|
+
cursor: arr.length <= 1 ? 'not-allowed' : 'pointer',
|
|
1640
|
+
opacity: arr.length <= 1 ? 0.3 : 1
|
|
1641
|
+
},
|
|
1642
|
+
disabled: arr.length <= 1,
|
|
1643
|
+
title: t('ladder_remove_tip'),
|
|
1644
|
+
onClick: () => {
|
|
1645
|
+
if (arr.length > 1) {
|
|
1646
|
+
const newLadder = (config.fallbackLadder || DEFAULT_LOCAL_CONFIG.fallbackLadder).filter((_, i) => i !== index)
|
|
1647
|
+
updateConfig({ fallbackLadder: newLadder })
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
}, '✕')
|
|
1651
|
+
])
|
|
1652
|
+
])
|
|
1653
|
+
})
|
|
1654
|
+
)
|
|
1655
|
+
]) : null,
|
|
1656
|
+
|
|
1657
|
+
// 設定 4: 思考等級 (Thinking Level)
|
|
1658
|
+
h('div', { className: 'gw-setting-row' }, [
|
|
1659
|
+
h('div', { className: 'gw-setting-info' }, [
|
|
1660
|
+
h('div', { style: { fontWeight: 500 } }, t('thinking_level_title'))
|
|
1661
|
+
]),
|
|
1662
|
+
h('div', { className: 'gw-setting-ctrl' }, [
|
|
1663
|
+
h('select', {
|
|
1664
|
+
className: 'gw-select',
|
|
1665
|
+
style: { minWidth: 160 },
|
|
1666
|
+
value: config.thinkingLevel || 'high',
|
|
1667
|
+
onChange: (e) => updateConfig({ thinkingLevel: e.target.value })
|
|
1668
|
+
}, [
|
|
1669
|
+
h('option', { value: 'high' }, t('thinking_high')),
|
|
1670
|
+
h('option', { value: 'medium' }, t('thinking_medium')),
|
|
1671
|
+
h('option', { value: 'low' }, t('thinking_low')),
|
|
1672
|
+
])
|
|
1673
|
+
])
|
|
1674
|
+
]),
|
|
1675
|
+
|
|
1676
|
+
// 設定 5: CDP 端口 (CDP Port)
|
|
1677
|
+
h('div', { className: 'gw-setting-row' }, [
|
|
1678
|
+
h('div', { className: 'gw-setting-info' }, [
|
|
1679
|
+
h('div', { style: { fontWeight: 500 } }, t('cdp_port_title'))
|
|
1680
|
+
]),
|
|
1681
|
+
h('div', { className: 'gw-setting-ctrl' }, [
|
|
1682
|
+
h('input', {
|
|
1683
|
+
type: 'number',
|
|
1684
|
+
className: 'gw-input',
|
|
1685
|
+
style: { width: 90 },
|
|
1686
|
+
value: config.port || 9222,
|
|
1687
|
+
onChange: (e) => updateConfig({ port: parseInt(e.target.value, 10) || 9222 })
|
|
1688
|
+
})
|
|
1689
|
+
])
|
|
1690
|
+
]),
|
|
1691
|
+
|
|
1692
|
+
// 儲存按鈕
|
|
1693
|
+
h('div', { className: 'gw-btn-row', style: { marginTop: 14 } }, [
|
|
1694
|
+
h('button', {
|
|
1695
|
+
className: 'gw-btn',
|
|
1696
|
+
style: { background: '#6366f1' },
|
|
1697
|
+
onClick: saveSettings,
|
|
1698
|
+
disabled: saving
|
|
1699
|
+
}, saving ? t('saving') : t('save_btn')),
|
|
1700
|
+
saveNotice && h('span', { style: { fontSize: 12, color: saveNotice.startsWith('✅') ? '#10b981' : '#ef4444' } }, saveNotice)
|
|
1701
|
+
])
|
|
1702
|
+
])
|
|
1703
|
+
]),
|
|
1704
|
+
|
|
1705
|
+
// 卡片 4: 快捷工作台
|
|
1706
|
+
h('div', { className: 'gw-card' }, [
|
|
1707
|
+
h('div', { className: 'gw-title' }, t('links_title')),
|
|
1708
|
+
h('div', { className: 'gw-btn-row', style: { marginTop: 8 } }, [
|
|
1709
|
+
h('button', { className: 'gw-btn gw-btn-secondary', onClick: () => openUrl('https://aistudio.google.com/prompts/new_chat') }, t('link_aistudio')),
|
|
1710
|
+
h('button', { className: 'gw-btn gw-btn-secondary', onClick: () => openUrl('https://flow.google.com') }, t('link_flow')),
|
|
1711
|
+
h('button', { className: 'gw-btn gw-btn-secondary', onClick: () => openUrl('https://gemini.google.com/usage') }, t('link_gemini')),
|
|
1712
|
+
h('button', { className: 'gw-btn gw-btn-secondary', onClick: () => openUrl('https://accounts.google.com') }, t('link_accounts'))
|
|
1713
|
+
])
|
|
1714
|
+
]),
|
|
1715
|
+
|
|
1716
|
+
// 卡片 5: 原作者架構原則與透明宣告 (順序優化為 Chrome / Edge / Brave 等)
|
|
1717
|
+
h('div', { className: 'gw-card', style: { background: 'rgba(255, 255, 255, 0.02)', borderColor: 'rgba(255, 255, 255, 0.05)' } }, [
|
|
1718
|
+
h('div', { className: 'gw-title', style: { fontSize: 12, opacity: 0.9 } }, t('safety_title')),
|
|
1719
|
+
h('div', { className: 'gw-desc', style: { fontSize: 11, opacity: 0.7, lineHeight: 1.6 } }, [
|
|
1720
|
+
h('div', null, t('safety_item1')),
|
|
1721
|
+
h('div', null, t('safety_item2')),
|
|
1722
|
+
h('div', null, t('safety_item3')),
|
|
1723
|
+
h('div', null, t('safety_item4'))
|
|
1724
|
+
])
|
|
1725
|
+
])
|
|
1726
|
+
])
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
const inject = ['slots', 'locale']
|
|
1730
|
+
|
|
1731
|
+
// 4. 插件注入點應用 (DSH Apply)
|
|
1732
|
+
function apply(ctx) {
|
|
1733
|
+
// 注入自定義樣式
|
|
1734
|
+
if (typeof document !== 'undefined') {
|
|
1735
|
+
const styleEl = document.createElement('style')
|
|
1736
|
+
styleEl.id = 'dsh-gemini-web-styles'
|
|
1737
|
+
styleEl.textContent = STYLES
|
|
1738
|
+
document.head.appendChild(styleEl)
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
// 註冊多語言字典至 DSH ctx.locale (若支援)
|
|
1742
|
+
ctx.effect(() => {
|
|
1743
|
+
try {
|
|
1744
|
+
if (ctx.locale && typeof ctx.locale.register === 'function') {
|
|
1745
|
+
return ctx.locale.register(NS, {
|
|
1746
|
+
'zh-CN': I18N['zh-CN'],
|
|
1747
|
+
'zh-TW': I18N['zh-CN'],
|
|
1748
|
+
'zh': I18N['zh-CN'],
|
|
1749
|
+
'en': I18N['en-US'],
|
|
1750
|
+
'en-US': I18N['en-US']
|
|
1751
|
+
})
|
|
1752
|
+
}
|
|
1753
|
+
} catch (e) {
|
|
1754
|
+
return () => {}
|
|
1755
|
+
}
|
|
1756
|
+
}, 'gemini-web: locale dictionaries')
|
|
1757
|
+
|
|
1758
|
+
// 註冊設定主面板 (Settings 介面)
|
|
1759
|
+
ctx.effect(() => {
|
|
1760
|
+
try {
|
|
1761
|
+
return ctx.slots.inject('settings.section', () => {
|
|
1762
|
+
return ctx.slots.register({
|
|
1763
|
+
name: 'settings.section',
|
|
1764
|
+
id: 'gemini-web-settings',
|
|
1765
|
+
order: 38,
|
|
1766
|
+
label: () => {
|
|
1767
|
+
const lang = resolveDshLanguage()
|
|
1768
|
+
return (I18N[lang] || I18N['zh-CN']).nav_label
|
|
1769
|
+
},
|
|
1770
|
+
locale: NS,
|
|
1771
|
+
}, () => h(SettingsPanel, { isModal: false }))
|
|
1772
|
+
})
|
|
1773
|
+
} catch (e) {
|
|
1774
|
+
console.warn('[dsh-gemini-web] slots.inject settings.section failed:', e)
|
|
1775
|
+
return () => {}
|
|
1776
|
+
}
|
|
1777
|
+
}, 'gemini-web: settings section')
|
|
1778
|
+
|
|
1779
|
+
// 註冊外掛卡片配置面板 (Plugins 頁面卡片)
|
|
1780
|
+
ctx.effect(() => {
|
|
1781
|
+
try {
|
|
1782
|
+
return ctx.slots.inject('plugins.bundle.config', () => {
|
|
1783
|
+
return ctx.slots.register({
|
|
1784
|
+
name: 'plugins.bundle.config',
|
|
1785
|
+
key: PKG,
|
|
1786
|
+
locale: NS,
|
|
1787
|
+
}, (ownerProps) => {
|
|
1788
|
+
const lang = resolveDshLanguage()
|
|
1789
|
+
const title = (I18N[lang] || I18N['zh-CN']).nav_label
|
|
1790
|
+
return ownerProps?.view === 'summary' ? title : h(SettingsPanel, { isModal: false })
|
|
1791
|
+
})
|
|
1792
|
+
})
|
|
1793
|
+
} catch (e) {
|
|
1794
|
+
return () => {}
|
|
1795
|
+
}
|
|
1796
|
+
}, 'gemini-web: plugins config')
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
exports.apply = apply
|
|
1800
|
+
exports.inject = inject
|
|
1801
|
+
exports.name = PKG
|
|
1802
|
+
exports.default = { apply, inject, name: PKG }
|
|
1803
|
+
return module.exports
|
|
1804
|
+
}
|
|
1805
|
+
})
|