dsh-volcengine-provider 0.2.7 → 0.2.10
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 -3
- package/docs/arkcli-contract.md +3 -1
- package/docs/changelog.md +21 -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 +76 -21
- package/docs/model-management.md +6 -2
- package/docs/model-thinking-audit.md +54 -9
- package/docs/usage.md +10 -1
- package/docs/validation.md +25 -2
- package/lib/ark-adapter.mjs +26 -5
- package/lib/browser-bridge/win32/rundll32.exe +0 -0
- package/lib/catalog-snapshot.json +20 -16
- package/lib/catalog.mjs +143 -23
- package/lib/client.js +156 -34
- package/lib/consumption-rates.json +86 -0
- package/lib/manager.mjs +8 -5
- package/lib/messages-payload.mjs +15 -3
- package/lib/state.mjs +9 -1
- package/package.json +6 -6
package/lib/client.js
CHANGED
|
@@ -264,6 +264,22 @@ body[data-ds-dark-theme] .vcp-settings{color-scheme:dark}
|
|
|
264
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
265
|
@container vcp (max-width:680px){.vcp-fields,.vcp-fields-three{grid-template-columns:1fr}}
|
|
266
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}}
|
|
267
283
|
`;
|
|
268
284
|
|
|
269
285
|
function installStyles() {
|
|
@@ -302,6 +318,30 @@ function StatusChip({ tone = 'muted', children }) {
|
|
|
302
318
|
return h('span', { className: 'vcp-status-chip', 'data-tone': tone }, children);
|
|
303
319
|
}
|
|
304
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);
|
|
343
|
+
}
|
|
344
|
+
|
|
305
345
|
// ── 纯函数小工具 ─────────────────────────────────────────────────────────────
|
|
306
346
|
|
|
307
347
|
/**
|
|
@@ -421,6 +461,19 @@ function formatPercent(value) {
|
|
|
421
461
|
return Number.isFinite(rounded) ? String(rounded) : '0';
|
|
422
462
|
}
|
|
423
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
|
+
|
|
424
477
|
/**
|
|
425
478
|
* 归一化登录状态。
|
|
426
479
|
*
|
|
@@ -614,6 +667,8 @@ function describeModelSettings(model) {
|
|
|
614
667
|
if (Number.isFinite(settings.contextWindow)) parts.push(`上下文长度 ${settings.contextWindow}`);
|
|
615
668
|
if (Number.isFinite(settings.maxTokens)) parts.push(`最大输出 ${settings.maxTokens}`);
|
|
616
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 ? '启用' : '禁用'}`);
|
|
617
672
|
if (Object.hasOwn(settings, 'reasoningEfforts')) parts.push(`思考档位 ${effortSummary(settings.reasoningEfforts)}`);
|
|
618
673
|
if (Object.hasOwn(settings, 'defaultReasoning')) parts.push(`默认档位 ${settings.defaultReasoning === null ? '不强制' : String(settings.defaultReasoning)}`);
|
|
619
674
|
if (Object.hasOwn(settings, 'forceAdaptiveThinking')) parts.push(settings.forceAdaptiveThinking ? '原生 effort 模式' : '固定预算模式');
|
|
@@ -633,6 +688,8 @@ function describeEffective(model) {
|
|
|
633
688
|
if (Number.isFinite(effective.contextWindow)) parts.push(`上下文长度 ${effective.contextWindow}`);
|
|
634
689
|
if (Number.isFinite(effective.maxTokens)) parts.push(`最大输出 ${effective.maxTokens}`);
|
|
635
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 ? '启用' : '禁用'}`);
|
|
636
693
|
if (Object.hasOwn(effective, 'reasoningEfforts')) parts.push(`思考档位 ${effortSummary(effective.reasoningEfforts)}`);
|
|
637
694
|
if (Object.hasOwn(effective, 'defaultReasoning')) parts.push(`默认档位 ${effective.defaultReasoning === null ? '不强制' : String(effective.defaultReasoning)}`);
|
|
638
695
|
if (effective.reasoningEfforts === false) parts.push('思考控制按模型默认');
|
|
@@ -670,6 +727,8 @@ function modelDraftFrom(model) {
|
|
|
670
727
|
contextWindow: settings.contextWindow === undefined ? '' : String(settings.contextWindow),
|
|
671
728
|
maxTokens: settings.maxTokens === undefined ? '' : String(settings.maxTokens),
|
|
672
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',
|
|
673
732
|
effortsMode,
|
|
674
733
|
effortsText,
|
|
675
734
|
defaultReasoning,
|
|
@@ -746,6 +805,12 @@ function parseModelSettings(draft, model) {
|
|
|
746
805
|
else settings.temperature = value;
|
|
747
806
|
}
|
|
748
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
|
+
|
|
749
814
|
const effortsMode = draft?.effortsMode ?? 'inherit';
|
|
750
815
|
// 生效中的档位映射:自定义映射用草稿里的值,继承时用目录里的有效值。
|
|
751
816
|
let effortsMap = null;
|
|
@@ -953,6 +1018,30 @@ function ModelSettingsEditor({ model, draft, error, disabled, onChange, onSave,
|
|
|
953
1018
|
'aria-label': label, placeholder: '留空表示继承目录默认', autoComplete: 'off', spellCheck: false,
|
|
954
1019
|
onChange: (event) => onChange({ [key]: event.target.value })
|
|
955
1020
|
}));
|
|
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));
|
|
956
1045
|
return h('div', { className: 'vcp-editor' },
|
|
957
1046
|
h('div', { style: { fontWeight: 650, fontSize: 13 } }, `模型参数:${model?.name || model?.id}`),
|
|
958
1047
|
h('div', { className: 'vcp-fields vcp-fields-three' },
|
|
@@ -960,6 +1049,29 @@ function ModelSettingsEditor({ model, draft, error, disabled, onChange, onSave,
|
|
|
960
1049
|
numberField('maxTokens', MODEL_FIELD_LABELS.maxTokens),
|
|
961
1050
|
numberField('temperature', MODEL_FIELD_LABELS.temperature)),
|
|
962
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 通道暂不可用,不提供配置开关。')),
|
|
963
1075
|
h('label', { style: stackedField },
|
|
964
1076
|
h('span', { style: style.label }, '思考档位映射 reasoningEfforts'),
|
|
965
1077
|
h('select', {
|
|
@@ -1017,36 +1129,43 @@ function ModelSettingsEditor({ model, draft, error, disabled, onChange, onSave,
|
|
|
1017
1129
|
* @param {object} props 组件属性
|
|
1018
1130
|
* @returns {object} 元素树
|
|
1019
1131
|
*/
|
|
1020
|
-
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 }) {
|
|
1021
1133
|
const enabled = model?.enabled !== false;
|
|
1022
1134
|
const editing = editor?.modelId === model?.id;
|
|
1023
|
-
const
|
|
1135
|
+
const effectiveSummary = describeEffective(model);
|
|
1136
|
+
const values = model?.effective ?? model?.defaults ?? {};
|
|
1024
1137
|
const capabilityLabel = ({ dynamic: '动态路由', partial: '部分参数未公开', unknown: '参数待确认' })[model?.capabilityStatus]
|
|
1025
1138
|
|| (model?.capabilityUnverified ? '参数待确认' : '');
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
h('span', { className: 'vcp-model-name', title: model?.id }, model?.name || model?.id)
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
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 ? '恢复默认' : '恢复默认并启用')),
|
|
1044
1163
|
h('details', { className: 'vcp-details' },
|
|
1045
1164
|
h('summary', { style: style.summary }, '模型技术标识与参数详情'),
|
|
1046
1165
|
h('div', { className: 'vcp-model-meta' },
|
|
1047
1166
|
h('p', { className: 'vcp-model-id', style: style.muted }, `调用 ID:${model?.id ?? ''}`),
|
|
1048
1167
|
h('p', { style: style.muted }, `当前参数:${describeModelSettings(model)}`),
|
|
1049
|
-
|
|
1168
|
+
effectiveSummary ? h('p', { style: routingError ? style.warn : style.muted }, `${routingError ? '已保存配置(路由尚未生效)' : '生效值'}:${effectiveSummary}`) : null,
|
|
1050
1169
|
model?.capabilityNote ? h('p', { style: style.muted }, model.capabilityNote) : null)),
|
|
1051
1170
|
model?.settingsWarning ? h('p', { role: 'alert', style: style.warn }, model.settingsWarning) : null,
|
|
1052
1171
|
editing
|
|
@@ -1158,22 +1277,23 @@ function PlanCard({ plan, snapshot, rawQuota, busy, quotaBusy, onSelect, onModel
|
|
|
1158
1277
|
|
|
1159
1278
|
return h('section', { className: 'vcp-plan vcp-card', 'data-section': plan === 'agent-plan' ? '02' : '03', 'aria-label': PLAN_TITLES[plan] },
|
|
1160
1279
|
h(SectionHeading, {
|
|
1280
|
+
eyebrow: plan === 'agent-plan' ? 'AGENT PLAN' : 'CODING PLAN',
|
|
1161
1281
|
title: plan === 'agent-plan' ? 'Agent 套餐' : '编程套餐',
|
|
1162
|
-
action: h(
|
|
1282
|
+
action: h('div', { className: 'vcp-actions' },
|
|
1283
|
+
h(StatusChip, { tone: planTone }, planState),
|
|
1284
|
+
h('label', { className: 'vcp-plan-toggle', title: '停用后保留账号选择与模型参数' },
|
|
1285
|
+
h('input', {
|
|
1286
|
+
className: 'vcp-switch-input', type: 'checkbox', checked: providerEnabled, disabled,
|
|
1287
|
+
'aria-label': `启用${PLAN_TITLES[plan]}`,
|
|
1288
|
+
onChange: (event) => onToggleProvider(plan, Boolean(event.target.checked))
|
|
1289
|
+
}),
|
|
1290
|
+
h('span', null, '启用')))
|
|
1163
1291
|
}),
|
|
1164
1292
|
snapshot?.routingError ? h('p', { style: style.muted }, `所选账号:${account ? accountName(account) : '未选择'}`) : null,
|
|
1165
1293
|
snapshot?.routingError ? h(Notice, { tone: 'warn', role: 'alert' }, appliedAccount === undefined
|
|
1166
1294
|
? '实际生效账号暂不可确认,请排除路由错误后重试。'
|
|
1167
1295
|
: appliedAccount ? `实际生效账号:${accountName(appliedAccount)}(${appliedAccount.id}),路由更新尚未完成。` : '该套餐当前没有已生效的模型路由。') : null,
|
|
1168
1296
|
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
1297
|
h('label', { className: 'vcp-plan-account', style: style.field },
|
|
1178
1298
|
h('span', { style: style.label }, '使用账号'),
|
|
1179
1299
|
h('select', {
|
|
@@ -1228,7 +1348,7 @@ function PlanCard({ plan, snapshot, rawQuota, busy, quotaBusy, onSelect, onModel
|
|
|
1228
1348
|
h('div', { className: 'vcp-model-list' },
|
|
1229
1349
|
models.map((model, index) => h(ModelRow, {
|
|
1230
1350
|
key: model?.id ?? `model-${index}`,
|
|
1231
|
-
model, disabled, routingError: snapshot?.routingError, editor, draftError,
|
|
1351
|
+
plan, model, disabled, routingError: snapshot?.routingError, editor, draftError,
|
|
1232
1352
|
onToggle: (item, enabled) => onToggleModel(plan, activeId, item.id, enabled),
|
|
1233
1353
|
onOpenEditor: openEditor,
|
|
1234
1354
|
onCloseEditor: closeEditor,
|
|
@@ -1786,9 +1906,11 @@ function VolcengineProviderSection({ client }) {
|
|
|
1786
1906
|
: snapshot ? `${snapshot.accounts?.length ?? 0} 个账号 · 2 个套餐` : '等待连接';
|
|
1787
1907
|
|
|
1788
1908
|
return h('div', { className: 'vcp-settings', style: style.root },
|
|
1789
|
-
h('header', { className: 'vcp-header' },
|
|
1909
|
+
h('header', { className: 'vcp-header vcp-hero' },
|
|
1910
|
+
h('div', { className: 'vcp-brand-mark', 'aria-hidden': 'true' }, '火'),
|
|
1790
1911
|
h('div', { className: 'vcp-header-copy' },
|
|
1791
|
-
h('h2', { style: style.title }, '火山方舟 Provider')
|
|
1912
|
+
h('h2', { style: style.title }, '火山方舟 Provider'),
|
|
1913
|
+
h('p', { className: 'vcp-hero-subtitle' }, '国内个人版 Agent Plan 与 Coding Plan,集中管理账号、模型与套餐额度。')),
|
|
1792
1914
|
h('div', { className: 'vcp-actions' },
|
|
1793
1915
|
h('span', { role: 'status', style: style.chip }, headerStatus),
|
|
1794
1916
|
h('button', { type: 'button', style: style.btn, disabled: busyAccount || loading, onClick: () => { void refresh(); } }, loading ? '正在刷新状态…' : '刷新状态'))),
|
|
@@ -1806,7 +1928,7 @@ function VolcengineProviderSection({ client }) {
|
|
|
1806
1928
|
!snapshot
|
|
1807
1929
|
? (loading ? h('p', { role: 'status', style: style.muted }, '正在读取方舟账号状态…') : null)
|
|
1808
1930
|
: h('div', { className: 'vcp-content', 'data-empty': !(snapshot.accounts?.length) },
|
|
1809
|
-
h('div', { className: 'vcp-plans vcp-plan-workspace
|
|
1931
|
+
h('div', { className: 'vcp-plans vcp-plan-workspace' },
|
|
1810
1932
|
h(PlanCard, {
|
|
1811
1933
|
plan: 'agent-plan', snapshot, rawQuota: quotas['agent-plan'], busy: planBusy, quotaBusy: Boolean(quotaBusy['agent-plan']),
|
|
1812
1934
|
onSelect: selectAccount, onModels: pullModels, onQuota: pullQuota,
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"verifiedAt": "2026-10-30",
|
|
4
|
+
"models": {
|
|
5
|
+
"doubao-seed-evolving": {
|
|
6
|
+
"ids": ["doubao-seed-evolving"],
|
|
7
|
+
"multiplier": 2.5
|
|
8
|
+
},
|
|
9
|
+
"doubao-seed-2.1-pro": {
|
|
10
|
+
"ids": ["doubao-seed-2-1-pro-260915", "doubao-seed-2-1-pro"],
|
|
11
|
+
"multiplier": 2.5
|
|
12
|
+
},
|
|
13
|
+
"doubao-seed-2.1-lite": {
|
|
14
|
+
"ids": ["doubao-seed-2-1-lite-260915", "doubao-seed-2-1-lite"],
|
|
15
|
+
"multiplier": 0.5
|
|
16
|
+
},
|
|
17
|
+
"doubao-seed-2.0-mini": {
|
|
18
|
+
"ids": ["doubao-seed-2-0-mini-260428", "doubao-seed-2-0-mini"],
|
|
19
|
+
"multiplier": 0.25
|
|
20
|
+
},
|
|
21
|
+
"kimi-k3.1-pro": {
|
|
22
|
+
"ids": ["kimi-k3-1-pro-261024", "kimi-k3.1-pro"],
|
|
23
|
+
"multiplier": 7,
|
|
24
|
+
"discount": {
|
|
25
|
+
"multiplier": 3.5,
|
|
26
|
+
"startsAt": "2026-10-24T00:00:00+08:00",
|
|
27
|
+
"endsAt": "2026-11-09T23:59:59+08:00"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"deepseek-v4.1-flash": {
|
|
31
|
+
"ids": ["deepseek-v4-1-flash-261017", "deepseek-v4-1-flash"],
|
|
32
|
+
"multiplier": 2.5,
|
|
33
|
+
"discount": {
|
|
34
|
+
"multiplier": 1.25,
|
|
35
|
+
"startsAt": "2026-09-15T00:00:00+08:00",
|
|
36
|
+
"endsAt": "2026-12-30T23:59:59+08:00"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"deepseek-v4.1-flash-economy": {
|
|
40
|
+
"ids": ["deepseek-v4-1-flash-economy-261017", "deepseek-v4-1-flash-economy"],
|
|
41
|
+
"multiplier": 2,
|
|
42
|
+
"discount": {
|
|
43
|
+
"multiplier": 1,
|
|
44
|
+
"startsAt": "2026-10-20T00:00:00+08:00",
|
|
45
|
+
"endsAt": "2026-12-30T23:59:59+08:00"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"kimi-k2.8-preview": {
|
|
49
|
+
"ids": ["kimi-k2-8-preview"],
|
|
50
|
+
"multiplier": 8,
|
|
51
|
+
"discount": {
|
|
52
|
+
"multiplier": 4.8,
|
|
53
|
+
"startsAt": "2026-09-17T00:00:00+08:00",
|
|
54
|
+
"endsAt": "2026-12-14T23:59:59+08:00"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"glm-5.3-flash": {
|
|
58
|
+
"ids": ["glm-5-3-flash-260828", "glm-5-3-flash"],
|
|
59
|
+
"multiplier": 0.5
|
|
60
|
+
},
|
|
61
|
+
"glm-5.3": {
|
|
62
|
+
"ids": ["glm-5.3"],
|
|
63
|
+
"multiplier": 4.5
|
|
64
|
+
},
|
|
65
|
+
"deepseek-v4-pro": {
|
|
66
|
+
"ids": ["deepseek-v4-pro-ga-260813", "deepseek-v4-pro"],
|
|
67
|
+
"multiplier": 5.5
|
|
68
|
+
},
|
|
69
|
+
"deepseek-v4-flash": {
|
|
70
|
+
"ids": ["deepseek-v4-flash-ga-260731", "deepseek-v4-flash"],
|
|
71
|
+
"multiplier": 0.5
|
|
72
|
+
},
|
|
73
|
+
"kimi-k3": {
|
|
74
|
+
"ids": ["kimi-k3"],
|
|
75
|
+
"multiplier": 10
|
|
76
|
+
},
|
|
77
|
+
"kimi-k2.7-code": {
|
|
78
|
+
"ids": ["kimi-k2.7-code"],
|
|
79
|
+
"multiplier": 4.5
|
|
80
|
+
},
|
|
81
|
+
"minimax-m3": {
|
|
82
|
+
"ids": ["minimax-m3"],
|
|
83
|
+
"multiplier": 2.5
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
package/lib/manager.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { dirname, join } from 'node:path';
|
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
import { StateStore, account, assertBudgetCompatibleEfforts, assertModelId, assertPlan, normalizeModelSettings, normalizeIdentity, PLANS, ROUTES, revision } from './state.mjs';
|
|
5
|
-
import { catalogStatus, effectiveModel, getModelRows, normalizeCatalog } from './catalog.mjs';
|
|
5
|
+
import { catalogStatus, effectiveModel, getModelRows, normalizeCatalog, overrideKeys } from './catalog.mjs';
|
|
6
6
|
import { ArkCli, locateCli } from './cli.mjs';
|
|
7
7
|
import { ArkOAuth } from './oauth.mjs';
|
|
8
8
|
import { fetchUsage, parseAgentUsage, parseCodingUsage } from './quota.mjs';
|
|
@@ -270,10 +270,11 @@ export class ArkController {
|
|
|
270
270
|
} else if (op === 'setModelEnabled') {
|
|
271
271
|
assertPlan(plan); this.owner(accountId); assertModelId(request.modelId);
|
|
272
272
|
if (typeof request.enabled !== 'boolean') throw new Error('模型启用状态必须是布尔值');
|
|
273
|
-
modelRow(next, accountId, plan, request.modelId);
|
|
273
|
+
const row = modelRow(next, accountId, plan, request.modelId);
|
|
274
274
|
const key = `${accountId}:${plan}`;
|
|
275
275
|
const bucket = { ...(next.modelSettings[key] ?? {}) };
|
|
276
|
-
|
|
276
|
+
// 旧目录把设置记在历史键下;写入时带上已生效的设置,避免只保存开关就丢掉用户参数。
|
|
277
|
+
bucket[request.modelId] = { ...row.settings, enabled: request.enabled };
|
|
277
278
|
next.modelSettings[key] = bucket;
|
|
278
279
|
} else if (op === 'saveModelSettings') {
|
|
279
280
|
assertPlan(plan); this.owner(accountId); assertModelId(request.modelId);
|
|
@@ -290,7 +291,8 @@ export class ArkController {
|
|
|
290
291
|
assertBudgetCompatibleEfforts(settings.reasoningEfforts === undefined ? row.defaults.reasoningEfforts : settings.reasoningEfforts, effective.forceAdaptiveThinking);
|
|
291
292
|
const key = `${accountId}:${plan}`;
|
|
292
293
|
const bucket = { ...(next.modelSettings[key] ?? {}) };
|
|
293
|
-
|
|
294
|
+
// 同 setModelEnabled:参数整份替换时以当前生效设置为基线,含历史键里保存的值。
|
|
295
|
+
const previous = row.settings;
|
|
294
296
|
// 参数整份替换;启用开关只有显式给出时才改写。
|
|
295
297
|
const { enabled, ...parameters } = settings;
|
|
296
298
|
const kept = enabled === undefined && previous.enabled !== undefined ? { enabled: previous.enabled } : {};
|
|
@@ -300,7 +302,8 @@ export class ArkController {
|
|
|
300
302
|
assertPlan(plan); this.owner(accountId); assertModelId(request.modelId);
|
|
301
303
|
const key = `${accountId}:${plan}`;
|
|
302
304
|
const bucket = { ...(next.modelSettings[key] ?? {}) };
|
|
303
|
-
|
|
305
|
+
// 恢复默认必须同时清掉历史键,否则读取时仍会回退到旧覆盖。
|
|
306
|
+
for (const id of overrideKeys(request.modelId)) delete bucket[id];
|
|
304
307
|
if (Object.keys(bucket).length) next.modelSettings[key] = bucket; else delete next.modelSettings[key];
|
|
305
308
|
}
|
|
306
309
|
else throw new Error('未知操作');
|
package/lib/messages-payload.mjs
CHANGED
|
@@ -10,6 +10,18 @@ function withoutEffort(payload) {
|
|
|
10
10
|
return result;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* 逐模型关闭工具调用时,服务端只接受 tools 非空搭配 tool_choice:none。
|
|
15
|
+
* 没有工具声明时不发送 tool_choice,工具声明与历史保持原样。
|
|
16
|
+
*/
|
|
17
|
+
function withToolChoice(payload, toolsEnabled) {
|
|
18
|
+
if (toolsEnabled !== false) return payload;
|
|
19
|
+
const result = { ...payload };
|
|
20
|
+
if (Array.isArray(result.tools) && result.tools.length) result.tool_choice = { type: 'none' };
|
|
21
|
+
else delete result.tool_choice;
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
|
|
13
25
|
/** Normalize only request-level controls; replay blocks and signatures stay SDK-owned. */
|
|
14
26
|
export function messagesPayload(payload, control = {}) {
|
|
15
27
|
const mode = control.messagesThinkingMode ?? 'server-default';
|
|
@@ -18,7 +30,7 @@ export function messagesPayload(payload, control = {}) {
|
|
|
18
30
|
if (effort === undefined || effort === null) {
|
|
19
31
|
const result = withoutEffort(payload);
|
|
20
32
|
delete result.thinking;
|
|
21
|
-
return result;
|
|
33
|
+
return withToolChoice(result, control.toolsEnabled);
|
|
22
34
|
}
|
|
23
35
|
const mappedOff = effort === 'off' && typeof control.offWire === 'string';
|
|
24
36
|
if (effort === 'off' && !mappedOff) {
|
|
@@ -27,7 +39,7 @@ export function messagesPayload(payload, control = {}) {
|
|
|
27
39
|
error.code = 'UNSUPPORTED_REASONING_EFFORT';
|
|
28
40
|
throw error;
|
|
29
41
|
}
|
|
30
|
-
return { ...withoutEffort(payload), thinking: { type: 'disabled' } };
|
|
42
|
+
return withToolChoice({ ...withoutEffort(payload), thinking: { type: 'disabled' } }, control.toolsEnabled);
|
|
31
43
|
}
|
|
32
44
|
const result = { ...payload };
|
|
33
45
|
if (mappedOff) result.output_config = { ...payload.output_config, effort: control.offWire };
|
|
@@ -41,7 +53,7 @@ export function messagesPayload(payload, control = {}) {
|
|
|
41
53
|
// A fixed-budget override intentionally keeps the SDK's enabled + budget shape.
|
|
42
54
|
if (Object.keys(thinking).length) result.thinking = thinking;
|
|
43
55
|
else delete result.thinking;
|
|
44
|
-
return result;
|
|
56
|
+
return withToolChoice(result, control.toolsEnabled);
|
|
45
57
|
}
|
|
46
58
|
|
|
47
59
|
/** Compose the SDK callback, without replacing fetch globally or serializing history. */
|
package/lib/state.mjs
CHANGED
|
@@ -9,7 +9,9 @@ export const LABELS = { 'agent-plan': '火山方舟 · Agent 套餐', 'coding-pl
|
|
|
9
9
|
// Core(pi-ai)已声明的思考档位,模型设置只接受这些键。
|
|
10
10
|
export const CORE_THINKING_LEVELS = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
11
11
|
// 逐模型覆盖允许出现的字段;其余字段一律拒绝(含任何凭据字段)。
|
|
12
|
-
export const MODEL_SETTING_FIELDS = ['enabled', 'contextWindow', 'maxTokens', 'temperature', 'reasoningEfforts', 'defaultReasoning', 'forceAdaptiveThinking'];
|
|
12
|
+
export const MODEL_SETTING_FIELDS = ['enabled', 'contextWindow', 'maxTokens', 'temperature', 'reasoningEfforts', 'defaultReasoning', 'forceAdaptiveThinking', 'imageInput', 'toolsEnabled'];
|
|
13
|
+
// 图片输入与工具开关只接受布尔值;不给出时保持缺省,由目录默认值继承。
|
|
14
|
+
export const MODEL_SETTING_BOOLEAN_FIELDS = ['imageInput', 'toolsEnabled'];
|
|
13
15
|
// 预算模式(未开启自适应思考)下 Core 只消费档位键:xhigh/max 会被折叠为 high,映射值也不再上线。
|
|
14
16
|
export const BUDGET_THINKING_LEVELS = ['off', 'minimal', 'low', 'medium', 'high'];
|
|
15
17
|
const idPattern = /^[a-z][a-z0-9-]{0,63}$/;
|
|
@@ -113,6 +115,12 @@ export function normalizeModelSettings(input) {
|
|
|
113
115
|
if (typeof input.forceAdaptiveThinking !== 'boolean') throw new Error('forceAdaptiveThinking 必须是布尔值');
|
|
114
116
|
settings.forceAdaptiveThinking = input.forceAdaptiveThinking;
|
|
115
117
|
}
|
|
118
|
+
// 图片输入与工具开关:只接受布尔值;缺省不落盘,由目录默认值继承。
|
|
119
|
+
for (const key of MODEL_SETTING_BOOLEAN_FIELDS) {
|
|
120
|
+
if (!(key in input)) continue;
|
|
121
|
+
if (typeof input[key] !== 'boolean') throw new Error(`${key} 必须是布尔值`);
|
|
122
|
+
settings[key] = input[key];
|
|
123
|
+
}
|
|
116
124
|
if ('reasoningEfforts' in input) settings.reasoningEfforts = normalizeReasoningEfforts(input.reasoningEfforts);
|
|
117
125
|
if ('defaultReasoning' in input) {
|
|
118
126
|
const value = input.defaultReasoning;
|
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.10",
|
|
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",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
21
21
|
"@deepseek-ai/schemastery": "^3.18.4",
|
|
22
|
-
"@deepseek-ai/dsh-llm": "0.2.1-rc.
|
|
23
|
-
"@deepseek-ai/dsh-llm-pi-ai": "0.2.1-rc.
|
|
22
|
+
"@deepseek-ai/dsh-llm": "0.2.1-rc.5",
|
|
23
|
+
"@deepseek-ai/dsh-llm-pi-ai": "0.2.1-rc.5",
|
|
24
24
|
"@earendil-works/pi-ai": "1.1.0",
|
|
25
|
-
"@deepseek-ai/dsh-credentials": "0.2.1-rc.
|
|
26
|
-
"@deepseek-ai/dsh-launch-environment": "0.2.1-rc.
|
|
27
|
-
"@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.
|
|
25
|
+
"@deepseek-ai/dsh-credentials": "0.2.1-rc.5",
|
|
26
|
+
"@deepseek-ai/dsh-launch-environment": "0.2.1-rc.5",
|
|
27
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.5"
|
|
28
28
|
},
|
|
29
29
|
"dsh": {
|
|
30
30
|
"bundle": {"patch": "./cordis.patch.yml"},
|