dsh-volcengine-provider 0.2.6 → 0.2.7
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 +3 -1
- package/docs/changelog.md +4 -0
- package/docs/client-settings-preview-dark.png +0 -0
- package/docs/client-settings-preview-mobile-dark.png +0 -0
- package/docs/client-settings-preview.png +0 -0
- package/docs/usage.md +1 -1
- package/docs/validation.md +6 -1
- package/lib/browser-bridge/win32/rundll32.exe +0 -0
- package/lib/client.js +130 -111
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,7 +33,9 @@ dsh plugin --profile web add dsh-volcengine-provider
|
|
|
33
33
|
|
|
34
34
|
## 功能介绍
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
套餐区集中显示额度、重置时间和模型入口;已有账号时可在下方展开账号管理。
|
|
37
|
+
|
|
38
|
+
<img src="docs/client-settings-preview.png" width="1000" alt="火山方舟 Provider 的套餐额度与账号管理">
|
|
37
39
|
|
|
38
40
|
<sub>真实组件离线预览,使用受控 DSW 主题令牌,账号与额度均为示例数据。另见<a href="docs/client-settings-preview-dark.png">深色预览</a>与<a href="docs/client-settings-preview-mobile-dark.png">390px 窄屏预览</a>。</sub>
|
|
39
41
|
|
package/docs/changelog.md
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/docs/usage.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
| 网页登录 | 希望通过官方账号接入 | 隔离 ArkCli profile 的默认 Key | 同一隔离 CLI 身份 |
|
|
10
10
|
| 凭据引用 | 宿主已有对应 Key / IAM 凭据 | 两套套餐各自的 API Key 引用 | IAM AK/SK 引用 |
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
两套套餐独立选择账号。套餐区集中显示额度和模型入口;已有账号时,展开下方的 **账号与登录** 可管理账号。OAuth 绑定后,不会因为某套套餐缺失就悄悄退回另一个身份或凭据池。
|
|
13
13
|
|
|
14
14
|
## 网页登录
|
|
15
15
|
|
package/docs/validation.md
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
- ArkCli **1.0.37** 的命令帮助、随包官方 Skills、raw action 注册及无网络预览。
|
|
7
7
|
- 单元业务测试使用假凭据、假 CLI 与外部网络替身;真实本地桥 IPC、原生进程和独立账号 OAuth 验收另列,均使用临时目录。
|
|
8
8
|
|
|
9
|
+
## 0.2.7 设置页额度展示调整
|
|
10
|
+
|
|
11
|
+
- 使用真实 React/Chrome 与假 RPC 数据离线验证账号、模型操作、额度分组及实时倒计时;覆盖深浅色、390px 视口、768px 视口及宽窗口中的 390px 内容栏。
|
|
12
|
+
- 对比度检查覆盖深浅色与两种主题令牌配置;补充每套餐独立时钟、重置时间变化后清理旧时钟和到期状态测试。未在运行中的 DSH 页面或真实额度接口复验。
|
|
13
|
+
|
|
9
14
|
## 0.2.6 紧凑设置页与额度倒计时
|
|
10
15
|
|
|
11
16
|
- 账号管理默认收起,双套餐随可用宽度并列或堆叠;真实 React/Chrome 离线测试覆盖交互、深浅色、390px 和额度分组,使用假 RPC 数据。
|
|
@@ -43,7 +48,7 @@ node --test test/*.test.mjs
|
|
|
43
48
|
- HMAC 签名测试使用独立 OpenSSL 推导的固定向量,不只比较实现自身的两次输出。
|
|
44
49
|
- 构建生成 Host 模块与返回导出对象的惰性 Client 工厂;不新增安装构建依赖。
|
|
45
50
|
|
|
46
|
-
当前结果:**
|
|
51
|
+
当前结果:**327 项 JavaScript 测试、10 项 Python 归档测试通过**,49 个 JavaScript 源文件语法/边界检查通过,构建包含 18 个模块/Client 产物及 3 个浏览器桥辅助文件。模型管理测试覆盖旧状态迁移、套餐/模型开关、逐模型参数、请求默认值及适配器生命周期;发布测试覆盖 OIDC 身份、版本与渠道、归档校验、registry 错误分类及发布后完整性检查。
|
|
47
52
|
|
|
48
53
|
### 实际 Core 隔离加载
|
|
49
54
|
|
|
Binary file
|
package/lib/client.js
CHANGED
|
@@ -190,41 +190,41 @@ const LOGIN_POLL_MS = 1000;
|
|
|
190
190
|
// ── 主题样式(只用设计令牌与继承,兼容深浅色) ───────────────────────────────
|
|
191
191
|
|
|
192
192
|
const style = {
|
|
193
|
-
root: { display: 'flex', flexDirection: 'column', gap:
|
|
194
|
-
title: { margin: 0, fontSize:
|
|
193
|
+
root: { display: 'flex', flexDirection: 'column', gap: 12 },
|
|
194
|
+
title: { margin: 0, fontSize: 18, fontWeight: 650, lineHeight: 1.35, letterSpacing: '-.015em' },
|
|
195
195
|
card: {
|
|
196
|
-
|
|
197
|
-
border: '1px solid var(--dsw-alias-border-
|
|
198
|
-
borderRadius:
|
|
196
|
+
minWidth: 0,
|
|
197
|
+
border: '1px solid var(--dsw-alias-border-l3, var(--dsw-alias-border-l2, rgba(128,128,128,.24)))',
|
|
198
|
+
borderRadius: 12,
|
|
199
199
|
background: 'var(--dsw-alias-bg-layer-1, rgba(128,128,128,.025))'
|
|
200
200
|
},
|
|
201
201
|
cardTitle: { margin: 0, fontSize: 15, lineHeight: 1.4, fontWeight: 650 },
|
|
202
202
|
row: { display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap', minWidth: 0 },
|
|
203
|
-
field: { display: 'flex', flexDirection: 'column', gap:
|
|
203
|
+
field: { display: 'flex', flexDirection: 'column', gap: 5, flex: '1 1 180px', minWidth: 0 },
|
|
204
204
|
label: { fontSize: 12, lineHeight: 1.5, color: 'var(--dsw-alias-label-secondary, inherit)' },
|
|
205
205
|
input: {
|
|
206
|
-
width: '100%', minWidth: 0, minHeight:
|
|
207
|
-
borderRadius:
|
|
206
|
+
width: '100%', minWidth: 0, minHeight: 32, boxSizing: 'border-box', padding: '6px 9px',
|
|
207
|
+
borderRadius: 7, fontSize: 12,
|
|
208
208
|
border: '1px solid var(--dsw-alias-border-l3, var(--dsw-alias-border-l2, rgba(128,128,128,.35)))',
|
|
209
209
|
background: 'var(--dsw-alias-bg-layer-2, Canvas)', color: 'inherit', font: 'inherit'
|
|
210
210
|
},
|
|
211
211
|
btn: {
|
|
212
|
-
display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minHeight:
|
|
213
|
-
padding: '
|
|
212
|
+
display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minHeight: 32,
|
|
213
|
+
padding: '6px 10px', borderRadius: 7, fontSize: 12,
|
|
214
214
|
border: '1px solid var(--dsw-alias-border-l3, var(--dsw-alias-border-l2, rgba(128,128,128,.3)))',
|
|
215
215
|
background: 'var(--dsw-alias-bg-layer-2, rgba(128,128,128,.06))', color: 'inherit', cursor: 'pointer', font: 'inherit'
|
|
216
216
|
},
|
|
217
217
|
primary: {
|
|
218
|
-
display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minHeight:
|
|
219
|
-
padding: '
|
|
218
|
+
display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minHeight: 32,
|
|
219
|
+
padding: '6px 10px', borderRadius: 7, fontSize: 12, fontWeight: 600,
|
|
220
220
|
border: '1px solid var(--dsw-alias-brand-primary, #2563eb)',
|
|
221
221
|
background: 'var(--dsw-alias-button-primary-fill, var(--dsw-alias-brand-primary, #2563eb))',
|
|
222
222
|
color: 'var(--dsw-alias-label-primary-foreground, #fff)',
|
|
223
223
|
cursor: 'pointer', font: 'inherit'
|
|
224
224
|
},
|
|
225
225
|
danger: {
|
|
226
|
-
display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minHeight:
|
|
227
|
-
padding: '
|
|
226
|
+
display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minHeight: 32,
|
|
227
|
+
padding: '6px 10px', borderRadius: 7, fontSize: 12,
|
|
228
228
|
border: '1px solid var(--dsw-alias-state-error-primary, rgba(220,38,38,.55))',
|
|
229
229
|
background: 'transparent', color: 'var(--dsw-alias-label-primary, inherit)',
|
|
230
230
|
cursor: 'pointer', font: 'inherit'
|
|
@@ -235,8 +235,7 @@ const style = {
|
|
|
235
235
|
success: { margin: 0, fontSize: 12, lineHeight: 1.6, fontWeight: 600, color: 'var(--dsw-alias-label-primary, inherit)', overflowWrap: 'anywhere' },
|
|
236
236
|
chip: {
|
|
237
237
|
display: 'inline-flex', alignItems: 'center', maxWidth: '100%', fontSize: 11, lineHeight: 1.6,
|
|
238
|
-
padding: '1px 8px', borderRadius: 999, whiteSpace: '
|
|
239
|
-
border: '1px solid var(--dsw-alias-border-l3, rgba(128,128,128,.18))',
|
|
238
|
+
padding: '1px 8px', borderRadius: 999, whiteSpace: 'nowrap', overflowWrap: 'anywhere',
|
|
240
239
|
color: 'var(--dsw-alias-label-secondary, inherit)',
|
|
241
240
|
background: 'var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,.08))'
|
|
242
241
|
},
|
|
@@ -244,25 +243,27 @@ const style = {
|
|
|
244
243
|
display: 'flex', flexDirection: 'column', gap: 10, minWidth: 0, padding: '12px',
|
|
245
244
|
borderRadius: 10, background: 'var(--dsw-alias-bg-layer-2, rgba(128,128,128,.04))'
|
|
246
245
|
},
|
|
247
|
-
summary: { cursor: 'pointer', minHeight:
|
|
246
|
+
summary: { cursor: 'pointer', minHeight: 30, padding: '5px 0', fontSize: 12, color: 'var(--dsw-alias-label-secondary, inherit)' }
|
|
248
247
|
};
|
|
249
248
|
|
|
250
249
|
// Scoped CSS supplies interaction states and responsive grids which inline styles cannot express.
|
|
251
250
|
const CLIENT_STYLES = `
|
|
252
|
-
.vcp-settings{color:var(--dsw-alias-label-primary,inherit);color-scheme:light;max-width:
|
|
251
|
+
.vcp-settings{color:var(--dsw-alias-label-primary,inherit);color-scheme:light;max-width:960px;padding:6px 2px 24px;font-size:13px;line-height:1.5;container-type:inline-size;container-name:vcp}
|
|
253
252
|
body[data-ds-dark-theme] .vcp-settings{color-scheme:dark}
|
|
254
253
|
.vcp-settings *{box-sizing:border-box}.vcp-settings :focus-visible{outline:2px solid var(--dsw-alias-brand-primary,Highlight);outline-offset:3px}.vcp-settings input::placeholder,.vcp-settings textarea::placeholder{color:var(--dsw-alias-label-secondary,GrayText);opacity:1}.vcp-card{padding:12px 14px}
|
|
255
|
-
.vcp-content{display:flex;flex-direction:column;gap:
|
|
256
|
-
.vcp-
|
|
257
|
-
.vcp-
|
|
254
|
+
.vcp-content{display:flex;flex-direction:column;gap:14px}.vcp-content[data-empty=true] .vcp-account-panel{order:-1}.vcp-plan-workspace{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:1px;padding:0;overflow:hidden;background:var(--dsw-alias-border-l4,rgba(128,128,128,.16));align-items:start}.vcp-plan{display:flex;flex-direction:column;gap:12px;min-width:0;padding:16px;background:var(--dsw-alias-bg-layer-1,Canvas)}.vcp-plan-setup{display:flex;align-items:end;gap:10px;flex-wrap:wrap}.vcp-plan-toggle{display:flex;align-items:center;gap:7px;min-height:32px;white-space:nowrap;font-size:12px;font-weight:600}.vcp-plan-account{flex:1 1 170px}.vcp-plan-note{flex-basis:100%}
|
|
255
|
+
.vcp-account-body{display:flex;flex-direction:column;gap:12px;padding:12px 0 0}.vcp-accounts-disclosure>summary{display:flex;align-items:center;gap:10px;min-height:32px;cursor:pointer;list-style:none}.vcp-accounts-disclosure>summary::-webkit-details-marker{display:none}.vcp-accounts-disclosure>summary::after{content:'›';margin-left:auto;font-size:18px;line-height:1;transform:rotate(90deg)}.vcp-accounts-disclosure[open]>summary::after{transform:rotate(-90deg)}.vcp-accounts-disclosure[open]>summary{border-bottom:1px solid var(--dsw-alias-border-l4,rgba(128,128,128,.14));padding-bottom:10px}
|
|
256
|
+
.vcp-header{display:flex;align-items:center;gap:12px;padding:0 2px 2px}.vcp-header-copy{flex:1;min-width:0}.vcp-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.vcp-heading-copy{flex:1 1 180px;min-width:0}.vcp-heading-copy p{margin-top:4px}.vcp-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap;min-width:0}
|
|
258
257
|
.vcp-select{width:100%;min-width:0;max-width:100%;flex:none}.vcp-settings select option{color:var(--dsw-alias-label-primary,CanvasText);background:var(--dsw-alias-bg-layer-1,Canvas)}.vcp-settings select option:disabled{color:var(--dsw-alias-label-secondary,GrayText)}.vcp-chip-row{display:flex;gap:6px;flex-wrap:wrap;min-width:0}.vcp-section{border-top:1px solid var(--dsw-alias-border-l4,rgba(128,128,128,.14));padding-top:10px;display:flex;flex-direction:column;gap:6px;min-width:0}
|
|
259
|
-
.vcp-notice{display:flex;align-items:center;gap:
|
|
260
|
-
.vcp-account{padding:
|
|
261
|
-
.vcp-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:
|
|
262
|
-
.vcp-details>summary{cursor:pointer}.vcp-details-body{display:flex;flex-direction:column;gap:
|
|
258
|
+
.vcp-notice{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:10px 12px;border-radius:9px;border:1px solid var(--dsw-alias-border-l4,rgba(128,128,128,.18));border-left:3px solid var(--dsw-alias-border-l3,rgba(128,128,128,.4));background:var(--dsw-alias-bg-layer-2,Canvas);overflow-wrap:anywhere}.vcp-notice>p{flex:1 1 180px;min-width:0}.vcp-notice-icon{display:inline-flex;align-items:center;justify-content:center;flex:none;width:22px;height:22px;border-radius:50%;background:var(--dsw-alias-label-secondary,#94a3b8);color:var(--dsw-alias-bg-layer-1,#fff);font-size:13px;font-weight:750;line-height:1}.vcp-notice[data-tone=error]{border-left-color:var(--dsw-alias-state-error-primary,#dc2626)}.vcp-notice[data-tone=warn]{border-left-color:var(--dsw-alias-state-warn-primary,#b45309)}.vcp-notice[data-tone=success]{border-left-color:var(--dsw-alias-state-success-primary,#16a34a)}.vcp-notice[data-tone=error] .vcp-notice-icon{background:var(--dsw-alias-state-error-primary,#dc2626)}.vcp-notice[data-tone=warn] .vcp-notice-icon{background:var(--dsw-alias-state-warn-primary,#b45309)}.vcp-notice[data-tone=success] .vcp-notice-icon{background:var(--dsw-alias-state-success-primary,#16a34a)}
|
|
259
|
+
.vcp-account{display:flex;flex-direction:column;gap:8px;min-width:0;padding:14px 0;border-top:1px solid var(--dsw-alias-border-l4,rgba(128,128,128,.14))}.vcp-account:first-child{padding-top:0;border-top:0}.vcp-account-title{font-size:13px;font-weight:650;overflow-wrap:anywhere}.vcp-model-list{display:flex;flex-direction:column;margin-top:6px}.vcp-model{display:flex;flex-direction:column;gap:7px;min-width:0;padding:12px 0;border-top:1px solid var(--dsw-alias-border-l4,rgba(128,128,128,.14))}.vcp-model:first-child{border-top:0}.vcp-model-name{font-weight:600;min-width:0;overflow-wrap:anywhere}.vcp-model-id{font-family:ui-monospace,'Cascadia Mono',Consolas,monospace;font-size:11px}
|
|
260
|
+
.vcp-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.vcp-fields-three{grid-template-columns:repeat(3,minmax(0,1fr))}.vcp-quota-section{display:flex;flex-direction:column;gap:8px;min-width:0}.vcp-quota{display:grid;gap:10px}.vcp-quota-group{display:grid;gap:7px}.vcp-quota-group+.vcp-quota-group{margin-top:3px}.vcp-quota-group-title{font-size:12px;font-weight:600;color:var(--dsw-alias-label-secondary,inherit)}.vcp-quota-window{display:grid;gap:7px;min-width:0;padding:10px 11px;border-radius:9px;background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.07))}.vcp-quota-window[data-tone=error]{background:var(--dsw-alias-state-error-bg,rgba(220,38,38,.08))}.vcp-quota-window[data-tone=warn]{background:var(--dsw-alias-state-warn-bg,rgba(180,83,9,.08))}.vcp-quota-line{display:flex;align-items:center;gap:7px;min-width:0}.vcp-quota-name{font-size:12px;font-weight:600}.vcp-quota-value{display:flex;align-items:baseline;gap:4px;margin-left:auto;text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}.vcp-quota-percent{font-size:20px;line-height:1.05;font-weight:700;letter-spacing:-.025em;color:var(--dsw-alias-label-primary,inherit)}.vcp-quota-percent small{font-size:12px;font-weight:600}.vcp-quota-remaining{font-size:12px;color:var(--dsw-alias-label-secondary,inherit)}.vcp-quota-track{width:100%;height:8px;border-radius:99px;overflow:hidden;background:var(--dsw-alias-interactive-bg-active,rgba(128,128,128,.2))}.vcp-quota-fill{height:100%;border-radius:99px;background:var(--dsw-alias-brand-primary,#3b82f6)}.vcp-quota-window[data-tone=error] .vcp-quota-fill{background:var(--dsw-alias-state-error-primary,#dc2626)}.vcp-quota-window[data-tone=warn] .vcp-quota-fill{background:var(--dsw-alias-state-warn-primary,#b45309)}.vcp-quota-meta{display:grid;gap:2px;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-secondary,inherit);overflow-wrap:anywhere}.vcp-quota-reset{display:flex;justify-content:space-between;gap:2px 10px;flex-wrap:wrap;font-size:11px;line-height:1.5;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-secondary,inherit)}.vcp-status-chip{display:inline-flex;align-items:center;gap:5px;padding:1px 7px;border-radius:99px;font-size:10.5px;line-height:1.5;white-space:nowrap;background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.09))}.vcp-status-chip::before{content:'';width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-label-secondary,#94a3b8)}.vcp-status-chip[data-tone=warn]{background:var(--dsw-alias-state-warn-bg,rgba(180,83,9,.1))}.vcp-status-chip[data-tone=warn]::before{background:var(--dsw-alias-state-warn-primary,#b45309)}.vcp-status-chip[data-tone=error]{background:var(--dsw-alias-state-error-bg,rgba(220,38,38,.1))}.vcp-status-chip[data-tone=error]::before{background:var(--dsw-alias-state-error-primary,#dc2626)}.vcp-status-chip[data-tone=success]::before{background:var(--dsw-alias-state-success-primary,#16a34a)}
|
|
261
|
+
.vcp-details>summary{cursor:pointer}.vcp-details-body{display:flex;flex-direction:column;gap:7px;margin-top:6px;padding-top:10px;border-top:1px solid var(--dsw-alias-border-l4,rgba(128,128,128,.14))}.vcp-model-meta{display:flex;flex-direction:column;gap:4px}.vcp-editor,.vcp-confirm,.vcp-login-status{display:flex;flex-direction:column;gap:8px;padding:12px 0;border-top:1px solid var(--dsw-alias-border-l4,rgba(128,128,128,.16))}.vcp-confirm,.vcp-login-status{padding:10px 12px;border:1px solid var(--dsw-alias-border-l4,rgba(128,128,128,.18));border-left:3px solid var(--dsw-alias-state-warn-primary,#b45309);border-radius:8px;background:var(--dsw-alias-bg-layer-2,rgba(128,128,128,.04))}.vcp-empty{display:flex;flex-direction:column;gap:9px}
|
|
263
262
|
.vcp-button:hover:not(:disabled){box-shadow:0 0 0 1px var(--dsw-alias-brand-primary,Highlight)}.vcp-button:disabled{opacity:.55;cursor:not-allowed}.vcp-settings summary:hover{color:var(--dsw-alias-label-primary,inherit)}
|
|
264
|
-
@media(max-width:680px){.vcp-fields,.vcp-fields-three{grid-template-columns:1fr}.vcp-
|
|
265
|
-
@media(max-width:420px){.vcp-settings{padding:2px 0 20px}.vcp-card{padding:12px}.vcp-header{flex-wrap:wrap}.vcp-header>.vcp-actions{width:100%;justify-content:space-between}.vcp-heading{gap:8px}.vcp-heading>.vcp-actions{width:100%}.vcp-actions .vcp-button{flex:1 1 auto}.vcp-account
|
|
263
|
+
@media(max-width:680px){.vcp-fields,.vcp-fields-three{grid-template-columns:1fr}.vcp-select{width:100%;min-width:0}}
|
|
264
|
+
@media(max-width:420px){.vcp-settings{padding:2px 0 20px}.vcp-card{padding:12px}.vcp-plan-workspace{padding:0}.vcp-plan{padding:12px}.vcp-header{flex-wrap:wrap}.vcp-header>.vcp-actions{width:100%;justify-content:space-between}.vcp-heading{gap:8px}.vcp-heading>.vcp-actions{width:100%}.vcp-actions .vcp-button{flex:1 1 auto}.vcp-account-body{padding:12px 0 0}.vcp-section{padding-top:12px}.vcp-quota-reset{flex-direction:column}.vcp-plan-account{flex-basis:100%}}
|
|
265
|
+
@container vcp (max-width:680px){.vcp-fields,.vcp-fields-three{grid-template-columns:1fr}}
|
|
266
|
+
@container vcp (max-width:420px){.vcp-settings{padding:2px 0 20px}.vcp-plan{padding:12px}.vcp-header{flex-wrap:wrap}.vcp-header>.vcp-actions{width:100%;justify-content:space-between}.vcp-heading>.vcp-actions{width:100%}.vcp-actions .vcp-button{flex:1 1 auto}.vcp-account-body{padding:12px 0 0}.vcp-quota-reset{flex-direction:column}.vcp-plan-account{flex-basis:100%}}
|
|
266
267
|
`;
|
|
267
268
|
|
|
268
269
|
function installStyles() {
|
|
@@ -290,9 +291,15 @@ function SectionHeading({ eyebrow, title, description, action }) {
|
|
|
290
291
|
action ?? null);
|
|
291
292
|
}
|
|
292
293
|
|
|
293
|
-
function Notice({ tone = 'muted', role, children }) {
|
|
294
|
+
function Notice({ tone = 'muted', role, children, action }) {
|
|
294
295
|
return h('div', { className: 'vcp-notice', 'data-tone': tone },
|
|
295
|
-
h('
|
|
296
|
+
h('span', { className: 'vcp-notice-icon', 'aria-hidden': 'true' }, ({ error: '×', warn: '!', success: '✓', muted: '…' })[tone] || 'i'),
|
|
297
|
+
h('p', { role, style: style[tone] || style.muted }, children),
|
|
298
|
+
action ?? null);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function StatusChip({ tone = 'muted', children }) {
|
|
302
|
+
return h('span', { className: 'vcp-status-chip', 'data-tone': tone }, children);
|
|
296
303
|
}
|
|
297
304
|
|
|
298
305
|
// ── 纯函数小工具 ─────────────────────────────────────────────────────────────
|
|
@@ -865,10 +872,10 @@ function QuotaWindows({ quota }) {
|
|
|
865
872
|
// 先显示后端给的原因,再补一条网页登录的出路。
|
|
866
873
|
const detail = quota.error ? describeError(quota.error) : '该账号暂无可用的额度鉴权凭据。';
|
|
867
874
|
const hint = /登录/.test(detail) ? '' : ' 可用该账号的「网页登录」完成 OAuth 绑定后重试。';
|
|
868
|
-
return h(
|
|
875
|
+
return h(Notice, { tone: 'warn' }, `额度查询不可用:${detail}${hint}`);
|
|
869
876
|
}
|
|
870
877
|
if (quota.state === 'error') {
|
|
871
|
-
return h(
|
|
878
|
+
return h(Notice, { tone: 'error', role: 'alert' }, `额度查询失败:${describeError(quota.error)}`);
|
|
872
879
|
}
|
|
873
880
|
const windows = Array.isArray(quota.windows) ? quota.windows : [];
|
|
874
881
|
if (!windows.length) return h('p', { style: style.muted }, '该账号没有可展示的额度窗口(可能未订阅此套餐)。');
|
|
@@ -884,21 +891,38 @@ function QuotaWindows({ quota }) {
|
|
|
884
891
|
}
|
|
885
892
|
return h('div', { className: 'vcp-quota' },
|
|
886
893
|
groups.map((group, index) => h('section', { key: group.key || `g${index}`, className: 'vcp-quota-group', 'aria-label': group.label || '额度窗口' },
|
|
887
|
-
group.label ? h('div', {
|
|
894
|
+
group.label ? h('div', { className: 'vcp-quota-group-title' }, group.label) : null,
|
|
888
895
|
group.windows.map((item, position) => {
|
|
889
896
|
const summary = windowSummary(item);
|
|
890
897
|
const percent = finiteQuotaNumber(item?.percent);
|
|
898
|
+
const remaining = percent === null ? null : Math.max(0, Math.min(100, 100 - percent));
|
|
899
|
+
const resetTime = resetEpoch(item?.resetsAt);
|
|
900
|
+
const resetPassed = resetTime !== null && resetTime <= now;
|
|
891
901
|
const label = WINDOW_KIND_LABELS[item?.kind] ?? item?.kind ?? '窗口';
|
|
892
|
-
|
|
902
|
+
const detail = item?.detail;
|
|
903
|
+
const usageParts = [
|
|
904
|
+
detail && finiteQuotaNumber(detail.used) !== null && finiteQuotaNumber(detail.limit) !== null
|
|
905
|
+
? `已用 ${detail.used} / ${detail.limit} ${detail.unit ?? ''}`.trim() : null,
|
|
906
|
+
detail?.scope ? `范围 ${detail.scope}` : null,
|
|
907
|
+
typeof detail?.note === 'string' && detail.note ? detail.note : null
|
|
908
|
+
].filter(Boolean);
|
|
909
|
+
return h('div', { key: `${item?.kind ?? 'w'}-${position}`, className: 'vcp-quota-window', 'data-tone': summary.tone },
|
|
893
910
|
h('div', { className: 'vcp-quota-line' },
|
|
894
|
-
h('span', {
|
|
895
|
-
h(
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
911
|
+
h('span', { className: 'vcp-quota-name' }, label),
|
|
912
|
+
summary.tone !== 'muted' ? h(StatusChip, { tone: summary.tone }, resetPassed ? '待刷新' : summary.tone === 'error' ? '已用尽' : '余量不足') : null,
|
|
913
|
+
h('span', { className: 'vcp-quota-value' }, remaining === null
|
|
914
|
+
? h('span', { style: style.muted }, '百分比未提供')
|
|
915
|
+
: [
|
|
916
|
+
h('strong', { key: 'value', className: 'vcp-quota-percent' }, formatPercent(remaining), h('small', null, '%')),
|
|
917
|
+
h('span', { key: 'label', className: 'vcp-quota-remaining' }, '剩余')
|
|
918
|
+
])),
|
|
919
|
+
remaining !== null ? h('div', {
|
|
920
|
+
className: 'vcp-quota-track', role: 'progressbar',
|
|
921
|
+
'aria-valuemin': 0, 'aria-valuemax': 100, 'aria-valuenow': remaining,
|
|
922
|
+
'aria-label': `${label}剩余额度`, 'aria-valuetext': `剩余 ${formatPercent(remaining)}%`
|
|
923
|
+
}, h('div', { className: 'vcp-quota-fill', style: { width: `${remaining}%`, minWidth: remaining > 0 ? 4 : 0 } })) : null,
|
|
924
|
+
usageParts.length ? h('div', { className: 'vcp-quota-meta' }, usageParts.join(' · ')) : null,
|
|
925
|
+
h('div', { className: 'vcp-quota-reset' },
|
|
902
926
|
h('span', null, resetCountdown(item?.resetsAt, now)),
|
|
903
927
|
resetEpoch(item?.resetsAt) !== null
|
|
904
928
|
? h('time', { dateTime: item.resetsAt }, `重置于 ${formatTime(item.resetsAt)}`) : null));
|
|
@@ -929,7 +953,7 @@ function ModelSettingsEditor({ model, draft, error, disabled, onChange, onSave,
|
|
|
929
953
|
'aria-label': label, placeholder: '留空表示继承目录默认', autoComplete: 'off', spellCheck: false,
|
|
930
954
|
onChange: (event) => onChange({ [key]: event.target.value })
|
|
931
955
|
}));
|
|
932
|
-
return h('div', { className: 'vcp-
|
|
956
|
+
return h('div', { className: 'vcp-editor' },
|
|
933
957
|
h('div', { style: { fontWeight: 650, fontSize: 13 } }, `模型参数:${model?.name || model?.id}`),
|
|
934
958
|
h('div', { className: 'vcp-fields vcp-fields-three' },
|
|
935
959
|
numberField('contextWindow', MODEL_FIELD_LABELS.contextWindow),
|
|
@@ -1127,58 +1151,49 @@ function PlanCard({ plan, snapshot, rawQuota, busy, quotaBusy, onSelect, onModel
|
|
|
1127
1151
|
onResetModelSettings(plan, activeId, model.id);
|
|
1128
1152
|
};
|
|
1129
1153
|
|
|
1130
|
-
|
|
1154
|
+
const planState = providerEnabled
|
|
1155
|
+
? (!account ? '待选择账号' : !auth.inference ? '待完成鉴权' : '套餐已启用')
|
|
1156
|
+
: '套餐已停用';
|
|
1157
|
+
const planTone = providerEnabled && account && auth.inference ? 'success' : providerEnabled ? 'warn' : 'muted';
|
|
1158
|
+
|
|
1159
|
+
return h('section', { className: 'vcp-plan vcp-card', 'data-section': plan === 'agent-plan' ? '02' : '03', 'aria-label': PLAN_TITLES[plan] },
|
|
1131
1160
|
h(SectionHeading, {
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
action: h('span', { style: style.chip }, providerEnabled
|
|
1135
|
-
? (!account ? '待选择账号' : !auth.inference ? '待完成鉴权' : '套餐已启用')
|
|
1136
|
-
: '套餐已停用')
|
|
1161
|
+
title: plan === 'agent-plan' ? 'Agent 套餐' : '编程套餐',
|
|
1162
|
+
action: h(StatusChip, { tone: planTone }, planState)
|
|
1137
1163
|
}),
|
|
1138
|
-
|
|
1164
|
+
snapshot?.routingError ? h('p', { style: style.muted }, `所选账号:${account ? accountName(account) : '未选择'}`) : null,
|
|
1139
1165
|
snapshot?.routingError ? h(Notice, { tone: 'warn', role: 'alert' }, appliedAccount === undefined
|
|
1140
1166
|
? '实际生效账号暂不可确认,请排除路由错误后重试。'
|
|
1141
1167
|
: appliedAccount ? `实际生效账号:${accountName(appliedAccount)}(${appliedAccount.id}),路由更新尚未完成。` : '该套餐当前没有已生效的模型路由。') : null,
|
|
1142
|
-
h('div', { className: 'vcp-
|
|
1143
|
-
h('
|
|
1144
|
-
h('
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
!providerEnabled ? h('span', { style: style.muted }, '不注册模型路由;账号选择与模型参数保留') : null),
|
|
1153
|
-
h('label', { style: { ...style.field, flex: 'none' } },
|
|
1168
|
+
h('div', { className: 'vcp-plan-setup' },
|
|
1169
|
+
h('label', { className: 'vcp-plan-toggle' },
|
|
1170
|
+
h('input', {
|
|
1171
|
+
type: 'checkbox', checked: providerEnabled, disabled,
|
|
1172
|
+
'aria-label': `启用${PLAN_TITLES[plan]}`,
|
|
1173
|
+
style: { width: 18, height: 18, margin: 0, accentColor: 'var(--dsw-alias-brand-primary, Highlight)' },
|
|
1174
|
+
onChange: (event) => onToggleProvider(plan, Boolean(event.target.checked))
|
|
1175
|
+
}),
|
|
1176
|
+
h('span', null, '启用套餐')),
|
|
1177
|
+
h('label', { className: 'vcp-plan-account', style: style.field },
|
|
1154
1178
|
h('span', { style: style.label }, '使用账号'),
|
|
1155
1179
|
h('select', {
|
|
1156
1180
|
className: 'vcp-select', style: style.input,
|
|
1157
1181
|
value: activeId ?? '',
|
|
1158
1182
|
'aria-label': `${PLAN_TITLES[plan]}使用账号`,
|
|
1159
|
-
disabled
|
|
1183
|
+
disabled,
|
|
1160
1184
|
onChange: (event) => onSelect(plan, event.target.value || null)
|
|
1161
1185
|
},
|
|
1162
1186
|
h('option', { value: '' }, '未选择'),
|
|
1163
1187
|
accounts.map((item) => h('option', { key: item.id, value: item.id }, `${accountName(item)}${item.label && item.label !== accountName(item) ? ` · 备注:${item.label}` : ''}(${item.id})`)))),
|
|
1164
|
-
),
|
|
1188
|
+
!providerEnabled ? h('p', { className: 'vcp-plan-note', style: style.muted }, '路由已停用;账号选择与模型参数保留。') : null),
|
|
1165
1189
|
!account ? h('p', { style: style.muted }, '该套餐尚未选择账号,请选择已登录的账号。') : null,
|
|
1166
1190
|
account && auth.oauth && !auth.bound
|
|
1167
|
-
? h(Notice, { tone: 'warn' }, '
|
|
1191
|
+
? h(Notice, { tone: 'warn' }, '此账号尚未绑定该套餐,暂不能拉取模型或查询额度。请先确认已订阅此个人套餐,再到账号管理区重新网页登录更新绑定。')
|
|
1168
1192
|
: null,
|
|
1169
1193
|
account && !auth.oauth && !auth.inference
|
|
1170
1194
|
? h(Notice, { tone: 'warn' }, '该账号尚未配置此套餐的推理凭据,请在账号高级配置中填写引用名,或使用网页登录。')
|
|
1171
1195
|
: null,
|
|
1172
|
-
h('
|
|
1173
|
-
h('summary', { style: style.summary }, '套餐高级信息与技术标识'),
|
|
1174
|
-
h('div', { className: 'vcp-details-body' },
|
|
1175
|
-
h('p', { style: style.muted }, PLAN_HINTS[plan]),
|
|
1176
|
-
account ? h('p', { style: style.muted }, `鉴权来源:${auth.oauth ? '官方网页登录(OAuth)' : '凭据引用'} · ${auth.oauth ? `套餐绑定:${auth.bound ? '已绑定' : '未绑定'}` : `推理凭据:${auth.inference ? '已配置' : '未配置'}`} · 额度鉴权:${auth.oauth ? (auth.quota ? 'OAuth 已就绪' : 'OAuth 未就绪') : auth.quota ? 'AK/SK 已配置' : '未配置'}`) : null,
|
|
1177
|
-
account ? h('p', { style: style.muted }, `本地账号 ID:${account.id}${auth.oauth && auth.bound ? ` · 套餐 Profile:${account.oauthProfiles[plan]}` : ''}`) : null,
|
|
1178
|
-
route ? h('p', { style: style.muted }, `模型路由:${route}`) : null,
|
|
1179
|
-
catalog ? h('p', { style: style.muted }, `模型目录:${catalog.count} 个模型(来源 ${CATALOG_SOURCE_LABELS[catalog.source] ?? catalog.source}${catalog.updatedAt ? `,更新于 ${formatTime(catalog.updatedAt)}` : ''})。`) : null,
|
|
1180
|
-
h('p', { style: style.muted }, '能力参数采用插件固化快照;拉取只更新可用模型清单,手动覆盖优先。'))),
|
|
1181
|
-
h('section', { className: 'vcp-section', 'aria-busy': Boolean(quotaBusy), 'aria-label': `${PLAN_TITLES[plan]}额度` },
|
|
1196
|
+
h('section', { className: 'vcp-quota-section', 'aria-busy': Boolean(quotaBusy), 'aria-label': `${PLAN_TITLES[plan]}额度` },
|
|
1182
1197
|
h('div', { className: 'vcp-heading' },
|
|
1183
1198
|
h('h4', { style: { margin: 0, fontSize: 13, fontWeight: 650 } }, '套餐额度'),
|
|
1184
1199
|
h('button', { type: 'button', style: style.btn, disabled: disabled || quotaBusy || !auth.quota, 'aria-busy': quotaBusy || undefined, onClick: () => onQuota(plan) }, quotaBusy ? '正在刷新额度…' : quota?.state === 'error' ? '重试额度查询' : '刷新额度')),
|
|
@@ -1186,10 +1201,10 @@ function PlanCard({ plan, snapshot, rawQuota, busy, quotaBusy, onSelect, onModel
|
|
|
1186
1201
|
? h('p', { style: style.warn }, auth.oauth ? '该套餐的登录身份暂不可查询额度,请重新登录后重试。' : '该账号缺少 AK/SK 凭据引用,额度窗口无法查询。')
|
|
1187
1202
|
: null,
|
|
1188
1203
|
quotaBusy ? h('p', { role: 'status', style: style.muted }, `正在查询${PLAN_TITLES[plan]}的额度…`) : null,
|
|
1189
|
-
quota?.updatedAt ? h('p', { style: style.muted }, `额度更新时间:${formatTime(quota.updatedAt)}`) : null,
|
|
1190
1204
|
!account ? h('p', { style: style.muted }, '请先登录或添加账号,再为此套餐选择账号。')
|
|
1191
1205
|
: !quota && !auth.quota ? h('p', { style: style.muted }, '完成此套餐的登录绑定或额度鉴权配置后,即可查询额度。')
|
|
1192
|
-
: h(QuotaWindows, { quota })
|
|
1206
|
+
: h(QuotaWindows, { quota }),
|
|
1207
|
+
quota?.updatedAt ? h('p', { style: style.muted }, `额度更新时间:${formatTime(quota.updatedAt)}`) : null),
|
|
1193
1208
|
h('section', { className: 'vcp-section', 'aria-label': `${PLAN_TITLES[plan]}模型目录` },
|
|
1194
1209
|
h('div', { className: 'vcp-heading' },
|
|
1195
1210
|
h('div', { className: 'vcp-heading-copy' },
|
|
@@ -1210,7 +1225,7 @@ function PlanCard({ plan, snapshot, rawQuota, busy, quotaBusy, onSelect, onModel
|
|
|
1210
1225
|
setModelsOpen((previous) => !previous);
|
|
1211
1226
|
}
|
|
1212
1227
|
}, `模型列表(已启用 ${enabledCount} / 共 ${models.length})`),
|
|
1213
|
-
h('div', {
|
|
1228
|
+
h('div', { className: 'vcp-model-list' },
|
|
1214
1229
|
models.map((model, index) => h(ModelRow, {
|
|
1215
1230
|
key: model?.id ?? `model-${index}`,
|
|
1216
1231
|
model, disabled, routingError: snapshot?.routingError, editor, draftError,
|
|
@@ -1223,7 +1238,16 @@ function PlanCard({ plan, snapshot, rawQuota, busy, quotaBusy, onSelect, onModel
|
|
|
1223
1238
|
}))))
|
|
1224
1239
|
: h('p', { style: style.muted }, catalog
|
|
1225
1240
|
? '该目录暂无模型明细(旧缓存可能没有模型列表,重新拉取模型后可用)。'
|
|
1226
|
-
: !account ? '选择账号后显示该套餐的模型目录。' : '模型目录:尚未拉取。'))
|
|
1241
|
+
: !account ? '选择账号后显示该套餐的模型目录。' : '模型目录:尚未拉取。')),
|
|
1242
|
+
h('details', { className: 'vcp-details' },
|
|
1243
|
+
h('summary', { style: style.summary }, '套餐高级信息与技术标识'),
|
|
1244
|
+
h('div', { className: 'vcp-details-body' },
|
|
1245
|
+
h('p', { style: style.muted }, PLAN_HINTS[plan]),
|
|
1246
|
+
account ? h('p', { style: style.muted }, `鉴权来源:${auth.oauth ? '官方网页登录(OAuth)' : '凭据引用'} · ${auth.oauth ? `套餐绑定:${auth.bound ? '已绑定' : '未绑定'}` : `推理凭据:${auth.inference ? '已配置' : '未配置'}`} · 额度鉴权:${auth.oauth ? (auth.quota ? 'OAuth 已就绪' : 'OAuth 未就绪') : auth.quota ? 'AK/SK 已配置' : '未配置'}`) : null,
|
|
1247
|
+
account ? h('p', { style: style.muted }, `本地账号 ID:${account.id}${auth.oauth && auth.bound ? ` · 套餐 Profile:${account.oauthProfiles[plan]}` : ''}`) : null,
|
|
1248
|
+
route ? h('p', { style: style.muted }, `模型路由:${route}`) : null,
|
|
1249
|
+
catalog ? h('p', { style: style.muted }, `模型目录:${catalog.count} 个模型(来源 ${CATALOG_SOURCE_LABELS[catalog.source] ?? catalog.source}${catalog.updatedAt ? `,更新于 ${formatTime(catalog.updatedAt)}` : ''})。`) : null,
|
|
1250
|
+
h('p', { style: style.muted }, '能力参数采用插件固化快照;拉取只更新可用模型清单,手动覆盖优先。')))
|
|
1227
1251
|
);
|
|
1228
1252
|
}
|
|
1229
1253
|
|
|
@@ -1247,9 +1271,9 @@ function AccountPanel({ snapshot, editor, confirmDelete, loginConfirm, login, bu
|
|
|
1247
1271
|
const loginAccount = accounts.find((item) => item?.id === login.accountId) ?? null;
|
|
1248
1272
|
const authMode = loginAccount?.authMode ?? login.authMode ?? null;
|
|
1249
1273
|
|
|
1250
|
-
return h('section', { className: 'vcp-card', style: style.card, 'aria-label': '账号管理' },
|
|
1274
|
+
return h('section', { className: 'vcp-card vcp-account-panel', style: style.card, 'data-section': '01', 'aria-label': '账号管理' },
|
|
1251
1275
|
h(SectionHeading, {
|
|
1252
|
-
|
|
1276
|
+
title: '账号与登录',
|
|
1253
1277
|
action: h('span', { style: style.chip }, `${accounts.length} 个账号`)
|
|
1254
1278
|
}),
|
|
1255
1279
|
h('details', { className: 'vcp-accounts-disclosure', open: mustShowAccounts || accountsOpen },
|
|
@@ -1299,7 +1323,7 @@ function AccountPanel({ snapshot, editor, confirmDelete, loginConfirm, login, bu
|
|
|
1299
1323
|
? h('button', { type: 'button', style: style.btn, disabled: disabled, onClick: onCancelDelete }, '取消')
|
|
1300
1324
|
: null),
|
|
1301
1325
|
loginConfirm === account.id
|
|
1302
|
-
? h('div', { className: 'vcp-
|
|
1326
|
+
? h('div', { className: 'vcp-confirm' },
|
|
1303
1327
|
h('div', { style: { fontWeight: 650, fontSize: 13 } }, `开始网页登录:${accountName(account)}`),
|
|
1304
1328
|
h('ul', { style: { margin: 0, paddingLeft: 18, display: 'flex', flexDirection: 'column', gap: 6 } },
|
|
1305
1329
|
LOGIN_CONFIRM_NOTES.map((note, index) => h('li', { key: index, style: style.muted }, note))),
|
|
@@ -1307,7 +1331,7 @@ function AccountPanel({ snapshot, editor, confirmDelete, loginConfirm, login, bu
|
|
|
1307
1331
|
h('button', { type: 'button', style: style.primary, disabled: disabled, onClick: () => onConfirmLogin(account.id) }, '确认并打开官方登录页'),
|
|
1308
1332
|
h('button', { type: 'button', style: style.btn, disabled: disabled, onClick: onCancelLoginConfirm }, '取消')))
|
|
1309
1333
|
: null)))
|
|
1310
|
-
: h('div', { className: 'vcp-
|
|
1334
|
+
: h('div', { className: 'vcp-empty' },
|
|
1311
1335
|
h('p', { style: style.muted }, '还没有账号。可直接网页登录,确认后会自动创建本地账号,无需填写账号 ID 或密钥引用。'),
|
|
1312
1336
|
h('div', { className: 'vcp-actions' },
|
|
1313
1337
|
h('button', { type: 'button', style: style.primary, disabled: disabled || loginActive, onClick: () => onRequestLogin(NEW_LOGIN_ACCOUNT) }, '网页登录')),
|
|
@@ -1321,7 +1345,7 @@ function AccountPanel({ snapshot, editor, confirmDelete, loginConfirm, login, bu
|
|
|
1321
1345
|
h('div', { className: 'vcp-actions' },
|
|
1322
1346
|
accounts.length ? h('button', { type: 'button', style: style.primary, disabled: disabled || loginActive, onClick: () => onRequestLogin(NEW_LOGIN_ACCOUNT) }, '登录其他账号') : null,
|
|
1323
1347
|
h('button', { type: 'button', style: style.btn, disabled: disabled || loginActive || editor !== null, onClick: onNew }, '新增账号')),
|
|
1324
|
-
accounts.length > 0 && loginConfirm === NEW_LOGIN_ACCOUNT ? h('div', { className: 'vcp-
|
|
1348
|
+
accounts.length > 0 && loginConfirm === NEW_LOGIN_ACCOUNT ? h('div', { className: 'vcp-confirm' },
|
|
1325
1349
|
h('strong', null, '创建独立账号并网页登录'),
|
|
1326
1350
|
h('p', { style: style.muted }, '使用新的本地账号保存登录结果,不覆盖已有账号或更改当前套餐选择。请在独立 Chrome 窗口的官方页面确认实际授权身份。'),
|
|
1327
1351
|
h('ul', { style: { margin: 0, paddingLeft: 18 } }, LOGIN_CONFIRM_NOTES.map((note, index) => h('li', { key: index, style: style.muted }, note))),
|
|
@@ -1332,7 +1356,7 @@ function AccountPanel({ snapshot, editor, confirmDelete, loginConfirm, login, bu
|
|
|
1332
1356
|
login.state === 'idle' && !login.message && !loginUrl ? null
|
|
1333
1357
|
: login.state === 'success' && !loginUrl
|
|
1334
1358
|
? h(Notice, { tone: 'success', role: 'status' }, login.message ? `${LOGIN_STATE_LABELS.success} ${login.message}` : LOGIN_STATE_LABELS.success)
|
|
1335
|
-
: h('div', { className: 'vcp-login', role: loginActive ? 'status' : undefined },
|
|
1359
|
+
: h('div', { className: 'vcp-login-status', role: loginActive ? 'status' : undefined },
|
|
1336
1360
|
h('div', { style: { fontWeight: 650, fontSize: 13 } }, '网页登录状态'),
|
|
1337
1361
|
loginAccount ? h('p', { style: style.muted }, `当前登录账号:${accountName(loginAccount)}(${loginAccount.id})`) : null,
|
|
1338
1362
|
authMode ? h('p', { style: style.muted }, `凭据来源:${AUTH_MODE_LABELS[authMode] ?? authMode}`) : null,
|
|
@@ -1370,7 +1394,7 @@ function AccountForm({ editor, busy, onChangeDraft, onSave, onCancel }) {
|
|
|
1370
1394
|
placeholder, autoComplete: 'off', spellCheck: false,
|
|
1371
1395
|
onChange: (event) => onChangeDraft({ apiKeyRefs: { [plan]: event.target.value } })
|
|
1372
1396
|
}));
|
|
1373
|
-
return h('div', { className: 'vcp-
|
|
1397
|
+
return h('div', { className: 'vcp-editor' },
|
|
1374
1398
|
h('div', { style: { fontWeight: 650, fontSize: 13 } }, editor.mode === 'edit' ? `编辑账号:${editor.id}` : '新增账号'),
|
|
1375
1399
|
h('div', { className: 'vcp-fields' },
|
|
1376
1400
|
field('账号 ID(小写字母开头)', 'id', 'default'),
|
|
@@ -1764,29 +1788,37 @@ function VolcengineProviderSection({ client }) {
|
|
|
1764
1788
|
return h('div', { className: 'vcp-settings', style: style.root },
|
|
1765
1789
|
h('header', { className: 'vcp-header' },
|
|
1766
1790
|
h('div', { className: 'vcp-header-copy' },
|
|
1767
|
-
h('
|
|
1768
|
-
h('h2', { style: style.title }, '火山方舟 Provider'),
|
|
1769
|
-
h('p', { style: { ...style.muted, marginTop: 4 } }, '管理账号、套餐与模型额度。')),
|
|
1791
|
+
h('h2', { style: style.title }, '火山方舟 Provider')),
|
|
1770
1792
|
h('div', { className: 'vcp-actions' },
|
|
1771
1793
|
h('span', { role: 'status', style: style.chip }, headerStatus),
|
|
1772
1794
|
h('button', { type: 'button', style: style.btn, disabled: busyAccount || loading, onClick: () => { void refresh(); } }, loading ? '正在刷新状态…' : '刷新状态'))),
|
|
1773
1795
|
loading && snapshot ? h(Notice, { role: 'status' }, '正在更新账号与套餐状态…') : null,
|
|
1774
1796
|
busy ? h(Notice, { role: 'status' }, h('span', { 'aria-live': 'polite' }, busyMessage(busy))) : null,
|
|
1775
1797
|
loginActive ? h(Notice, { tone: 'warn', role: 'status' }, '登录期间暂不能修改账号与套餐,请完成登录或取消后继续。') : null,
|
|
1776
|
-
loadError ? h('
|
|
1777
|
-
h('p', { role: 'alert', style: style.error }, `读取状态失败:${loadError}`),
|
|
1778
|
-
h('button', { type: 'button', style: style.btn, disabled: busyAccount || loading, onClick: () => { void refresh(); } }, '重试读取状态')) : null,
|
|
1798
|
+
loadError ? h(Notice, { tone: 'error', role: 'alert', action: h('button', { type: 'button', style: style.btn, disabled: busyAccount || loading, onClick: () => { void refresh(); } }, '重试读取状态') }, `读取状态失败:${loadError}`) : null,
|
|
1779
1799
|
snapshot?.routingError ? h(Notice, { tone: 'error', role: 'alert' }, describeError(snapshot.routingError)) : null,
|
|
1780
1800
|
notice
|
|
1781
|
-
? h(
|
|
1782
|
-
|
|
1783
|
-
notice.refresh
|
|
1784
|
-
|
|
1785
|
-
: null)
|
|
1801
|
+
? h(Notice, {
|
|
1802
|
+
tone: notice.ok ? 'success' : 'error', role: notice.ok ? 'status' : 'alert',
|
|
1803
|
+
action: notice.refresh ? h('button', { type: 'button', style: style.btn, disabled: busyAccount, onClick: () => { setNotice(null); void refresh(); } }, '刷新') : null
|
|
1804
|
+
}, notice.text)
|
|
1786
1805
|
: null,
|
|
1787
1806
|
!snapshot
|
|
1788
1807
|
? (loading ? h('p', { role: 'status', style: style.muted }, '正在读取方舟账号状态…') : null)
|
|
1789
|
-
: h('div', { className: 'vcp-content' },
|
|
1808
|
+
: h('div', { className: 'vcp-content', 'data-empty': !(snapshot.accounts?.length) },
|
|
1809
|
+
h('div', { className: 'vcp-plans vcp-plan-workspace vcp-card', style: style.card },
|
|
1810
|
+
h(PlanCard, {
|
|
1811
|
+
plan: 'agent-plan', snapshot, rawQuota: quotas['agent-plan'], busy: planBusy, quotaBusy: Boolean(quotaBusy['agent-plan']),
|
|
1812
|
+
onSelect: selectAccount, onModels: pullModels, onQuota: pullQuota,
|
|
1813
|
+
onToggleProvider: toggleProvider, onToggleModel: toggleModel,
|
|
1814
|
+
onSaveModelSettings: saveModelSettings, onResetModelSettings: resetModelSettings
|
|
1815
|
+
}),
|
|
1816
|
+
h(PlanCard, {
|
|
1817
|
+
plan: 'coding-plan', snapshot, rawQuota: quotas['coding-plan'], busy: planBusy, quotaBusy: Boolean(quotaBusy['coding-plan']),
|
|
1818
|
+
onSelect: selectAccount, onModels: pullModels, onQuota: pullQuota,
|
|
1819
|
+
onToggleProvider: toggleProvider, onToggleModel: toggleModel,
|
|
1820
|
+
onSaveModelSettings: saveModelSettings, onResetModelSettings: resetModelSettings
|
|
1821
|
+
})),
|
|
1790
1822
|
h(AccountPanel, {
|
|
1791
1823
|
snapshot, editor, confirmDelete, loginConfirm, login, busy,
|
|
1792
1824
|
onNew: openNew, onEdit: openEdit, onCancelEdit: () => setEditor(null),
|
|
@@ -1799,20 +1831,7 @@ function VolcengineProviderSection({ client }) {
|
|
|
1799
1831
|
onConfirmLogin: confirmLogin,
|
|
1800
1832
|
onCancelLoginConfirm: () => setLoginConfirm(null),
|
|
1801
1833
|
onCancelLogin: () => { void cancelLogin(); }
|
|
1802
|
-
})
|
|
1803
|
-
h('div', { className: 'vcp-plans' },
|
|
1804
|
-
h(PlanCard, {
|
|
1805
|
-
plan: 'agent-plan', snapshot, rawQuota: quotas['agent-plan'], busy: planBusy, quotaBusy: Boolean(quotaBusy['agent-plan']),
|
|
1806
|
-
onSelect: selectAccount, onModels: pullModels, onQuota: pullQuota,
|
|
1807
|
-
onToggleProvider: toggleProvider, onToggleModel: toggleModel,
|
|
1808
|
-
onSaveModelSettings: saveModelSettings, onResetModelSettings: resetModelSettings
|
|
1809
|
-
}),
|
|
1810
|
-
h(PlanCard, {
|
|
1811
|
-
plan: 'coding-plan', snapshot, rawQuota: quotas['coding-plan'], busy: planBusy, quotaBusy: Boolean(quotaBusy['coding-plan']),
|
|
1812
|
-
onSelect: selectAccount, onModels: pullModels, onQuota: pullQuota,
|
|
1813
|
-
onToggleProvider: toggleProvider, onToggleModel: toggleModel,
|
|
1814
|
-
onSaveModelSettings: saveModelSettings, onResetModelSettings: resetModelSettings
|
|
1815
|
-
}))));
|
|
1834
|
+
})));
|
|
1816
1835
|
}
|
|
1817
1836
|
|
|
1818
1837
|
// ── 插件装配 ─────────────────────────────────────────────────────────────────
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-volcengine-provider",
|
|
3
3
|
"displayName": "火山方舟 Provider",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.7",
|
|
5
5
|
"description": "火山方舟 Agent Plan 与 Coding Plan:OAuth 登录、账号、模型与额度管理。",
|
|
6
6
|
"repository": {"type": "git", "url": "git+https://github.com/KouzakiUmi/dsh-volcengine-provider.git"},
|
|
7
7
|
"homepage": "https://github.com/KouzakiUmi/dsh-volcengine-provider#readme",
|