dsh-volcengine-provider 0.2.6 → 0.2.9
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 +6 -4
- package/docs/arkcli-contract.md +1 -1
- package/docs/changelog.md +16 -0
- package/docs/client-model-thinking-preview.png +0 -0
- package/docs/client-settings-preview-dark.png +0 -0
- package/docs/client-settings-preview-empty.png +0 -0
- package/docs/client-settings-preview-mobile-dark.png +0 -0
- package/docs/client-settings-preview-models.png +0 -0
- package/docs/client-settings-preview.png +0 -0
- package/docs/development.md +1 -0
- package/docs/model-capabilities.md +54 -14
- package/docs/model-management.md +6 -2
- package/docs/model-thinking-audit.md +54 -9
- package/docs/usage.md +8 -2
- package/docs/validation.md +22 -2
- package/lib/ark-adapter.mjs +26 -5
- package/lib/browser-bridge/win32/rundll32.exe +0 -0
- package/lib/catalog-snapshot.json +1 -1
- package/lib/catalog.mjs +72 -3
- package/lib/client.js +274 -133
- package/lib/consumption-rates.json +86 -0
- package/lib/messages-payload.mjs +15 -3
- package/lib/state.mjs +9 -1
- package/package.json +6 -6
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,43 @@ 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%}}
|
|
267
|
+
|
|
268
|
+
/* Provider workspace: independent plan cards, compact quotas and model badges. */
|
|
269
|
+
.vcp-settings{max-width:1080px;padding:4px 2px 32px;gap:16px;-webkit-font-smoothing:antialiased}
|
|
270
|
+
.vcp-content{gap:16px}.vcp-hero{position:relative;overflow:hidden;padding:20px 22px;border:1px solid var(--dsw-alias-border-l3,rgba(128,128,128,.2));border-radius:18px;background:linear-gradient(145deg,color-mix(in srgb,var(--dsw-alias-brand-primary,#2563eb) 8%,var(--dsw-alias-bg-layer-1,#fff)),var(--dsw-alias-bg-layer-1,#fff) 58%);box-shadow:0 8px 28px rgba(15,23,42,.05)}
|
|
271
|
+
.vcp-brand-mark{display:flex;align-items:center;justify-content:center;flex:none;width:42px;height:42px;border-radius:13px;background:var(--dsw-alias-brand-primary,#2563eb);color:var(--dsw-alias-label-primary-foreground,#fff);font-size:20px;font-weight:750;box-shadow:0 6px 16px color-mix(in srgb,var(--dsw-alias-brand-primary,#2563eb) 24%,transparent)}
|
|
272
|
+
.vcp-hero-subtitle{margin:5px 0 0;max-width:64ch;font-size:12px;line-height:1.6;color:var(--dsw-alias-label-secondary,inherit)}.vcp-eyebrow{margin-bottom:3px;font-size:10px;font-weight:700;letter-spacing:.09em;color:var(--dsw-alias-label-secondary,inherit)}
|
|
273
|
+
.vcp-plan-workspace{gap:14px;padding:0;border:0;background:transparent;overflow:visible;align-items:start}.vcp-plan{gap:14px;padding:18px;border:1px solid var(--dsw-alias-border-l3,rgba(128,128,128,.2));border-radius:16px;background:var(--dsw-alias-bg-layer-1,Canvas);box-shadow:0 3px 14px rgba(15,23,42,.035)}.vcp-plan-setup{align-items:stretch}.vcp-plan-account{flex-basis:100%}.vcp-plan-toggle{display:inline-flex;align-items:center;gap:7px;min-height:28px;font-size:11px;font-weight:600;white-space:nowrap;cursor:pointer}
|
|
274
|
+
.vcp-switch-input{appearance:none;-webkit-appearance:none;position:relative;flex:none;width:34px;height:20px;margin:0;border:1px solid var(--dsw-alias-border-l3,rgba(128,128,128,.35));border-radius:999px;background:var(--dsw-alias-bg-layer-2,rgba(128,128,128,.12));color:var(--dsw-alias-label-primary,#1f2937);cursor:pointer}.vcp-switch-input::after{content:'';position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:currentColor;box-shadow:0 1px 3px rgba(0,0,0,.2)}.vcp-switch-input:checked{border-color:var(--dsw-alias-brand-primary,#2563eb);background:var(--dsw-alias-brand-primary,#2563eb);color:var(--dsw-alias-label-primary-foreground,#fff)}.vcp-switch-input:checked::after{transform:translateX(14px)}body[data-ds-dark-theme] .vcp-switch-input:checked{color:#11161e}.vcp-switch-input:disabled{opacity:.55;cursor:not-allowed}
|
|
275
|
+
.vcp-status-chip{display:inline-flex;align-items:center;gap:5px;padding:2px 8px;border:1px solid var(--dsw-alias-border-l4,rgba(128,128,128,.18));border-radius:999px;font-size:10.5px;line-height:1.6;white-space:nowrap;color:var(--dsw-alias-label-secondary,inherit);background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.06))}.vcp-status-chip::before{content:'';width:6px;height:6px;border-radius:50%;background:currentColor}.vcp-status-chip[data-tone=success]{color:var(--dsw-alias-state-success-primary,#15803d);border-color:color-mix(in srgb,currentColor 30%,transparent);background:color-mix(in srgb,currentColor 8%,transparent)}.vcp-status-chip[data-tone=warn]{color:var(--dsw-alias-state-warn-primary,#b45309);border-color:color-mix(in srgb,currentColor 30%,transparent);background:color-mix(in srgb,currentColor 8%,transparent)}
|
|
276
|
+
.vcp-quota{grid-template-columns:1fr;gap:8px}.vcp-quota-group{grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr));gap:8px}.vcp-quota-group-title{grid-column:1/-1}.vcp-quota-window{padding:10px;border:1px solid var(--dsw-alias-border-l4,rgba(128,128,128,.12));background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.045))}.vcp-quota-track{height:6px}.vcp-quota-percent{font-size:18px}.vcp-quota-meta{font-size:11px}.vcp-section{gap:8px;padding-top:12px}
|
|
277
|
+
.vcp-model-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:10px;margin-top:10px}.vcp-model{position:relative;display:flex;flex-direction:column;gap:10px;min-width:0;padding:13px;border:1px solid var(--dsw-alias-border-l3,rgba(128,128,128,.18));border-radius:12px;background:var(--dsw-alias-bg-layer-2,rgba(128,128,128,.035));box-shadow:inset 0 1px 0 rgba(255,255,255,.035)}.vcp-model:first-child{border-top:1px solid var(--dsw-alias-border-l3,rgba(128,128,128,.18))}.vcp-model[data-disabled=true]{opacity:.66}.vcp-model-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;min-width:0}.vcp-model-toggle{display:flex;align-items:flex-start;gap:9px;flex:1 1 auto;min-width:0;cursor:pointer}.vcp-model-toggle .vcp-switch-input{margin-top:1px}.vcp-model-heading{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0;font-size:13px;line-height:1.45}.vcp-model-name{font-size:13.5px;font-weight:650;overflow-wrap:anywhere}.vcp-model-tags{display:flex;gap:5px;flex-wrap:wrap}.vcp-model-tag{display:inline-flex;align-items:center;padding:2px 7px;border:1px solid var(--dsw-alias-border-l4,rgba(128,128,128,.16));border-radius:999px;font-size:10px;line-height:1.55;white-space:nowrap;color:var(--dsw-alias-label-secondary,inherit);background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.04))}.vcp-model-tag[data-tone=accent]{color:var(--dsw-alias-brand-primary,#2563eb);border-color:color-mix(in srgb,currentColor 25%,transparent);background:color-mix(in srgb,currentColor 6%,transparent)}.vcp-model-tag[data-tone=warn]{color:var(--dsw-alias-state-warn-primary,#b45309)}
|
|
278
|
+
.vcp-rate-badge{display:inline-flex;align-items:center;gap:4px;padding:1px 7px;border:1px solid color-mix(in srgb,var(--dsw-alias-brand-primary,#2563eb) 35%,transparent);border-radius:999px;background:color-mix(in srgb,var(--dsw-alias-brand-primary,#2563eb) 8%,transparent);color:var(--dsw-alias-brand-primary,#2563eb);font-size:10.5px;font-weight:750;line-height:1.6;white-space:nowrap;font-variant-numeric:tabular-nums}.vcp-rate-badge small{font-size:8.5px;font-weight:650;opacity:1}.vcp-rate-badge[data-discount=true]{color:var(--dsw-alias-state-success-primary,#15803d);border-color:color-mix(in srgb,currentColor 35%,transparent);background:color-mix(in srgb,currentColor 9%,transparent)}
|
|
279
|
+
.vcp-model-actions{display:flex;justify-content:flex-end;gap:7px;flex-wrap:wrap;margin-top:auto}.vcp-model-actions .vcp-button{min-height:29px;padding:4px 10px;font-size:11px}.vcp-model .vcp-details{padding-top:2px;border-top:1px solid var(--dsw-alias-border-l4,rgba(128,128,128,.12))}.vcp-model .vcp-details>summary{min-height:25px;padding:3px 0;font-size:11px}.vcp-account-panel{border-radius:16px;padding:16px 18px}.vcp-button{transition:border-color .15s ease,box-shadow .15s ease}.vcp-button-primary{border-color:var(--dsw-alias-brand-primary,#2563eb)}
|
|
280
|
+
@media(max-width:680px){.vcp-hero{padding:16px}.vcp-plan{padding:15px}.vcp-model-list{grid-template-columns:1fr}}
|
|
281
|
+
@media(max-width:420px){.vcp-plan{padding:12px}.vcp-brand-mark{width:36px;height:36px;border-radius:11px;font-size:17px}.vcp-hero .vcp-header-copy{flex:1 1 calc(100% - 52px)}.vcp-hero-subtitle{font-size:11px}.vcp-model-head{flex-direction:column}.vcp-model-head>.vcp-chip-row{padding-left:43px}.vcp-quota{grid-template-columns:1fr}}
|
|
282
|
+
@media(prefers-reduced-motion:reduce){.vcp-settings *{scroll-behavior:auto!important;transition:none!important}}
|
|
266
283
|
`;
|
|
267
284
|
|
|
268
285
|
function installStyles() {
|
|
@@ -290,9 +307,39 @@ function SectionHeading({ eyebrow, title, description, action }) {
|
|
|
290
307
|
action ?? null);
|
|
291
308
|
}
|
|
292
309
|
|
|
293
|
-
function Notice({ tone = 'muted', role, children }) {
|
|
310
|
+
function Notice({ tone = 'muted', role, children, action }) {
|
|
294
311
|
return h('div', { className: 'vcp-notice', 'data-tone': tone },
|
|
295
|
-
h('
|
|
312
|
+
h('span', { className: 'vcp-notice-icon', 'aria-hidden': 'true' }, ({ error: '×', warn: '!', success: '✓', muted: '…' })[tone] || 'i'),
|
|
313
|
+
h('p', { role, style: style[tone] || style.muted }, children),
|
|
314
|
+
action ?? null);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function StatusChip({ tone = 'muted', children }) {
|
|
318
|
+
return h('span', { className: 'vcp-status-chip', 'data-tone': tone }, children);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function ModelTag({ tone = 'muted', title, children }) {
|
|
322
|
+
return h('span', { className: 'vcp-model-tag', 'data-tone': tone, title }, children);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function formatRate(value) {
|
|
326
|
+
return Number.isFinite(value) ? String(Math.round(value * 100) / 100) : '';
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function ConsumptionBadge({ plan, consumption }) {
|
|
330
|
+
const rate = formatRate(consumption?.multiplier);
|
|
331
|
+
if (!rate) return null;
|
|
332
|
+
const regular = formatRate(consumption.regularMultiplier);
|
|
333
|
+
const discount = consumption.discounted
|
|
334
|
+
? `限时折扣至 ${formatTime(consumption.discountEndsAt)},常规倍率 ${regular}×。`
|
|
335
|
+
: '当前按常规倍率展示。';
|
|
336
|
+
const title = plan === 'agent-plan'
|
|
337
|
+
? `Agent Plan AFP 输入/输出抵扣系数均为 ${rate}。${discount}`
|
|
338
|
+
: `以官方 Agent Plan AFP 系数作相对消耗参考 ${rate}×;Coding Plan 不以此换算固定调用次数或 AFP 绝对量。${discount}`;
|
|
339
|
+
return h('span', {
|
|
340
|
+
className: 'vcp-rate-badge', 'data-discount': consumption.discounted ? 'true' : 'false',
|
|
341
|
+
title, 'aria-label': `消耗倍率 ${rate} 倍${consumption.discounted ? ',限时折扣' : ''}`
|
|
342
|
+
}, `${rate}×`, consumption.discounted ? h('small', null, '限时') : null);
|
|
296
343
|
}
|
|
297
344
|
|
|
298
345
|
// ── 纯函数小工具 ─────────────────────────────────────────────────────────────
|
|
@@ -414,6 +461,19 @@ function formatPercent(value) {
|
|
|
414
461
|
return Number.isFinite(rounded) ? String(rounded) : '0';
|
|
415
462
|
}
|
|
416
463
|
|
|
464
|
+
function formatTokenCount(value) {
|
|
465
|
+
if (!Number.isFinite(value) || value <= 0) return '未知';
|
|
466
|
+
if (value >= 1024 * 1024) {
|
|
467
|
+
const amount = value / (1024 * 1024);
|
|
468
|
+
return `${Number.isInteger(amount) ? amount : amount.toFixed(1)}M`;
|
|
469
|
+
}
|
|
470
|
+
if (value >= 1024) {
|
|
471
|
+
const amount = value / 1024;
|
|
472
|
+
return `${Number.isInteger(amount) ? amount : amount.toFixed(1)}K`;
|
|
473
|
+
}
|
|
474
|
+
return String(value);
|
|
475
|
+
}
|
|
476
|
+
|
|
417
477
|
/**
|
|
418
478
|
* 归一化登录状态。
|
|
419
479
|
*
|
|
@@ -607,6 +667,8 @@ function describeModelSettings(model) {
|
|
|
607
667
|
if (Number.isFinite(settings.contextWindow)) parts.push(`上下文长度 ${settings.contextWindow}`);
|
|
608
668
|
if (Number.isFinite(settings.maxTokens)) parts.push(`最大输出 ${settings.maxTokens}`);
|
|
609
669
|
if (Number.isFinite(settings.temperature)) parts.push(`温度 ${settings.temperature}`);
|
|
670
|
+
if (Object.hasOwn(settings, 'imageInput')) parts.push(`图片输入 ${settings.imageInput ? '启用' : '禁用'}`);
|
|
671
|
+
if (Object.hasOwn(settings, 'toolsEnabled')) parts.push(`工具调用 ${settings.toolsEnabled ? '启用' : '禁用'}`);
|
|
610
672
|
if (Object.hasOwn(settings, 'reasoningEfforts')) parts.push(`思考档位 ${effortSummary(settings.reasoningEfforts)}`);
|
|
611
673
|
if (Object.hasOwn(settings, 'defaultReasoning')) parts.push(`默认档位 ${settings.defaultReasoning === null ? '不强制' : String(settings.defaultReasoning)}`);
|
|
612
674
|
if (Object.hasOwn(settings, 'forceAdaptiveThinking')) parts.push(settings.forceAdaptiveThinking ? '原生 effort 模式' : '固定预算模式');
|
|
@@ -626,6 +688,8 @@ function describeEffective(model) {
|
|
|
626
688
|
if (Number.isFinite(effective.contextWindow)) parts.push(`上下文长度 ${effective.contextWindow}`);
|
|
627
689
|
if (Number.isFinite(effective.maxTokens)) parts.push(`最大输出 ${effective.maxTokens}`);
|
|
628
690
|
if (Number.isFinite(effective.temperature)) parts.push(`温度 ${effective.temperature}`);
|
|
691
|
+
if (typeof effective.imageInput === 'boolean') parts.push(`图片输入 ${effective.imageInput ? '启用' : '禁用'}`);
|
|
692
|
+
if (typeof effective.toolsEnabled === 'boolean') parts.push(`工具调用 ${effective.toolsEnabled ? '启用' : '禁用'}`);
|
|
629
693
|
if (Object.hasOwn(effective, 'reasoningEfforts')) parts.push(`思考档位 ${effortSummary(effective.reasoningEfforts)}`);
|
|
630
694
|
if (Object.hasOwn(effective, 'defaultReasoning')) parts.push(`默认档位 ${effective.defaultReasoning === null ? '不强制' : String(effective.defaultReasoning)}`);
|
|
631
695
|
if (effective.reasoningEfforts === false) parts.push('思考控制按模型默认');
|
|
@@ -663,6 +727,8 @@ function modelDraftFrom(model) {
|
|
|
663
727
|
contextWindow: settings.contextWindow === undefined ? '' : String(settings.contextWindow),
|
|
664
728
|
maxTokens: settings.maxTokens === undefined ? '' : String(settings.maxTokens),
|
|
665
729
|
temperature: settings.temperature === undefined ? '' : String(settings.temperature),
|
|
730
|
+
imageInput: settings.imageInput === undefined ? 'inherit' : settings.imageInput ? 'true' : 'false',
|
|
731
|
+
toolsEnabled: settings.toolsEnabled === undefined ? 'inherit' : settings.toolsEnabled ? 'true' : 'false',
|
|
666
732
|
effortsMode,
|
|
667
733
|
effortsText,
|
|
668
734
|
defaultReasoning,
|
|
@@ -739,6 +805,12 @@ function parseModelSettings(draft, model) {
|
|
|
739
805
|
else settings.temperature = value;
|
|
740
806
|
}
|
|
741
807
|
|
|
808
|
+
for (const key of ['imageInput', 'toolsEnabled']) {
|
|
809
|
+
const value = draft?.[key] ?? 'inherit';
|
|
810
|
+
if (value === 'true') settings[key] = true;
|
|
811
|
+
else if (value === 'false') settings[key] = false;
|
|
812
|
+
}
|
|
813
|
+
|
|
742
814
|
const effortsMode = draft?.effortsMode ?? 'inherit';
|
|
743
815
|
// 生效中的档位映射:自定义映射用草稿里的值,继承时用目录里的有效值。
|
|
744
816
|
let effortsMap = null;
|
|
@@ -865,10 +937,10 @@ function QuotaWindows({ quota }) {
|
|
|
865
937
|
// 先显示后端给的原因,再补一条网页登录的出路。
|
|
866
938
|
const detail = quota.error ? describeError(quota.error) : '该账号暂无可用的额度鉴权凭据。';
|
|
867
939
|
const hint = /登录/.test(detail) ? '' : ' 可用该账号的「网页登录」完成 OAuth 绑定后重试。';
|
|
868
|
-
return h(
|
|
940
|
+
return h(Notice, { tone: 'warn' }, `额度查询不可用:${detail}${hint}`);
|
|
869
941
|
}
|
|
870
942
|
if (quota.state === 'error') {
|
|
871
|
-
return h(
|
|
943
|
+
return h(Notice, { tone: 'error', role: 'alert' }, `额度查询失败:${describeError(quota.error)}`);
|
|
872
944
|
}
|
|
873
945
|
const windows = Array.isArray(quota.windows) ? quota.windows : [];
|
|
874
946
|
if (!windows.length) return h('p', { style: style.muted }, '该账号没有可展示的额度窗口(可能未订阅此套餐)。');
|
|
@@ -884,21 +956,38 @@ function QuotaWindows({ quota }) {
|
|
|
884
956
|
}
|
|
885
957
|
return h('div', { className: 'vcp-quota' },
|
|
886
958
|
groups.map((group, index) => h('section', { key: group.key || `g${index}`, className: 'vcp-quota-group', 'aria-label': group.label || '额度窗口' },
|
|
887
|
-
group.label ? h('div', {
|
|
959
|
+
group.label ? h('div', { className: 'vcp-quota-group-title' }, group.label) : null,
|
|
888
960
|
group.windows.map((item, position) => {
|
|
889
961
|
const summary = windowSummary(item);
|
|
890
962
|
const percent = finiteQuotaNumber(item?.percent);
|
|
963
|
+
const remaining = percent === null ? null : Math.max(0, Math.min(100, 100 - percent));
|
|
964
|
+
const resetTime = resetEpoch(item?.resetsAt);
|
|
965
|
+
const resetPassed = resetTime !== null && resetTime <= now;
|
|
891
966
|
const label = WINDOW_KIND_LABELS[item?.kind] ?? item?.kind ?? '窗口';
|
|
892
|
-
|
|
967
|
+
const detail = item?.detail;
|
|
968
|
+
const usageParts = [
|
|
969
|
+
detail && finiteQuotaNumber(detail.used) !== null && finiteQuotaNumber(detail.limit) !== null
|
|
970
|
+
? `已用 ${detail.used} / ${detail.limit} ${detail.unit ?? ''}`.trim() : null,
|
|
971
|
+
detail?.scope ? `范围 ${detail.scope}` : null,
|
|
972
|
+
typeof detail?.note === 'string' && detail.note ? detail.note : null
|
|
973
|
+
].filter(Boolean);
|
|
974
|
+
return h('div', { key: `${item?.kind ?? 'w'}-${position}`, className: 'vcp-quota-window', 'data-tone': summary.tone },
|
|
893
975
|
h('div', { className: 'vcp-quota-line' },
|
|
894
|
-
h('span', {
|
|
895
|
-
h(
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
976
|
+
h('span', { className: 'vcp-quota-name' }, label),
|
|
977
|
+
summary.tone !== 'muted' ? h(StatusChip, { tone: summary.tone }, resetPassed ? '待刷新' : summary.tone === 'error' ? '已用尽' : '余量不足') : null,
|
|
978
|
+
h('span', { className: 'vcp-quota-value' }, remaining === null
|
|
979
|
+
? h('span', { style: style.muted }, '百分比未提供')
|
|
980
|
+
: [
|
|
981
|
+
h('strong', { key: 'value', className: 'vcp-quota-percent' }, formatPercent(remaining), h('small', null, '%')),
|
|
982
|
+
h('span', { key: 'label', className: 'vcp-quota-remaining' }, '剩余')
|
|
983
|
+
])),
|
|
984
|
+
remaining !== null ? h('div', {
|
|
985
|
+
className: 'vcp-quota-track', role: 'progressbar',
|
|
986
|
+
'aria-valuemin': 0, 'aria-valuemax': 100, 'aria-valuenow': remaining,
|
|
987
|
+
'aria-label': `${label}剩余额度`, 'aria-valuetext': `剩余 ${formatPercent(remaining)}%`
|
|
988
|
+
}, h('div', { className: 'vcp-quota-fill', style: { width: `${remaining}%`, minWidth: remaining > 0 ? 4 : 0 } })) : null,
|
|
989
|
+
usageParts.length ? h('div', { className: 'vcp-quota-meta' }, usageParts.join(' · ')) : null,
|
|
990
|
+
h('div', { className: 'vcp-quota-reset' },
|
|
902
991
|
h('span', null, resetCountdown(item?.resetsAt, now)),
|
|
903
992
|
resetEpoch(item?.resetsAt) !== null
|
|
904
993
|
? h('time', { dateTime: item.resetsAt }, `重置于 ${formatTime(item.resetsAt)}`) : null));
|
|
@@ -929,13 +1018,60 @@ function ModelSettingsEditor({ model, draft, error, disabled, onChange, onSave,
|
|
|
929
1018
|
'aria-label': label, placeholder: '留空表示继承目录默认', autoComplete: 'off', spellCheck: false,
|
|
930
1019
|
onChange: (event) => onChange({ [key]: event.target.value })
|
|
931
1020
|
}));
|
|
932
|
-
|
|
1021
|
+
const capabilityCheckbox = (key, label) => {
|
|
1022
|
+
const mode = draft?.[key] ?? 'inherit';
|
|
1023
|
+
const inherited = model?.defaults?.[key];
|
|
1024
|
+
const unknown = mode === 'inherit' && typeof inherited !== 'boolean';
|
|
1025
|
+
return h('input', {
|
|
1026
|
+
type: 'checkbox', checked: mode === 'inherit' ? inherited === true : mode === 'true', disabled,
|
|
1027
|
+
'aria-label': label, 'aria-checked': unknown ? 'mixed' : undefined,
|
|
1028
|
+
ref: (element) => { if (element) element.indeterminate = unknown; },
|
|
1029
|
+
style: { width: 18, height: 18, margin: 0, flex: '0 0 auto', accentColor: 'var(--dsw-alias-brand-primary, Highlight)' },
|
|
1030
|
+
onChange: (event) => onChange({ [key]: event.target.checked ? 'true' : 'false' })
|
|
1031
|
+
});
|
|
1032
|
+
};
|
|
1033
|
+
const capabilityStatus = (key) => {
|
|
1034
|
+
const mode = draft?.[key] ?? 'inherit';
|
|
1035
|
+
if (mode !== 'inherit') return `已覆盖 · ${mode === 'true' ? '启用' : '禁用'}`;
|
|
1036
|
+
const inherited = model?.defaults?.[key];
|
|
1037
|
+
return `继承 · 目录默认:${typeof inherited === 'boolean' ? (inherited ? '启用' : '禁用') : '未知'}`;
|
|
1038
|
+
};
|
|
1039
|
+
const restoreCapability = (key, label) => (draft?.[key] ?? 'inherit') === 'inherit' ? null : h('button', {
|
|
1040
|
+
type: 'button', style: { ...style.btn, flex: '0 0 auto' }, disabled,
|
|
1041
|
+
'aria-label': label, onClick: () => onChange({ [key]: 'inherit' })
|
|
1042
|
+
}, '恢复继承');
|
|
1043
|
+
const checkboxLabel = (key, label, text) => h('label', { className: 'vcp-plan-toggle' },
|
|
1044
|
+
capabilityCheckbox(key, label), h('span', null, text));
|
|
1045
|
+
return h('div', { className: 'vcp-editor' },
|
|
933
1046
|
h('div', { style: { fontWeight: 650, fontSize: 13 } }, `模型参数:${model?.name || model?.id}`),
|
|
934
1047
|
h('div', { className: 'vcp-fields vcp-fields-three' },
|
|
935
1048
|
numberField('contextWindow', MODEL_FIELD_LABELS.contextWindow),
|
|
936
1049
|
numberField('maxTokens', MODEL_FIELD_LABELS.maxTokens),
|
|
937
1050
|
numberField('temperature', MODEL_FIELD_LABELS.temperature)),
|
|
938
1051
|
h('p', { style: style.muted }, TEMPERATURE_HINT),
|
|
1052
|
+
h('section', { className: 'vcp-section', 'aria-label': '模型输入与工具调用' },
|
|
1053
|
+
h('div', { className: 'vcp-actions' },
|
|
1054
|
+
h('strong', { style: { fontSize: 13 } }, '输入类型'),
|
|
1055
|
+
h('label', { className: 'vcp-plan-toggle' },
|
|
1056
|
+
h('input', {
|
|
1057
|
+
type: 'checkbox', checked: true, disabled: true, 'aria-label': '文本输入(固定开启)',
|
|
1058
|
+
style: { width: 18, height: 18, margin: 0, flex: '0 0 auto', accentColor: 'var(--dsw-alias-brand-primary, Highlight)' }
|
|
1059
|
+
}),
|
|
1060
|
+
h('span', null, '文本')),
|
|
1061
|
+
checkboxLabel('imageInput', '图片输入', '图片')),
|
|
1062
|
+
h('div', { className: 'vcp-actions' },
|
|
1063
|
+
h('span', { style: style.chip }, capabilityStatus('imageInput')),
|
|
1064
|
+
restoreCapability('imageInput', '恢复图片输入默认')),
|
|
1065
|
+
h('div', { className: 'vcp-actions' },
|
|
1066
|
+
checkboxLabel('toolsEnabled', '工具调用', '工具调用'),
|
|
1067
|
+
h('span', { style: style.chip }, capabilityStatus('toolsEnabled')),
|
|
1068
|
+
restoreCapability('toolsEnabled', '恢复工具调用默认')),
|
|
1069
|
+
draft?.imageInput === 'true'
|
|
1070
|
+
? h('p', { style: style.warn }, '强制启用图片输入仅是本地能力声明,服务端可能仍不支持图片。') : null,
|
|
1071
|
+
draft?.toolsEnabled === 'false'
|
|
1072
|
+
? h('p', { style: style.muted }, '禁用后模型不能发起新工具调用;历史消息中的工具调用回放保留。') : null,
|
|
1073
|
+
h('p', { style: style.muted }, '音频 / 视频:本 DSH 通道不可用,不提供能力覆盖开关。'),
|
|
1074
|
+
h('p', { style: style.muted }, '独立 JSON Schema 结构化输出:本 DSH 通道暂不可用,不提供配置开关。')),
|
|
939
1075
|
h('label', { style: stackedField },
|
|
940
1076
|
h('span', { style: style.label }, '思考档位映射 reasoningEfforts'),
|
|
941
1077
|
h('select', {
|
|
@@ -993,36 +1129,43 @@ function ModelSettingsEditor({ model, draft, error, disabled, onChange, onSave,
|
|
|
993
1129
|
* @param {object} props 组件属性
|
|
994
1130
|
* @returns {object} 元素树
|
|
995
1131
|
*/
|
|
996
|
-
function ModelRow({ model, disabled, routingError, editor, draftError, onToggle, onOpenEditor, onCloseEditor, onChangeDraft, onSave, onReset }) {
|
|
1132
|
+
function ModelRow({ plan, model, disabled, routingError, editor, draftError, onToggle, onOpenEditor, onCloseEditor, onChangeDraft, onSave, onReset }) {
|
|
997
1133
|
const enabled = model?.enabled !== false;
|
|
998
1134
|
const editing = editor?.modelId === model?.id;
|
|
999
|
-
const
|
|
1135
|
+
const effectiveSummary = describeEffective(model);
|
|
1136
|
+
const values = model?.effective ?? model?.defaults ?? {};
|
|
1000
1137
|
const capabilityLabel = ({ dynamic: '动态路由', partial: '部分参数未公开', unknown: '参数待确认' })[model?.capabilityStatus]
|
|
1001
1138
|
|| (model?.capabilityUnverified ? '参数待确认' : '');
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
h('span', { className: 'vcp-model-name', title: model?.id }, model?.name || model?.id)
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1139
|
+
const thinkingLabel = model?.canDisableThinking === false ? '常驻思考' : values.reasoningEfforts ? '可调思考' : '思考按默认';
|
|
1140
|
+
return h('article', { className: 'vcp-model', 'data-disabled': enabled ? 'false' : 'true' },
|
|
1141
|
+
h('div', { className: 'vcp-model-head' },
|
|
1142
|
+
h('label', { className: 'vcp-model-toggle' },
|
|
1143
|
+
h('input', {
|
|
1144
|
+
className: 'vcp-switch-input', type: 'checkbox', checked: enabled, disabled,
|
|
1145
|
+
'aria-label': `启用模型 ${model?.id ?? ''}`,
|
|
1146
|
+
onChange: (event) => onToggle(model, Boolean(event.target.checked))
|
|
1147
|
+
}),
|
|
1148
|
+
h('span', { className: 'vcp-model-heading' },
|
|
1149
|
+
h('span', { className: 'vcp-model-name', title: model?.id }, model?.name || model?.id),
|
|
1150
|
+
h(ConsumptionBadge, { plan, consumption: model?.consumption }))),
|
|
1151
|
+
h('span', { className: 'vcp-chip-row' },
|
|
1152
|
+
capabilityLabel ? h('span', { style: style.chip }, capabilityLabel) : null,
|
|
1153
|
+
enabled ? null : h('span', { style: style.chip }, '已停用'))),
|
|
1154
|
+
h('div', { className: 'vcp-model-tags' },
|
|
1155
|
+
h(ModelTag, { tone: values.imageInput ? 'accent' : 'muted' }, values.imageInput ? '视觉' : '纯文本'),
|
|
1156
|
+
h(ModelTag, { tone: values.reasoningEfforts ? 'accent' : 'muted' }, thinkingLabel),
|
|
1157
|
+
h(ModelTag, { title: `上下文长度 ${values.contextWindow ?? '未知'} token` }, `上下文 ${formatTokenCount(values.contextWindow)}`),
|
|
1158
|
+
h(ModelTag, { title: `最大输出 ${values.maxTokens ?? '未知'} token` }, `输出 ${formatTokenCount(values.maxTokens)}`),
|
|
1159
|
+
values.toolsEnabled === false ? h(ModelTag, { tone: 'warn' }, '工具已停用') : null),
|
|
1160
|
+
h('div', { className: 'vcp-model-actions' },
|
|
1161
|
+
h('button', { type: 'button', style: style.btn, disabled, 'aria-label': `模型参数 ${model?.id ?? ''}`, onClick: () => (editing ? onCloseEditor() : onOpenEditor(model)) }, editing ? '收起参数' : '参数'),
|
|
1162
|
+
h('button', { type: 'button', style: style.btn, disabled, 'aria-label': `恢复默认 ${model?.id ?? ''}`, title: '清除全部参数覆盖并恢复模型启用状态', onClick: () => onReset(model) }, enabled ? '恢复默认' : '恢复默认并启用')),
|
|
1020
1163
|
h('details', { className: 'vcp-details' },
|
|
1021
1164
|
h('summary', { style: style.summary }, '模型技术标识与参数详情'),
|
|
1022
1165
|
h('div', { className: 'vcp-model-meta' },
|
|
1023
1166
|
h('p', { className: 'vcp-model-id', style: style.muted }, `调用 ID:${model?.id ?? ''}`),
|
|
1024
1167
|
h('p', { style: style.muted }, `当前参数:${describeModelSettings(model)}`),
|
|
1025
|
-
|
|
1168
|
+
effectiveSummary ? h('p', { style: routingError ? style.warn : style.muted }, `${routingError ? '已保存配置(路由尚未生效)' : '生效值'}:${effectiveSummary}`) : null,
|
|
1026
1169
|
model?.capabilityNote ? h('p', { style: style.muted }, model.capabilityNote) : null)),
|
|
1027
1170
|
model?.settingsWarning ? h('p', { role: 'alert', style: style.warn }, model.settingsWarning) : null,
|
|
1028
1171
|
editing
|
|
@@ -1127,58 +1270,50 @@ function PlanCard({ plan, snapshot, rawQuota, busy, quotaBusy, onSelect, onModel
|
|
|
1127
1270
|
onResetModelSettings(plan, activeId, model.id);
|
|
1128
1271
|
};
|
|
1129
1272
|
|
|
1130
|
-
|
|
1273
|
+
const planState = providerEnabled
|
|
1274
|
+
? (!account ? '待选择账号' : !auth.inference ? '待完成鉴权' : '套餐已启用')
|
|
1275
|
+
: '套餐已停用';
|
|
1276
|
+
const planTone = providerEnabled && account && auth.inference ? 'success' : providerEnabled ? 'warn' : 'muted';
|
|
1277
|
+
|
|
1278
|
+
return h('section', { className: 'vcp-plan vcp-card', 'data-section': plan === 'agent-plan' ? '02' : '03', 'aria-label': PLAN_TITLES[plan] },
|
|
1131
1279
|
h(SectionHeading, {
|
|
1132
|
-
eyebrow: plan === 'agent-plan' ? '
|
|
1133
|
-
title:
|
|
1134
|
-
action: h('
|
|
1135
|
-
|
|
1136
|
-
: '
|
|
1137
|
-
}),
|
|
1138
|
-
account ? h('p', { style: { margin: 0, fontSize: 13, fontWeight: 550 } }, `${snapshot?.routingError ? '所选账号' : '当前账号'}:${accountName(account)}`) : null,
|
|
1139
|
-
snapshot?.routingError ? h(Notice, { tone: 'warn', role: 'alert' }, appliedAccount === undefined
|
|
1140
|
-
? '实际生效账号暂不可确认,请排除路由错误后重试。'
|
|
1141
|
-
: appliedAccount ? `实际生效账号:${accountName(appliedAccount)}(${appliedAccount.id}),路由更新尚未完成。` : '该套餐当前没有已生效的模型路由。') : null,
|
|
1142
|
-
h('div', { className: 'vcp-login' },
|
|
1143
|
-
h('div', { className: 'vcp-heading' },
|
|
1144
|
-
h('label', { className: 'vcp-actions', style: { fontSize: 12, fontWeight: 550 } },
|
|
1280
|
+
eyebrow: plan === 'agent-plan' ? 'AGENT PLAN' : 'CODING PLAN',
|
|
1281
|
+
title: plan === 'agent-plan' ? 'Agent 套餐' : '编程套餐',
|
|
1282
|
+
action: h('div', { className: 'vcp-actions' },
|
|
1283
|
+
h(StatusChip, { tone: planTone }, planState),
|
|
1284
|
+
h('label', { className: 'vcp-plan-toggle', title: '停用后保留账号选择与模型参数' },
|
|
1145
1285
|
h('input', {
|
|
1146
|
-
type: 'checkbox', checked: providerEnabled, disabled,
|
|
1286
|
+
className: 'vcp-switch-input', type: 'checkbox', checked: providerEnabled, disabled,
|
|
1147
1287
|
'aria-label': `启用${PLAN_TITLES[plan]}`,
|
|
1148
|
-
style: { width: 18, height: 18, margin: 0, accentColor: 'var(--dsw-alias-brand-primary, Highlight)' },
|
|
1149
1288
|
onChange: (event) => onToggleProvider(plan, Boolean(event.target.checked))
|
|
1150
1289
|
}),
|
|
1151
|
-
h('span', null, '
|
|
1152
|
-
|
|
1153
|
-
|
|
1290
|
+
h('span', null, '启用')))
|
|
1291
|
+
}),
|
|
1292
|
+
snapshot?.routingError ? h('p', { style: style.muted }, `所选账号:${account ? accountName(account) : '未选择'}`) : null,
|
|
1293
|
+
snapshot?.routingError ? h(Notice, { tone: 'warn', role: 'alert' }, appliedAccount === undefined
|
|
1294
|
+
? '实际生效账号暂不可确认,请排除路由错误后重试。'
|
|
1295
|
+
: appliedAccount ? `实际生效账号:${accountName(appliedAccount)}(${appliedAccount.id}),路由更新尚未完成。` : '该套餐当前没有已生效的模型路由。') : null,
|
|
1296
|
+
h('div', { className: 'vcp-plan-setup' },
|
|
1297
|
+
h('label', { className: 'vcp-plan-account', style: style.field },
|
|
1154
1298
|
h('span', { style: style.label }, '使用账号'),
|
|
1155
1299
|
h('select', {
|
|
1156
1300
|
className: 'vcp-select', style: style.input,
|
|
1157
1301
|
value: activeId ?? '',
|
|
1158
1302
|
'aria-label': `${PLAN_TITLES[plan]}使用账号`,
|
|
1159
|
-
disabled
|
|
1303
|
+
disabled,
|
|
1160
1304
|
onChange: (event) => onSelect(plan, event.target.value || null)
|
|
1161
1305
|
},
|
|
1162
1306
|
h('option', { value: '' }, '未选择'),
|
|
1163
1307
|
accounts.map((item) => h('option', { key: item.id, value: item.id }, `${accountName(item)}${item.label && item.label !== accountName(item) ? ` · 备注:${item.label}` : ''}(${item.id})`)))),
|
|
1164
|
-
),
|
|
1308
|
+
!providerEnabled ? h('p', { className: 'vcp-plan-note', style: style.muted }, '路由已停用;账号选择与模型参数保留。') : null),
|
|
1165
1309
|
!account ? h('p', { style: style.muted }, '该套餐尚未选择账号,请选择已登录的账号。') : null,
|
|
1166
1310
|
account && auth.oauth && !auth.bound
|
|
1167
|
-
? h(Notice, { tone: 'warn' }, '
|
|
1311
|
+
? h(Notice, { tone: 'warn' }, '此账号尚未绑定该套餐,暂不能拉取模型或查询额度。请先确认已订阅此个人套餐,再到账号管理区重新网页登录更新绑定。')
|
|
1168
1312
|
: null,
|
|
1169
1313
|
account && !auth.oauth && !auth.inference
|
|
1170
1314
|
? h(Notice, { tone: 'warn' }, '该账号尚未配置此套餐的推理凭据,请在账号高级配置中填写引用名,或使用网页登录。')
|
|
1171
1315
|
: 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]}额度` },
|
|
1316
|
+
h('section', { className: 'vcp-quota-section', 'aria-busy': Boolean(quotaBusy), 'aria-label': `${PLAN_TITLES[plan]}额度` },
|
|
1182
1317
|
h('div', { className: 'vcp-heading' },
|
|
1183
1318
|
h('h4', { style: { margin: 0, fontSize: 13, fontWeight: 650 } }, '套餐额度'),
|
|
1184
1319
|
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 +1321,10 @@ function PlanCard({ plan, snapshot, rawQuota, busy, quotaBusy, onSelect, onModel
|
|
|
1186
1321
|
? h('p', { style: style.warn }, auth.oauth ? '该套餐的登录身份暂不可查询额度,请重新登录后重试。' : '该账号缺少 AK/SK 凭据引用,额度窗口无法查询。')
|
|
1187
1322
|
: null,
|
|
1188
1323
|
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
1324
|
!account ? h('p', { style: style.muted }, '请先登录或添加账号,再为此套餐选择账号。')
|
|
1191
1325
|
: !quota && !auth.quota ? h('p', { style: style.muted }, '完成此套餐的登录绑定或额度鉴权配置后,即可查询额度。')
|
|
1192
|
-
: h(QuotaWindows, { quota })
|
|
1326
|
+
: h(QuotaWindows, { quota }),
|
|
1327
|
+
quota?.updatedAt ? h('p', { style: style.muted }, `额度更新时间:${formatTime(quota.updatedAt)}`) : null),
|
|
1193
1328
|
h('section', { className: 'vcp-section', 'aria-label': `${PLAN_TITLES[plan]}模型目录` },
|
|
1194
1329
|
h('div', { className: 'vcp-heading' },
|
|
1195
1330
|
h('div', { className: 'vcp-heading-copy' },
|
|
@@ -1210,10 +1345,10 @@ function PlanCard({ plan, snapshot, rawQuota, busy, quotaBusy, onSelect, onModel
|
|
|
1210
1345
|
setModelsOpen((previous) => !previous);
|
|
1211
1346
|
}
|
|
1212
1347
|
}, `模型列表(已启用 ${enabledCount} / 共 ${models.length})`),
|
|
1213
|
-
h('div', {
|
|
1348
|
+
h('div', { className: 'vcp-model-list' },
|
|
1214
1349
|
models.map((model, index) => h(ModelRow, {
|
|
1215
1350
|
key: model?.id ?? `model-${index}`,
|
|
1216
|
-
model, disabled, routingError: snapshot?.routingError, editor, draftError,
|
|
1351
|
+
plan, model, disabled, routingError: snapshot?.routingError, editor, draftError,
|
|
1217
1352
|
onToggle: (item, enabled) => onToggleModel(plan, activeId, item.id, enabled),
|
|
1218
1353
|
onOpenEditor: openEditor,
|
|
1219
1354
|
onCloseEditor: closeEditor,
|
|
@@ -1223,7 +1358,16 @@ function PlanCard({ plan, snapshot, rawQuota, busy, quotaBusy, onSelect, onModel
|
|
|
1223
1358
|
}))))
|
|
1224
1359
|
: h('p', { style: style.muted }, catalog
|
|
1225
1360
|
? '该目录暂无模型明细(旧缓存可能没有模型列表,重新拉取模型后可用)。'
|
|
1226
|
-
: !account ? '选择账号后显示该套餐的模型目录。' : '模型目录:尚未拉取。'))
|
|
1361
|
+
: !account ? '选择账号后显示该套餐的模型目录。' : '模型目录:尚未拉取。')),
|
|
1362
|
+
h('details', { className: 'vcp-details' },
|
|
1363
|
+
h('summary', { style: style.summary }, '套餐高级信息与技术标识'),
|
|
1364
|
+
h('div', { className: 'vcp-details-body' },
|
|
1365
|
+
h('p', { style: style.muted }, PLAN_HINTS[plan]),
|
|
1366
|
+
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,
|
|
1367
|
+
account ? h('p', { style: style.muted }, `本地账号 ID:${account.id}${auth.oauth && auth.bound ? ` · 套餐 Profile:${account.oauthProfiles[plan]}` : ''}`) : null,
|
|
1368
|
+
route ? h('p', { style: style.muted }, `模型路由:${route}`) : null,
|
|
1369
|
+
catalog ? h('p', { style: style.muted }, `模型目录:${catalog.count} 个模型(来源 ${CATALOG_SOURCE_LABELS[catalog.source] ?? catalog.source}${catalog.updatedAt ? `,更新于 ${formatTime(catalog.updatedAt)}` : ''})。`) : null,
|
|
1370
|
+
h('p', { style: style.muted }, '能力参数采用插件固化快照;拉取只更新可用模型清单,手动覆盖优先。')))
|
|
1227
1371
|
);
|
|
1228
1372
|
}
|
|
1229
1373
|
|
|
@@ -1247,9 +1391,9 @@ function AccountPanel({ snapshot, editor, confirmDelete, loginConfirm, login, bu
|
|
|
1247
1391
|
const loginAccount = accounts.find((item) => item?.id === login.accountId) ?? null;
|
|
1248
1392
|
const authMode = loginAccount?.authMode ?? login.authMode ?? null;
|
|
1249
1393
|
|
|
1250
|
-
return h('section', { className: 'vcp-card', style: style.card, 'aria-label': '账号管理' },
|
|
1394
|
+
return h('section', { className: 'vcp-card vcp-account-panel', style: style.card, 'data-section': '01', 'aria-label': '账号管理' },
|
|
1251
1395
|
h(SectionHeading, {
|
|
1252
|
-
|
|
1396
|
+
title: '账号与登录',
|
|
1253
1397
|
action: h('span', { style: style.chip }, `${accounts.length} 个账号`)
|
|
1254
1398
|
}),
|
|
1255
1399
|
h('details', { className: 'vcp-accounts-disclosure', open: mustShowAccounts || accountsOpen },
|
|
@@ -1299,7 +1443,7 @@ function AccountPanel({ snapshot, editor, confirmDelete, loginConfirm, login, bu
|
|
|
1299
1443
|
? h('button', { type: 'button', style: style.btn, disabled: disabled, onClick: onCancelDelete }, '取消')
|
|
1300
1444
|
: null),
|
|
1301
1445
|
loginConfirm === account.id
|
|
1302
|
-
? h('div', { className: 'vcp-
|
|
1446
|
+
? h('div', { className: 'vcp-confirm' },
|
|
1303
1447
|
h('div', { style: { fontWeight: 650, fontSize: 13 } }, `开始网页登录:${accountName(account)}`),
|
|
1304
1448
|
h('ul', { style: { margin: 0, paddingLeft: 18, display: 'flex', flexDirection: 'column', gap: 6 } },
|
|
1305
1449
|
LOGIN_CONFIRM_NOTES.map((note, index) => h('li', { key: index, style: style.muted }, note))),
|
|
@@ -1307,7 +1451,7 @@ function AccountPanel({ snapshot, editor, confirmDelete, loginConfirm, login, bu
|
|
|
1307
1451
|
h('button', { type: 'button', style: style.primary, disabled: disabled, onClick: () => onConfirmLogin(account.id) }, '确认并打开官方登录页'),
|
|
1308
1452
|
h('button', { type: 'button', style: style.btn, disabled: disabled, onClick: onCancelLoginConfirm }, '取消')))
|
|
1309
1453
|
: null)))
|
|
1310
|
-
: h('div', { className: 'vcp-
|
|
1454
|
+
: h('div', { className: 'vcp-empty' },
|
|
1311
1455
|
h('p', { style: style.muted }, '还没有账号。可直接网页登录,确认后会自动创建本地账号,无需填写账号 ID 或密钥引用。'),
|
|
1312
1456
|
h('div', { className: 'vcp-actions' },
|
|
1313
1457
|
h('button', { type: 'button', style: style.primary, disabled: disabled || loginActive, onClick: () => onRequestLogin(NEW_LOGIN_ACCOUNT) }, '网页登录')),
|
|
@@ -1321,7 +1465,7 @@ function AccountPanel({ snapshot, editor, confirmDelete, loginConfirm, login, bu
|
|
|
1321
1465
|
h('div', { className: 'vcp-actions' },
|
|
1322
1466
|
accounts.length ? h('button', { type: 'button', style: style.primary, disabled: disabled || loginActive, onClick: () => onRequestLogin(NEW_LOGIN_ACCOUNT) }, '登录其他账号') : null,
|
|
1323
1467
|
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-
|
|
1468
|
+
accounts.length > 0 && loginConfirm === NEW_LOGIN_ACCOUNT ? h('div', { className: 'vcp-confirm' },
|
|
1325
1469
|
h('strong', null, '创建独立账号并网页登录'),
|
|
1326
1470
|
h('p', { style: style.muted }, '使用新的本地账号保存登录结果,不覆盖已有账号或更改当前套餐选择。请在独立 Chrome 窗口的官方页面确认实际授权身份。'),
|
|
1327
1471
|
h('ul', { style: { margin: 0, paddingLeft: 18 } }, LOGIN_CONFIRM_NOTES.map((note, index) => h('li', { key: index, style: style.muted }, note))),
|
|
@@ -1332,7 +1476,7 @@ function AccountPanel({ snapshot, editor, confirmDelete, loginConfirm, login, bu
|
|
|
1332
1476
|
login.state === 'idle' && !login.message && !loginUrl ? null
|
|
1333
1477
|
: login.state === 'success' && !loginUrl
|
|
1334
1478
|
? 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 },
|
|
1479
|
+
: h('div', { className: 'vcp-login-status', role: loginActive ? 'status' : undefined },
|
|
1336
1480
|
h('div', { style: { fontWeight: 650, fontSize: 13 } }, '网页登录状态'),
|
|
1337
1481
|
loginAccount ? h('p', { style: style.muted }, `当前登录账号:${accountName(loginAccount)}(${loginAccount.id})`) : null,
|
|
1338
1482
|
authMode ? h('p', { style: style.muted }, `凭据来源:${AUTH_MODE_LABELS[authMode] ?? authMode}`) : null,
|
|
@@ -1370,7 +1514,7 @@ function AccountForm({ editor, busy, onChangeDraft, onSave, onCancel }) {
|
|
|
1370
1514
|
placeholder, autoComplete: 'off', spellCheck: false,
|
|
1371
1515
|
onChange: (event) => onChangeDraft({ apiKeyRefs: { [plan]: event.target.value } })
|
|
1372
1516
|
}));
|
|
1373
|
-
return h('div', { className: 'vcp-
|
|
1517
|
+
return h('div', { className: 'vcp-editor' },
|
|
1374
1518
|
h('div', { style: { fontWeight: 650, fontSize: 13 } }, editor.mode === 'edit' ? `编辑账号:${editor.id}` : '新增账号'),
|
|
1375
1519
|
h('div', { className: 'vcp-fields' },
|
|
1376
1520
|
field('账号 ID(小写字母开头)', 'id', 'default'),
|
|
@@ -1762,31 +1906,41 @@ function VolcengineProviderSection({ client }) {
|
|
|
1762
1906
|
: snapshot ? `${snapshot.accounts?.length ?? 0} 个账号 · 2 个套餐` : '等待连接';
|
|
1763
1907
|
|
|
1764
1908
|
return h('div', { className: 'vcp-settings', style: style.root },
|
|
1765
|
-
h('header', { className: 'vcp-header' },
|
|
1909
|
+
h('header', { className: 'vcp-header vcp-hero' },
|
|
1910
|
+
h('div', { className: 'vcp-brand-mark', 'aria-hidden': 'true' }, '火'),
|
|
1766
1911
|
h('div', { className: 'vcp-header-copy' },
|
|
1767
|
-
h('div', { className: 'vcp-eyebrow' }, 'MODEL PROVIDER'),
|
|
1768
1912
|
h('h2', { style: style.title }, '火山方舟 Provider'),
|
|
1769
|
-
h('p', {
|
|
1913
|
+
h('p', { className: 'vcp-hero-subtitle' }, '国内个人版 Agent Plan 与 Coding Plan,集中管理账号、模型与套餐额度。')),
|
|
1770
1914
|
h('div', { className: 'vcp-actions' },
|
|
1771
1915
|
h('span', { role: 'status', style: style.chip }, headerStatus),
|
|
1772
1916
|
h('button', { type: 'button', style: style.btn, disabled: busyAccount || loading, onClick: () => { void refresh(); } }, loading ? '正在刷新状态…' : '刷新状态'))),
|
|
1773
1917
|
loading && snapshot ? h(Notice, { role: 'status' }, '正在更新账号与套餐状态…') : null,
|
|
1774
1918
|
busy ? h(Notice, { role: 'status' }, h('span', { 'aria-live': 'polite' }, busyMessage(busy))) : null,
|
|
1775
1919
|
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,
|
|
1920
|
+
loadError ? h(Notice, { tone: 'error', role: 'alert', action: h('button', { type: 'button', style: style.btn, disabled: busyAccount || loading, onClick: () => { void refresh(); } }, '重试读取状态') }, `读取状态失败:${loadError}`) : null,
|
|
1779
1921
|
snapshot?.routingError ? h(Notice, { tone: 'error', role: 'alert' }, describeError(snapshot.routingError)) : null,
|
|
1780
1922
|
notice
|
|
1781
|
-
? h(
|
|
1782
|
-
|
|
1783
|
-
notice.refresh
|
|
1784
|
-
|
|
1785
|
-
: null)
|
|
1923
|
+
? h(Notice, {
|
|
1924
|
+
tone: notice.ok ? 'success' : 'error', role: notice.ok ? 'status' : 'alert',
|
|
1925
|
+
action: notice.refresh ? h('button', { type: 'button', style: style.btn, disabled: busyAccount, onClick: () => { setNotice(null); void refresh(); } }, '刷新') : null
|
|
1926
|
+
}, notice.text)
|
|
1786
1927
|
: null,
|
|
1787
1928
|
!snapshot
|
|
1788
1929
|
? (loading ? h('p', { role: 'status', style: style.muted }, '正在读取方舟账号状态…') : null)
|
|
1789
|
-
: h('div', { className: 'vcp-content' },
|
|
1930
|
+
: h('div', { className: 'vcp-content', 'data-empty': !(snapshot.accounts?.length) },
|
|
1931
|
+
h('div', { className: 'vcp-plans vcp-plan-workspace' },
|
|
1932
|
+
h(PlanCard, {
|
|
1933
|
+
plan: 'agent-plan', snapshot, rawQuota: quotas['agent-plan'], busy: planBusy, quotaBusy: Boolean(quotaBusy['agent-plan']),
|
|
1934
|
+
onSelect: selectAccount, onModels: pullModels, onQuota: pullQuota,
|
|
1935
|
+
onToggleProvider: toggleProvider, onToggleModel: toggleModel,
|
|
1936
|
+
onSaveModelSettings: saveModelSettings, onResetModelSettings: resetModelSettings
|
|
1937
|
+
}),
|
|
1938
|
+
h(PlanCard, {
|
|
1939
|
+
plan: 'coding-plan', snapshot, rawQuota: quotas['coding-plan'], busy: planBusy, quotaBusy: Boolean(quotaBusy['coding-plan']),
|
|
1940
|
+
onSelect: selectAccount, onModels: pullModels, onQuota: pullQuota,
|
|
1941
|
+
onToggleProvider: toggleProvider, onToggleModel: toggleModel,
|
|
1942
|
+
onSaveModelSettings: saveModelSettings, onResetModelSettings: resetModelSettings
|
|
1943
|
+
})),
|
|
1790
1944
|
h(AccountPanel, {
|
|
1791
1945
|
snapshot, editor, confirmDelete, loginConfirm, login, busy,
|
|
1792
1946
|
onNew: openNew, onEdit: openEdit, onCancelEdit: () => setEditor(null),
|
|
@@ -1799,20 +1953,7 @@ function VolcengineProviderSection({ client }) {
|
|
|
1799
1953
|
onConfirmLogin: confirmLogin,
|
|
1800
1954
|
onCancelLoginConfirm: () => setLoginConfirm(null),
|
|
1801
1955
|
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
|
-
}))));
|
|
1956
|
+
})));
|
|
1816
1957
|
}
|
|
1817
1958
|
|
|
1818
1959
|
// ── 插件装配 ─────────────────────────────────────────────────────────────────
|