dsh-opendesign-corouter 0.1.12 → 0.1.14
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 +1 -1
- package/lib/catalog.d.ts +6 -5
- package/lib/client.d.ts +5 -1
- package/lib/client.js +170 -51
- package/lib/config.d.ts +4 -0
- package/lib/device-auth.d.ts +1 -1
- package/lib/generated/typert.host.js +7 -1
- package/lib/generated/typert.remote-client.js +7 -1
- package/lib/image-budget.d.ts +4 -0
- package/lib/index.js +82 -36
- package/lib/index.js.map +4 -4
- package/lib/model-discovery.d.ts +1 -1
- package/lib/remote.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ dsh plugin --profile web add dsh-opendesign-corouter
|
|
|
32
32
|
也可打开 [Actions → CI](https://github.com/KouzakiUmi/dsh-opendesign-corouter/actions/workflows/ci.yml),从成功构建下载 **`dsh-opendesign-corouter-build`** artifact。登录 GitHub 后解压 ZIP,取得 `.tgz` 与 `.sha256`,再安装本地包:
|
|
33
33
|
|
|
34
34
|
```console
|
|
35
|
-
dsh plugin --profile web add /absolute/path/to/dsh-opendesign-corouter-0.1.
|
|
35
|
+
dsh plugin --profile web add /absolute/path/to/dsh-opendesign-corouter-0.1.14.tgz
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
`web` 只是示例,请替换为目标 Profile。Desktop 使用桌面安装器提供的 `dsh` 入口;独立公共 CLI 不能代管保留的 `desktop` Profile。安装后的启用与重载按目标 DSH 的管理流程进行。
|
package/lib/catalog.d.ts
CHANGED
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
* - group:官网首页套餐卡 `https://corouter.open-design.ai/zh/` 的
|
|
8
8
|
* `data-model-module="design-plan"` 12 款归 `plan`;其余在售对话模型归 `paid`。
|
|
9
9
|
* - `plan` 原有 12 款的 contextWindow / maxOutputTokens 与原模态
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* -
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* 来自同网关客户端 `dsh-opendesign-go` 0.1.9 的 MODEL_DEFAULTS;该表标为厂商资料,
|
|
11
|
+
* 不能当作网关实测上限。图片模态按最新证据单独核验。
|
|
12
|
+
* - 其余上下文窗口采用厂商公开资料或明确标注的暂定参考,逐型号来源见
|
|
13
|
+
* docs/model-context.md;CoRouter 实际限制未验证,可以通过模型设置覆盖。
|
|
14
|
+
* - `gpt-6.1-terra` 的 maxOutputTokens / inputModalities 取自厂商型号文档;
|
|
15
|
+
* 其余型号仅补充上下文参考,不新增目录最大输出能力字段。
|
|
15
16
|
* - 客户端桌面安装(Open Design 0.26.1)不内联 CoRouter 目录;其
|
|
16
17
|
* `vela model preset --format json` 只有 11 个旧预设 id(见 docs/client-evidence.md),
|
|
17
18
|
* 与本表不同代,故不用于本目录。
|
package/lib/client.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export interface FormValues {
|
|
|
30
30
|
quotaRefreshSeconds?: number;
|
|
31
31
|
requestTimeoutMs?: number;
|
|
32
32
|
streamIdleTimeoutMs?: number;
|
|
33
|
+
maxRequestImageBytes?: number;
|
|
33
34
|
}
|
|
34
35
|
export interface FormSnapshot {
|
|
35
36
|
status: 'loading' | 'ready' | 'unavailable';
|
|
@@ -122,6 +123,8 @@ export declare function modelSettingsEntry(map: ModelSettingsMap | undefined, id
|
|
|
122
123
|
export declare function modelEnabled(model: StatusModel, settings: ModelSettings | undefined, authoritative?: boolean): boolean;
|
|
123
124
|
/** Manual image policy wins; automatic mode only treats an explicit catalog image modality as confirmed. */
|
|
124
125
|
export declare function modelImageInput(model: StatusModel, settings: ModelSettings | undefined): boolean;
|
|
126
|
+
/** Enabled rows come first without changing the catalog's order within either state. */
|
|
127
|
+
export declare function sortModelsByEnabled(models: readonly StatusModel[], settingsMap: ModelSettingsMap, authoritative: boolean): StatusModel[];
|
|
125
128
|
export interface NumberInputSpec {
|
|
126
129
|
label: string;
|
|
127
130
|
min: number;
|
|
@@ -172,12 +175,13 @@ export interface ModelRowProps {
|
|
|
172
175
|
authoritative: boolean;
|
|
173
176
|
writable: boolean;
|
|
174
177
|
pending: boolean;
|
|
178
|
+
disabledReason?: string | undefined;
|
|
175
179
|
protocol?: ApiProtocol;
|
|
176
180
|
price?: PriceCatalog['models'][number] | undefined;
|
|
177
181
|
priceKnown?: boolean | undefined;
|
|
178
182
|
onCommit: (next: ModelSettings | undefined) => Promise<boolean>;
|
|
179
183
|
}
|
|
180
|
-
export declare function ModelRow({ model, settings, authoritative, writable, pending, protocol, price, priceKnown, onCommit }: ModelRowProps): React.DetailedReactHTMLElement<{
|
|
184
|
+
export declare function ModelRow({ model, settings, authoritative, writable, pending, disabledReason, protocol, price, priceKnown, onCommit }: ModelRowProps): React.DetailedReactHTMLElement<{
|
|
181
185
|
className: string;
|
|
182
186
|
}, HTMLElement>;
|
|
183
187
|
export interface ModelsProps {
|
package/lib/client.js
CHANGED
|
@@ -56,6 +56,7 @@ __export(client_exports, {
|
|
|
56
56
|
protocolEndpoint: () => protocolEndpoint,
|
|
57
57
|
quotaAutoRefresh: () => quotaAutoRefresh,
|
|
58
58
|
quotaStatusView: () => quotaStatusView,
|
|
59
|
+
sortModelsByEnabled: () => sortModelsByEnabled,
|
|
59
60
|
tabAfter: () => tabAfter,
|
|
60
61
|
writeModelSettings: () => writeModelSettings
|
|
61
62
|
});
|
|
@@ -20023,6 +20024,11 @@ function parseModelSettingsMap(value) {
|
|
|
20023
20024
|
return out;
|
|
20024
20025
|
}
|
|
20025
20026
|
|
|
20027
|
+
// src/image-budget.ts
|
|
20028
|
+
var MIN_REQUEST_IMAGE_BYTES = 1024 * 1024;
|
|
20029
|
+
var DEFAULT_MAX_REQUEST_IMAGE_BYTES = 20 * 1024 * 1024;
|
|
20030
|
+
var MAX_REQUEST_IMAGE_BYTES = 100 * 1024 * 1024;
|
|
20031
|
+
|
|
20026
20032
|
// src/remote.ts
|
|
20027
20033
|
var MAX_REVISION = 256;
|
|
20028
20034
|
var MAX_JOB_ID = 128;
|
|
@@ -20211,7 +20217,8 @@ function parseStatusConfig(value) {
|
|
|
20211
20217
|
...value.modelSettings === void 0 ? {} : { modelSettings: parseModelSettingsMap(value.modelSettings) },
|
|
20212
20218
|
...value.requestTimeoutMs === void 0 ? {} : { requestTimeoutMs: positiveInteger(value.requestTimeoutMs, "\u8BF7\u6C42\u8D85\u65F6", 36e5, 1e3) },
|
|
20213
20219
|
...value.streamIdleTimeoutMs === void 0 ? {} : { streamIdleTimeoutMs: positiveInteger(value.streamIdleTimeoutMs, "\u6D41\u7A7A\u95F2\u8D85\u65F6", 18e5, 1e3) },
|
|
20214
|
-
...value.quotaRefreshSeconds === void 0 ? {} : { quotaRefreshSeconds: positiveInteger(value.quotaRefreshSeconds, "\u81EA\u52A8\u5237\u65B0\u95F4\u9694", 3600, 5) }
|
|
20220
|
+
...value.quotaRefreshSeconds === void 0 ? {} : { quotaRefreshSeconds: positiveInteger(value.quotaRefreshSeconds, "\u81EA\u52A8\u5237\u65B0\u95F4\u9694", 3600, 5) },
|
|
20221
|
+
...value.maxRequestImageBytes === void 0 ? {} : { maxRequestImageBytes: positiveInteger(value.maxRequestImageBytes, "\u8BF7\u6C42\u56FE\u7247\u9884\u7B97", MAX_REQUEST_IMAGE_BYTES, MIN_REQUEST_IMAGE_BYTES) }
|
|
20215
20222
|
};
|
|
20216
20223
|
}
|
|
20217
20224
|
function parseStatus(value) {
|
|
@@ -20381,8 +20388,9 @@ function installStyles() {
|
|
|
20381
20388
|
.odc-notice{padding:9px 11px;border-radius:8px;background:var(--dsw-alias-bg-layer-2,transparent);font-size:12px;line-height:1.6}.odc-notice[data-kind=error]{color:var(--dsw-alias-state-error-primary,inherit);color:color-mix(in srgb,var(--dsw-alias-state-error-primary,CanvasText) 85%,var(--dsw-alias-label-primary,CanvasText))}
|
|
20382
20389
|
.odc-model-groups{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:12px}.odc-model-list{display:grid;gap:6px;margin:10px 0 0;padding:0;list-style:none}.odc-model-item{padding:9px 10px;border-radius:8px;background:var(--dsw-alias-bg-layer-2,transparent);min-width:0}.odc-model-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;flex-wrap:wrap}.odc-model-switch{min-width:0;flex:1 1 190px}.odc-model-item strong,.odc-model-item code{display:block;overflow-wrap:anywhere}.odc-model-item strong{font-size:12px;font-weight:600}.odc-model-item code{margin-top:2px;color:var(--dsw-alias-label-secondary,inherit);font-size:11px}.odc-model-meta{margin-top:6px!important;color:var(--dsw-alias-label-secondary,inherit);font-size:11px;overflow-wrap:anywhere}.odc-model-count{color:var(--dsw-alias-label-secondary,inherit);font-size:11px;font-weight:400}.odc-chip{display:inline-flex;align-items:center;padding:1px 7px;border:1px solid var(--dsw-alias-border-l3,transparent);border-radius:999px;color:var(--dsw-alias-label-secondary,inherit);font-size:10px;line-height:1.6}
|
|
20383
20390
|
.odc-model-details{margin-top:8px}.odc-model-details>summary{cursor:pointer;color:var(--dsw-alias-label-secondary,inherit);font-size:11px;line-height:1.7}.odc-model-editor{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px 10px;margin-top:8px}
|
|
20384
|
-
.odc-model-image{display:flex;align-items:center;gap:
|
|
20391
|
+
.odc-model-image{display:flex;align-items:center;gap:2px 8px;flex-wrap:wrap;margin-top:3px;min-width:0}.odc-image-toggle{display:inline-flex;align-items:center;gap:6px;flex:none;min-height:28px;padding:2px 2px 2px 0;color:var(--dsw-alias-label-primary,inherit);font-size:12px;font-weight:550;cursor:pointer}.odc-image-toggle input{appearance:auto;width:16px;height:16px;flex:none;margin:0;cursor:inherit;accent-color:var(--dsw-alias-brand-primary,Highlight)}.odc-image-toggle:has(input:disabled){cursor:not-allowed;opacity:.6}.odc-image-state{min-width:0;color:var(--dsw-alias-label-secondary,inherit);font-size:12px;line-height:1.5;overflow-wrap:anywhere}.odc-image-reset{min-height:28px;padding:2px 7px;border:1px solid var(--dsw-alias-border-l3,CanvasText);border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary,inherit);font:inherit;font-size:12px;cursor:pointer}.odc-image-reset:hover:not(:disabled){border-color:var(--dsw-alias-brand-primary,Highlight);color:var(--dsw-alias-label-primary,inherit)}.odc-image-reset:disabled{opacity:.55;cursor:not-allowed}
|
|
20385
20392
|
.odc-field{display:grid;gap:6px;margin-top:14px}.odc-field-compact{margin-top:8px}.odc-field label,.odc-switch-text{font-size:12px;font-weight:550}.odc-input{width:100%;min-width:0;min-height:34px;padding:7px 9px;border:1px solid var(--dsw-alias-border-l3,transparent);border-radius:8px;background:var(--dsw-alias-bg-layer-2,transparent);color:var(--dsw-alias-label-primary,inherit);font:inherit;font-size:12px}.odc-field-compact .odc-input{min-height:30px;padding:5px 8px;font-size:11px}.odc-input::placeholder{color:var(--dsw-alias-label-secondary,inherit);opacity:1}.odc-input:disabled{opacity:.55}
|
|
20393
|
+
.odc-effort{min-width:0}.odc-effort-head{display:flex;align-items:center;justify-content:space-between;gap:6px 10px;flex-wrap:wrap}.odc-effort-label{font-size:12px;font-weight:550}.odc-effort-value{min-width:0;margin:0;font-size:12px;overflow-wrap:anywhere}.odc-effort-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
|
|
20386
20394
|
.odc-input option{background:var(--dsw-alias-bg-layer-2,Canvas);color:var(--dsw-alias-label-primary,CanvasText)}
|
|
20387
20395
|
.odc-input,.odc-button:not(.odc-button-primary),.odc-tab[aria-selected=true]{border-color:var(--dsw-alias-border-l3,CanvasText);border-color:color-mix(in srgb,var(--dsw-alias-label-primary,CanvasText) 55%,var(--dsw-alias-bg-layer-2,Canvas))}
|
|
20388
20396
|
.odc-switch{display:flex;align-items:center;gap:12px;min-height:44px;padding:6px 2px;cursor:pointer}.odc-switch input{appearance:auto;width:20px;height:20px;flex:none;margin:0;cursor:inherit;accent-color:var(--dsw-alias-brand-primary,Highlight)}.odc-switch>span{display:grid;gap:4px;min-width:0}.odc-switch:has(input:disabled){cursor:not-allowed;opacity:.6}.odc-divider{height:1px;border:0;background:var(--dsw-alias-border-l4,transparent);margin:2px 0}.odc-link{color:var(--dsw-alias-brand-primary,inherit);text-underline-offset:3px}
|
|
@@ -20397,7 +20405,7 @@ function installStyles() {
|
|
|
20397
20405
|
.odc-quota-panel{display:grid;gap:8px;min-width:0}.odc-quota-panel>.odc-card-head{margin:0}.odc-quota-status{--odc-state:var(--odc-accent);display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px solid color-mix(in srgb,var(--odc-state) 28%,transparent);border-radius:10px;background:color-mix(in srgb,var(--odc-state) 10%,transparent);font-size:13px;font-weight:600}.odc-quota-status[data-tone=good]{--odc-state:var(--dsw-alias-state-success-primary,Highlight)}.odc-quota-status[data-tone=warn]{--odc-state:var(--dsw-alias-state-warn-primary,Highlight)}.odc-quota-status[data-tone=critical]{--odc-state:var(--dsw-alias-state-error-primary,Highlight)}.odc-state-mark{display:grid;place-items:center;width:28px;height:28px;border:1px solid color-mix(in srgb,var(--odc-state) 65%,transparent);border-radius:8px;flex:none;font-size:15px;font-weight:700}.odc-state-copy{display:grid;gap:1px;min-width:0}.odc-state-copy .odc-hint{font-weight:400}
|
|
20398
20406
|
.odc-window{--odc-window-color:var(--dsw-alias-label-secondary,CanvasText);gap:5px;margin:0;padding:10px 12px;border:0;border-radius:8px;background:color-mix(in srgb,var(--dsw-alias-label-primary,CanvasText) 5%,transparent)}.odc-window[data-tone=good]{--odc-window-color:color-mix(in srgb,var(--dsw-alias-state-success-primary,Highlight) 70%,var(--dsw-alias-label-primary,CanvasText))}.odc-window[data-tone=warn]{--odc-window-color:color-mix(in srgb,var(--dsw-alias-state-warn-primary,Highlight) 70%,var(--dsw-alias-label-primary,CanvasText))}.odc-window[data-tone=critical]{--odc-window-color:var(--dsw-alias-state-error-primary,Highlight)}.odc-window-remaining strong{font-size:18px}.odc-window progress{appearance:none;height:7px;border:0;border-radius:999px;overflow:hidden;background:color-mix(in srgb,var(--dsw-alias-label-primary,CanvasText) 18%,transparent);accent-color:var(--odc-window-color)}.odc-window progress::-webkit-progress-bar{background:color-mix(in srgb,var(--dsw-alias-label-primary,CanvasText) 18%,transparent);border-radius:999px}.odc-window progress::-webkit-progress-value{background:var(--odc-window-color);border-radius:999px}
|
|
20399
20407
|
.odc-window-usage{display:block;margin:0;color:var(--dsw-alias-label-secondary,inherit);font-size:12px;overflow-wrap:anywhere}.odc-window-bottom{display:flex;align-items:baseline;justify-content:space-between;gap:4px 12px;flex-wrap:wrap}.odc-window-reset{display:flex;align-items:baseline;justify-content:flex-start;flex-wrap:wrap;gap:4px 6px;padding:0;border:0}.odc-window-details>summary{min-height:28px;padding:4px 0}.odc-window-details[open]{flex-basis:100%}.odc-window-details dl>div{display:flex;justify-content:space-between;gap:12px}
|
|
20400
|
-
@media(forced-colors:active){.odc-window progress{appearance:auto;accent-color:Highlight;forced-color-adjust:auto}.odc-window progress::-webkit-progress-value{background:Highlight}}
|
|
20408
|
+
@media(forced-colors:active){.odc-window progress{appearance:auto;accent-color:Highlight;forced-color-adjust:auto}.odc-window progress::-webkit-progress-value{background:Highlight}.odc-image-toggle input{forced-color-adjust:auto}.odc-image-reset{border-color:ButtonText;background:ButtonFace;color:ButtonText}}
|
|
20401
20409
|
.odc-balance-list,.odc-timing{display:grid;gap:0;margin:0}.odc-balance-row,.odc-timing-row{display:flex;justify-content:space-between;align-items:baseline;gap:12px;min-width:0;min-height:0;padding:6px 0;border-top:1px solid var(--dsw-alias-border-l4,transparent)}.odc-balance-row:first-child,.odc-timing-row:first-child{border-top:0}.odc-balance-row>div,.odc-timing-row>div{min-width:0}.odc-balance-row dt,.odc-timing-row dt{font-size:12px;font-weight:600}.odc-balance-row dd,.odc-timing-row dd{margin:0;min-width:0;text-align:right}.odc-balance-row .odc-metric-value{font-size:13px}.odc-timing-row .odc-metric-text{font-size:13px;white-space:nowrap}.odc-timing-row .odc-hint{display:block}.odc-timing{padding:4px 14px}
|
|
20402
20410
|
.odc-model-item{background:transparent;border:1px solid var(--dsw-alias-border-l4,transparent)}.odc-model-item:has(details[open]){border-color:color-mix(in srgb,var(--odc-accent) 55%,transparent);background:color-mix(in srgb,var(--odc-accent) 5%,transparent)}
|
|
20403
20411
|
.odc-price-summary{margin:5px 0 0!important;font-size:12px;color:var(--dsw-alias-label-secondary,inherit);overflow-wrap:anywhere}.odc-pricing-head{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}.odc-price-tier{padding:8px 0;border-top:1px solid var(--dsw-alias-border-l4,transparent)}.odc-price-tier dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 12px;margin:6px 0 0}.odc-price-tier dl>div{display:flex;justify-content:space-between;gap:8px}.odc-price-tier dt{color:var(--dsw-alias-label-secondary,inherit)}.odc-price-tier dd{margin:0;font-variant-numeric:tabular-nums}
|
|
@@ -20779,6 +20787,9 @@ function modelImageInput(model, settings) {
|
|
|
20779
20787
|
if (settings?.imageInput !== void 0) return settings.imageInput;
|
|
20780
20788
|
return model.inputModalities === void 0 ? true : model.inputModalities.includes("image");
|
|
20781
20789
|
}
|
|
20790
|
+
function sortModelsByEnabled(models, settingsMap, authoritative) {
|
|
20791
|
+
return models.map((model, index) => ({ model, index, enabled: modelEnabled(model, settingsMap[model.id], authoritative) })).sort((a, b) => Number(b.enabled) - Number(a.enabled) || a.index - b.index).map(({ model }) => model);
|
|
20792
|
+
}
|
|
20782
20793
|
function imageInputSource(model, settings) {
|
|
20783
20794
|
if (settings.imageInput !== void 0) return settings.imageInput ? "\u624B\u52A8 \xB7 \u5F00\u542F" : "\u624B\u52A8 \xB7 \u5173\u95ED";
|
|
20784
20795
|
if (model.inputModalities === void 0) return "\u81EA\u52A8 \xB7 \u672A\u77E5\uFF0C\u5C1D\u8BD5\u53D1\u9001";
|
|
@@ -20910,40 +20921,118 @@ function OptionalNumberField({ id, field, value, disabled, restricted = false, i
|
|
|
20910
20921
|
}, error62 ?? (restricted ? field === "temperature" ? "Messages \u4EC5\u63A5\u53D7 1\uFF1B\u5EFA\u8BAE\u7559\u7A7A\uFF0C\u4E14\u52FF\u540C\u65F6\u8BBE\u7F6E Top P\u3002" : "Messages \u4EC5\u63A5\u53D7 0.99\uFF1B\u5EFA\u8BAE\u7559\u7A7A\uFF0C\u4E14\u52FF\u540C\u65F6\u8BBE\u7F6E\u6E29\u5EA6\u3002" : maxOutputLimit !== void 0 ? `Messages \u6700\u5927\u8F93\u51FA ${maxOutputLimit}\uFF1B\u7559\u7A7A\u7EE7\u627F\u9ED8\u8BA4\u3002` : spec.hint))
|
|
20911
20922
|
);
|
|
20912
20923
|
}
|
|
20913
|
-
function EffortField({ id, model, value, disabled,
|
|
20924
|
+
function EffortField({ id, model, value, disabled, pending, disabledReason, onSave }) {
|
|
20914
20925
|
const mounted = useMounted();
|
|
20926
|
+
const [editing, setEditing] = React.useState(false);
|
|
20927
|
+
const [draft, setDraft] = React.useState(value ?? "");
|
|
20928
|
+
const [baseValue, setBaseValue] = React.useState(value);
|
|
20929
|
+
const [saving, setSaving] = React.useState(false);
|
|
20915
20930
|
const [error62, setError] = React.useState(void 0);
|
|
20916
20931
|
const listed = model.reasoningEfforts ?? [];
|
|
20917
20932
|
const invalidDefault = value !== void 0 && !listed.includes(value);
|
|
20918
|
-
const
|
|
20933
|
+
const invalidDraft = editing && draft !== "" && !listed.includes(draft);
|
|
20934
|
+
const options = [...listed];
|
|
20935
|
+
for (const effort of [value, draft]) {
|
|
20936
|
+
if (effort !== void 0 && effort !== "" && !options.includes(effort)) options.push(effort);
|
|
20937
|
+
}
|
|
20919
20938
|
const unavailable = listed.length === 0;
|
|
20939
|
+
const busy = saving || pending;
|
|
20940
|
+
const reason = busy ? "\u6B63\u5728\u4FDD\u5B58\u6A21\u578B\u8BBE\u7F6E\uFF0C\u5B8C\u6210\u540E\u53EF\u7EE7\u7EED\u7F16\u8F91\u3002" : disabled ? `${disabledReason ?? "\u914D\u7F6E\u4E0D\u53EF\u5199"}\uFF0C\u65E0\u6CD5\u7F16\u8F91\u3002` : void 0;
|
|
20941
|
+
const externallyChanged = editing && value !== baseValue && !(saving && value === draft);
|
|
20942
|
+
const hint = reason ?? (editing ? externallyChanged ? "\u914D\u7F6E\u5DF2\u4ECE\u5176\u4ED6\u4F4D\u7F6E\u66F4\u65B0\uFF1B\u53D6\u6D88\u53EF\u67E5\u770B\u6700\u65B0\u503C\uFF0C\u4FDD\u5B58\u5C06\u4F7F\u7528\u5F53\u524D\u8349\u7A3F\u3002" : invalidDraft ? "\u5F53\u524D\u8349\u7A3F\u4E0D\u9002\u7528\u4E8E\u6B64\u6A21\u578B\u6216\u534F\u8BAE\uFF0C\u8BF7\u9009\u62E9\u5176\u4ED6\u6863\u4F4D\u6216\u7EE7\u627F\u9ED8\u8BA4\u3002" : "\u9009\u62E9\u201C\u7EE7\u627F\u9ED8\u8BA4\u201D\u4F1A\u5220\u9664\u5DF2\u4FDD\u5B58\u6863\u4F4D\uFF1B\u4FDD\u5B58\u524D\u4EC5\u4FEE\u6539\u672C\u5730\u8349\u7A3F\u3002" : invalidDefault ? "\u5DF2\u4FDD\u5B58\u7684\u6863\u4F4D\u4E0D\u9002\u7528\u4E8E\u5F53\u524D\u6A21\u578B\u6216\u534F\u8BAE\uFF0C\u53EF\u7F16\u8F91\u540E\u9009\u62E9\u5176\u4ED6\u6863\u4F4D\u6216\u7EE7\u627F\u9ED8\u8BA4\u3002" : unavailable ? "\u5F53\u524D\u6A21\u578B\u6216\u534F\u8BAE\u672A\u63D0\u4F9B\u53EF\u8C03\u6574\u7684\u601D\u8003\u6863\u4F4D\u3002" : "\u672A\u8BBE\u7F6E\u65F6\u4F7F\u7528\u670D\u52A1\u7AEF\u9ED8\u8BA4\u6863\u4F4D\u3002");
|
|
20943
|
+
const cancel = () => {
|
|
20944
|
+
if (saving) return;
|
|
20945
|
+
setEditing(false);
|
|
20946
|
+
setError(void 0);
|
|
20947
|
+
};
|
|
20948
|
+
const save = async () => {
|
|
20949
|
+
if (disabled || pending || saving || invalidDraft) return;
|
|
20950
|
+
if (draft === (value ?? "")) {
|
|
20951
|
+
setEditing(false);
|
|
20952
|
+
setError(void 0);
|
|
20953
|
+
return;
|
|
20954
|
+
}
|
|
20955
|
+
setSaving(true);
|
|
20956
|
+
setError(void 0);
|
|
20957
|
+
try {
|
|
20958
|
+
const saved = await onSave(draft);
|
|
20959
|
+
if (!mounted.current) return;
|
|
20960
|
+
if (saved) {
|
|
20961
|
+
setEditing(false);
|
|
20962
|
+
setError(void 0);
|
|
20963
|
+
} else setError("\u8BBE\u7F6E\u672A\u4FDD\u5B58\uFF0C\u5DF2\u4FDD\u7559\u5F53\u524D\u8349\u7A3F\uFF0C\u8BF7\u91CD\u8BD5\u3002");
|
|
20964
|
+
} catch {
|
|
20965
|
+
if (mounted.current) setError("\u8BBE\u7F6E\u672A\u4FDD\u5B58\uFF0C\u5DF2\u4FDD\u7559\u5F53\u524D\u8349\u7A3F\uFF0C\u8BF7\u91CD\u8BD5\u3002");
|
|
20966
|
+
} finally {
|
|
20967
|
+
if (mounted.current) setSaving(false);
|
|
20968
|
+
}
|
|
20969
|
+
};
|
|
20920
20970
|
return h(
|
|
20921
20971
|
"div",
|
|
20922
|
-
{
|
|
20923
|
-
|
|
20924
|
-
|
|
20925
|
-
|
|
20926
|
-
|
|
20927
|
-
|
|
20928
|
-
|
|
20929
|
-
|
|
20930
|
-
|
|
20931
|
-
|
|
20932
|
-
|
|
20933
|
-
|
|
20934
|
-
|
|
20935
|
-
|
|
20936
|
-
|
|
20937
|
-
|
|
20938
|
-
|
|
20939
|
-
|
|
20940
|
-
|
|
20941
|
-
|
|
20972
|
+
{
|
|
20973
|
+
className: "odc-field odc-field-compact odc-effort",
|
|
20974
|
+
"data-mode": editing ? "editing" : "summary",
|
|
20975
|
+
onKeyDown: (event) => {
|
|
20976
|
+
if (event.key !== "Escape" || !editing || saving) return;
|
|
20977
|
+
event.preventDefault();
|
|
20978
|
+
cancel();
|
|
20979
|
+
}
|
|
20980
|
+
},
|
|
20981
|
+
editing ? h(
|
|
20982
|
+
React.Fragment,
|
|
20983
|
+
null,
|
|
20984
|
+
h("label", { htmlFor: id }, "\u9ED8\u8BA4\u601D\u8003\u6DF1\u5EA6"),
|
|
20985
|
+
h("select", {
|
|
20986
|
+
id,
|
|
20987
|
+
className: "odc-input",
|
|
20988
|
+
value: draft,
|
|
20989
|
+
disabled: busy || disabled,
|
|
20990
|
+
"aria-describedby": `${id}-hint${error62 === void 0 ? "" : ` ${id}-error`}`,
|
|
20991
|
+
"aria-invalid": invalidDraft || error62 !== void 0,
|
|
20992
|
+
onChange: (event) => {
|
|
20993
|
+
setDraft(event.target.value);
|
|
20994
|
+
setError(void 0);
|
|
20995
|
+
}
|
|
20996
|
+
}, [
|
|
20997
|
+
h("option", { key: "", value: "" }, "\u7EE7\u627F\u9ED8\u8BA4"),
|
|
20998
|
+
...options.map((effort) => h("option", { key: effort, value: effort, disabled: !listed.includes(effort) }, listed.includes(effort) ? effort : `${effort}\uFF08\u5F53\u524D\u4E0D\u53EF\u7528\uFF09`))
|
|
20999
|
+
]),
|
|
21000
|
+
h(
|
|
21001
|
+
"div",
|
|
21002
|
+
{ className: "odc-effort-actions" },
|
|
21003
|
+
h("button", { className: "odc-button odc-button-small odc-button-primary", type: "button", disabled: busy || disabled || invalidDraft, "aria-label": "\u4FDD\u5B58\u9ED8\u8BA4\u601D\u8003\u6DF1\u5EA6", onClick: () => {
|
|
21004
|
+
void save();
|
|
21005
|
+
} }, saving ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58"),
|
|
21006
|
+
h("button", { className: "odc-button odc-button-small", type: "button", disabled: saving, "aria-label": "\u53D6\u6D88\u7F16\u8F91\u9ED8\u8BA4\u601D\u8003\u6DF1\u5EA6", onClick: cancel }, "\u53D6\u6D88")
|
|
21007
|
+
)
|
|
21008
|
+
) : h(
|
|
21009
|
+
React.Fragment,
|
|
21010
|
+
null,
|
|
21011
|
+
h(
|
|
21012
|
+
"div",
|
|
21013
|
+
{ className: "odc-effort-head" },
|
|
21014
|
+
h("span", { className: "odc-effort-label" }, "\u9ED8\u8BA4\u601D\u8003\u6DF1\u5EA6"),
|
|
21015
|
+
h("button", {
|
|
21016
|
+
className: "odc-button odc-button-small",
|
|
21017
|
+
type: "button",
|
|
21018
|
+
disabled: busy || disabled || unavailable && value === void 0,
|
|
21019
|
+
"aria-label": "\u7F16\u8F91\u9ED8\u8BA4\u601D\u8003\u6DF1\u5EA6",
|
|
21020
|
+
"aria-describedby": `${id}-hint`,
|
|
21021
|
+
onClick: () => {
|
|
21022
|
+
setDraft(value ?? "");
|
|
21023
|
+
setBaseValue(value);
|
|
21024
|
+
setError(void 0);
|
|
21025
|
+
setEditing(true);
|
|
21026
|
+
}
|
|
21027
|
+
}, "\u7F16\u8F91")
|
|
21028
|
+
),
|
|
21029
|
+
h("p", { className: "odc-effort-value" }, invalidDefault ? `${value}\uFF08\u5F53\u524D\u4E0D\u53EF\u7528\uFF09` : value ?? "\u7EE7\u627F\u9ED8\u8BA4")
|
|
21030
|
+
),
|
|
20942
21031
|
h("small", {
|
|
20943
|
-
className:
|
|
20944
|
-
id: `${id}-hint
|
|
20945
|
-
|
|
20946
|
-
|
|
21032
|
+
className: "odc-hint",
|
|
21033
|
+
id: `${id}-hint`
|
|
21034
|
+
}, hint),
|
|
21035
|
+
error62 === void 0 ? null : h("small", { className: "odc-hint odc-field-error", id: `${id}-error`, role: "alert" }, error62)
|
|
20947
21036
|
);
|
|
20948
21037
|
}
|
|
20949
21038
|
var PRICE_SITE = "https://corouter.open-design.ai/zh/models/";
|
|
@@ -20962,7 +21051,7 @@ function PriceDetails({ tiers }) {
|
|
|
20962
21051
|
h("dl", null, [["\u8F93\u5165", tier.input], ["\u8F93\u51FA", tier.output], ["\u7F13\u5B58\u8BFB\u53D6", tier.cacheRead], ["\u7F13\u5B58\u5199\u5165", tier.cacheWrite]].map(([label, value]) => h("div", { key: label }, h("dt", null, label), h("dd", null, priceAmount(value, tier.currency)))))
|
|
20963
21052
|
)));
|
|
20964
21053
|
}
|
|
20965
|
-
function ModelRow({ model, settings, authoritative, writable, pending, protocol = "chat-completions", price, priceKnown = false, onCommit }) {
|
|
21054
|
+
function ModelRow({ model, settings, authoritative, writable, pending, disabledReason, protocol = "chat-completions", price, priceKnown = false, onCommit }) {
|
|
20966
21055
|
const id = React.useId();
|
|
20967
21056
|
const mounted = useMounted();
|
|
20968
21057
|
const [error62, setError] = React.useState(void 0);
|
|
@@ -20997,7 +21086,7 @@ function ModelRow({ model, settings, authoritative, writable, pending, protocol
|
|
|
20997
21086
|
return false;
|
|
20998
21087
|
}
|
|
20999
21088
|
}
|
|
21000
|
-
const output2 = next.maxTokens
|
|
21089
|
+
const output2 = next.maxTokens;
|
|
21001
21090
|
const context = next.contextWindow ?? model.contextWindow;
|
|
21002
21091
|
if (output2 !== void 0 && context !== void 0 && output2 >= context) {
|
|
21003
21092
|
setError("\u6700\u5927\u8F93\u51FA\u5FC5\u987B\u5C0F\u4E8E\u4E0A\u4E0B\u6587\u9884\u7B97\uFF1B\u8BF7\u5148\u589E\u5927\u4E0A\u4E0B\u6587\u9884\u7B97\u6216\u51CF\u5C0F\u6700\u5927\u8F93\u51FA\u3002");
|
|
@@ -21056,19 +21145,25 @@ function ModelRow({ model, settings, authoritative, writable, pending, protocol
|
|
|
21056
21145
|
h(
|
|
21057
21146
|
"div",
|
|
21058
21147
|
{ className: "odc-model-image" },
|
|
21059
|
-
h(
|
|
21060
|
-
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
|
|
21065
|
-
|
|
21066
|
-
|
|
21067
|
-
|
|
21068
|
-
|
|
21069
|
-
|
|
21148
|
+
h(
|
|
21149
|
+
"label",
|
|
21150
|
+
{ className: "odc-image-toggle" },
|
|
21151
|
+
h("input", {
|
|
21152
|
+
type: "checkbox",
|
|
21153
|
+
checked: imageInput,
|
|
21154
|
+
disabled: !writable || pending,
|
|
21155
|
+
"aria-label": `${model.name} \u56FE\u7247\u8F93\u5165`,
|
|
21156
|
+
"aria-describedby": `${id}-image-state`,
|
|
21157
|
+
onChange: (event) => {
|
|
21158
|
+
setError(void 0);
|
|
21159
|
+
void commit({ ...settings, imageInput: event.target.checked });
|
|
21160
|
+
}
|
|
21161
|
+
}),
|
|
21162
|
+
h("span", null, "\u56FE\u7247\u8F93\u5165")
|
|
21163
|
+
),
|
|
21164
|
+
h("small", { className: "odc-image-state", id: `${id}-image-state` }, imageInputSource(model, settings) + imageDisabledReason),
|
|
21070
21165
|
imageInputManual ? h("button", {
|
|
21071
|
-
className: "odc-
|
|
21166
|
+
className: "odc-image-reset",
|
|
21072
21167
|
type: "button",
|
|
21073
21168
|
disabled: !writable || pending,
|
|
21074
21169
|
"aria-label": `${model.name} \u6062\u590D\u56FE\u7247\u8F93\u5165\u81EA\u52A8`,
|
|
@@ -21083,6 +21178,8 @@ function ModelRow({ model, settings, authoritative, writable, pending, protocol
|
|
|
21083
21178
|
{ className: "odc-model-details" },
|
|
21084
21179
|
h("summary", { "aria-label": `${model.name} \u53C2\u6570\u8BBE\u7F6E${price === void 0 ? "" : "\u4E0E\u4EF7\u683C"}` }, `${price === void 0 ? "\u53C2\u6570\u8BBE\u7F6E" : "\u53C2\u6570\u4E0E\u4EF7\u683C"} \xB7 ${hasOverrides ? "\u5DF2\u81EA\u5B9A\u4E49" : "\u4F7F\u7528\u9ED8\u8BA4\u503C"}`),
|
|
21085
21180
|
h("p", { className: "odc-model-meta" }, facts),
|
|
21181
|
+
model.id === "claude-opus-5.5" && model.contextWindow === 1e6 ? h("p", { className: "odc-hint" }, "\u4E0A\u4E0B\u6587 1,000,000 \u4E3A\u5382\u5546\u53C2\u8003\uFF0C\u7F51\u5173\u5B9E\u9645\u5BB9\u91CF\u672A\u9A8C\u8BC1\uFF1B\u53EF\u901A\u8FC7\u4E0A\u4E0B\u6587\u9884\u7B97\u8986\u76D6\u3002") : null,
|
|
21182
|
+
model.id === "muse-wonder" && model.contextWindow === 1048576 ? h("p", { className: "odc-hint" }, "\u4E0A\u4E0B\u6587 1,048,576 \u4E3A\u6682\u5B9A\u53C2\u8003\uFF0C\u7F51\u5173\u578B\u53F7\u6620\u5C04\u53CA\u5B9E\u9645\u5BB9\u91CF\u672A\u9A8C\u8BC1\uFF1B\u53EF\u901A\u8FC7\u4E0A\u4E0B\u6587\u9884\u7B97\u8986\u76D6\u3002") : null,
|
|
21086
21183
|
samplingRestricted && model.id === "claude-opus-4.8" ? h("p", { className: "odc-hint" }, "\u5382\u5546\u9ED8\u8BA4\u5173\u95ED\u601D\u8003\uFF0C\u9009\u62E9\u601D\u8003\u6DF1\u5EA6\u53EF\u542F\u7528\u81EA\u9002\u5E94\u601D\u8003\uFF1B\u7F51\u5173\u5B9E\u9645\u884C\u4E3A\u53EF\u80FD\u4E0D\u540C\u3002") : null,
|
|
21087
21184
|
samplingRestricted && model.maxOutputTokens === void 0 && settings.maxTokens === void 0 ? h("p", { className: "odc-hint" }, "Messages \u9ED8\u8BA4\u6700\u5927\u8F93\u51FA 4096\uFF1B\u8F83\u9AD8\u601D\u8003\u6DF1\u5EA6\u53EF\u80FD\u9700\u8981\u589E\u5927\u3002") : null,
|
|
21088
21185
|
price === void 0 ? null : h(PriceDetails, { tiers: price.tiers }),
|
|
@@ -21106,13 +21203,15 @@ function ModelRow({ model, settings, authoritative, writable, pending, protocol
|
|
|
21106
21203
|
id: `${id}-effort`,
|
|
21107
21204
|
model,
|
|
21108
21205
|
value: settings.reasoningEffort,
|
|
21109
|
-
disabled: !writable
|
|
21110
|
-
|
|
21206
|
+
disabled: !writable,
|
|
21207
|
+
pending,
|
|
21208
|
+
disabledReason,
|
|
21209
|
+
onSave: async (value) => {
|
|
21111
21210
|
const next = { ...settings };
|
|
21112
21211
|
if (value === "") delete next.reasoningEffort;
|
|
21113
21212
|
else next.reasoningEffort = value;
|
|
21114
21213
|
setError(void 0);
|
|
21115
|
-
return
|
|
21214
|
+
return onCommit(next);
|
|
21116
21215
|
}
|
|
21117
21216
|
})
|
|
21118
21217
|
)
|
|
@@ -21120,12 +21219,12 @@ function ModelRow({ model, settings, authoritative, writable, pending, protocol
|
|
|
21120
21219
|
error62 !== void 0 ? h("p", { className: "odc-hint odc-field-error", role: "alert" }, error62) : null
|
|
21121
21220
|
);
|
|
21122
21221
|
}
|
|
21123
|
-
function ModelGroup({ title, group, models, settingsMap, authoritative, writable, pending, protocol, onCommit, prices }) {
|
|
21222
|
+
function ModelGroup({ title, group, models, settingsMap, authoritative, writable, pending, disabledReason, protocol, onCommit, prices }) {
|
|
21124
21223
|
const [query, setQuery] = React.useState("");
|
|
21125
21224
|
const [expanded, setExpanded] = React.useState(false);
|
|
21126
21225
|
const id = React.useId();
|
|
21127
21226
|
const normalized = query.trim().toLocaleLowerCase();
|
|
21128
|
-
const groupModels = models.filter((model) => model.group === group);
|
|
21227
|
+
const groupModels = sortModelsByEnabled(models.filter((model) => model.group === group), settingsMap, authoritative);
|
|
21129
21228
|
const filtered = groupModels.filter((model) => normalized === "" || `${model.name} ${model.id}`.toLocaleLowerCase().includes(normalized));
|
|
21130
21229
|
const visible = normalized !== "" || expanded ? filtered : filtered.slice(0, 6);
|
|
21131
21230
|
const enabledCount = groupModels.filter((model) => modelEnabled(model, settingsMap[model.id], authoritative)).length;
|
|
@@ -21154,6 +21253,7 @@ function ModelGroup({ title, group, models, settingsMap, authoritative, writable
|
|
|
21154
21253
|
authoritative,
|
|
21155
21254
|
writable,
|
|
21156
21255
|
pending,
|
|
21256
|
+
disabledReason,
|
|
21157
21257
|
protocol,
|
|
21158
21258
|
price: prices?.models.find((entry) => entry.id === model.id),
|
|
21159
21259
|
priceKnown: prices !== void 0 && (prices.state !== "error" || prices.stale),
|
|
@@ -21174,6 +21274,7 @@ function Models({ status, formSnapshot, setFormField, pendingField, onRefreshMod
|
|
|
21174
21274
|
const settingsMap = formReady ? formSnapshot.value?.modelSettings ?? {} : status?.config.modelSettings ?? {};
|
|
21175
21275
|
const authoritative = formReady || status?.config.modelSettings !== void 0;
|
|
21176
21276
|
const writable = formSnapshot.status === "ready" && formSnapshot.value !== void 0 && formSnapshot.writable;
|
|
21277
|
+
const disabledReason = formSnapshot.status === "loading" ? "\u6B63\u5728\u8F7D\u5165\u914D\u7F6E" : formSnapshot.status === "unavailable" ? "\u914D\u7F6E\u6682\u4E0D\u53EF\u7528" : !formSnapshot.writable ? "\u5F53\u524D\u8BBE\u7F6E\u4E3A\u53EA\u8BFB" : "\u914D\u7F6E\u4E0D\u53EF\u5199";
|
|
21177
21278
|
const pending = pendingField.includes("modelSettings");
|
|
21178
21279
|
const latestSettings = React.useRef(settingsMap);
|
|
21179
21280
|
React.useEffect(() => {
|
|
@@ -21206,7 +21307,7 @@ function Models({ status, formSnapshot, setFormField, pendingField, onRefreshMod
|
|
|
21206
21307
|
"div",
|
|
21207
21308
|
null,
|
|
21208
21309
|
h("h3", null, "\u53EF\u7528\u6A21\u578B"),
|
|
21209
|
-
h("p", { className: "odc-hint" }, "\u6309\u5206\u7EC4\u641C\u7D22\u6A21\u578B\uFF0C\u8BBE\u7F6E\u542F\u7528\u72B6\u6001\u4E0E\u9ED8\u8BA4\u53C2\u6570\u3002")
|
|
21310
|
+
h("p", { className: "odc-hint" }, "\u6309\u5206\u7EC4\u641C\u7D22\u6A21\u578B\uFF0C\u8BBE\u7F6E\u542F\u7528\u72B6\u6001\u4E0E\u9ED8\u8BA4\u53C2\u6570\u3002\u4E0A\u4E0B\u6587\u4E3A\u53C2\u8003\u9884\u7B97\uFF1B\u5237\u65B0\u540E\u4F1A\u91C7\u7528\u7F51\u5173\u62A5\u544A\u7684\u8F83\u5C0F\u7A97\u53E3\uFF0C\u5B9E\u9645\u9650\u5236\u53EF\u80FD\u4E0D\u540C\uFF0C\u53EF\u5728\u6A21\u578B\u8BBE\u7F6E\u4E2D\u8986\u76D6\u3002")
|
|
21210
21311
|
),
|
|
21211
21312
|
h(
|
|
21212
21313
|
"div",
|
|
@@ -21239,8 +21340,8 @@ function Models({ status, formSnapshot, setFormField, pendingField, onRefreshMod
|
|
|
21239
21340
|
models.length === 0 ? h("p", { className: "odc-hint", role: "status" }, "\u6682\u65E0\u53EF\u7528\u6A21\u578B\uFF1B\u53EF\u5237\u65B0\u6A21\u578B\u5217\u8868\u540E\u91CD\u8BD5\u3002") : h(
|
|
21240
21341
|
"div",
|
|
21241
21342
|
{ className: "odc-model-groups" },
|
|
21242
|
-
h(ModelGroup, { title: "\u5957\u9910\u8D60\u9001\u6A21\u578B", group: "plan", models, settingsMap, authoritative, writable, pending, protocol, onCommit: commit, prices }),
|
|
21243
|
-
h(ModelGroup, { title: "\u4ED8\u8D39\u6A21\u578B", group: "paid", models, settingsMap, authoritative, writable, pending, protocol, onCommit: commit, prices })
|
|
21343
|
+
h(ModelGroup, { title: "\u5957\u9910\u8D60\u9001\u6A21\u578B", group: "plan", models, settingsMap, authoritative, writable, pending, disabledReason, protocol, onCommit: commit, prices }),
|
|
21344
|
+
h(ModelGroup, { title: "\u4ED8\u8D39\u6A21\u578B", group: "paid", models, settingsMap, authoritative, writable, pending, disabledReason, protocol, onCommit: commit, prices })
|
|
21244
21345
|
)
|
|
21245
21346
|
);
|
|
21246
21347
|
}
|
|
@@ -21310,6 +21411,7 @@ function Advanced({ status, formSnapshot, setFormField, pendingField }) {
|
|
|
21310
21411
|
const requestTimeout = formSnapshot.value?.requestTimeoutMs ?? status?.config.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
21311
21412
|
const streamIdleTimeout = formSnapshot.value?.streamIdleTimeoutMs ?? status?.config.streamIdleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS;
|
|
21312
21413
|
const refreshSeconds = formSnapshot.value?.quotaRefreshSeconds ?? status?.config.quotaRefreshSeconds ?? DEFAULT_QUOTA_REFRESH_SECONDS;
|
|
21414
|
+
const imageBudget = formSnapshot.value?.maxRequestImageBytes ?? status?.config.maxRequestImageBytes ?? DEFAULT_MAX_REQUEST_IMAGE_BYTES;
|
|
21313
21415
|
const selected = API_PROTOCOL_OPTIONS.find((option) => option.id === protocol);
|
|
21314
21416
|
const saveKeyRef = async () => {
|
|
21315
21417
|
const value = apiKeyEnv.trim();
|
|
@@ -21411,6 +21513,23 @@ function Advanced({ status, formSnapshot, setFormField, pendingField }) {
|
|
|
21411
21513
|
),
|
|
21412
21514
|
h(NoticeView, { notice: keyNotice })
|
|
21413
21515
|
),
|
|
21516
|
+
h(
|
|
21517
|
+
"section",
|
|
21518
|
+
{ className: "odc-card" },
|
|
21519
|
+
h("h3", null, "\u56FE\u7247\u8BF7\u6C42\u9884\u7B97"),
|
|
21520
|
+
h("p", { className: "odc-hint" }, "\u5386\u53F2\u56FE\u7247\u8D85\u51FA\u9884\u7B97\u65F6\uFF0C\u7531\u5BBF\u4E3B\u5C06\u6700\u65E7\u56FE\u7247\u66FF\u6362\u4E3A\u5360\u4F4D\u7B26\u5E76\u91CD\u8BD5\uFF1B\u539F\u9644\u4EF6\u4FDD\u7559\u3002\u6458\u8981\u8BF7\u6C42\u4E5F\u4F7F\u7528\u6B64\u9884\u7B97\u3002"),
|
|
21521
|
+
h(NumberField, {
|
|
21522
|
+
id: "odc-image-budget",
|
|
21523
|
+
label: "\u5355\u6B21\u8BF7\u6C42\u56FE\u7247\u9884\u7B97\uFF08MiB\uFF09",
|
|
21524
|
+
hint: "1\u2013100 MiB\uFF1B\u7F51\u5173\u9650\u5236\u8F83\u4F4E\u65F6\u53EF\u8C03\u5C0F\u3002",
|
|
21525
|
+
value: imageBudget / (1024 * 1024),
|
|
21526
|
+
min: MIN_REQUEST_IMAGE_BYTES / (1024 * 1024),
|
|
21527
|
+
max: MAX_REQUEST_IMAGE_BYTES / (1024 * 1024),
|
|
21528
|
+
integer: false,
|
|
21529
|
+
disabled: !writable || pendingField.includes("maxRequestImageBytes"),
|
|
21530
|
+
onCommit: (value) => setFormField("maxRequestImageBytes", Math.round(value * 1024 * 1024))
|
|
21531
|
+
})
|
|
21532
|
+
),
|
|
21414
21533
|
h(
|
|
21415
21534
|
"section",
|
|
21416
21535
|
{ className: "odc-card" },
|
package/lib/config.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Schema from '@deepseek-ai/schemastery';
|
|
2
2
|
import { type ApiProtocol } from './protocol-options.js';
|
|
3
3
|
import { type ModelSettingsMap } from './model-settings.js';
|
|
4
|
+
export { DEFAULT_MAX_REQUEST_IMAGE_BYTES } from './image-budget.js';
|
|
4
5
|
export declare const SETTINGS_NS = "llm-opendesign-corouter";
|
|
5
6
|
export declare const PLAN_PROVIDER = "opendesign-corouter-plan";
|
|
6
7
|
export declare const PAID_PROVIDER = "opendesign-corouter-paid";
|
|
@@ -15,6 +16,7 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
|
15
16
|
quotaRefreshSeconds: Schema<number, number, "volatile-defined">;
|
|
16
17
|
requestTimeoutMs: Schema<number, number, "volatile-defined">;
|
|
17
18
|
streamIdleTimeoutMs: Schema<number, number, "volatile-defined">;
|
|
19
|
+
maxRequestImageBytes: Schema<number, number, "volatile-defined">;
|
|
18
20
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
19
21
|
apiKeyEnv: Schema<string, string, "volatile-defined">;
|
|
20
22
|
baseURL: Schema<string, string, "volatile-defined">;
|
|
@@ -25,6 +27,7 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
|
25
27
|
quotaRefreshSeconds: Schema<number, number, "volatile-defined">;
|
|
26
28
|
requestTimeoutMs: Schema<number, number, "volatile-defined">;
|
|
27
29
|
streamIdleTimeoutMs: Schema<number, number, "volatile-defined">;
|
|
30
|
+
maxRequestImageBytes: Schema<number, number, "volatile-defined">;
|
|
28
31
|
}>>, "plain">;
|
|
29
32
|
export type LiveConfig = ReturnType<typeof Config>;
|
|
30
33
|
export interface RuntimeConfig {
|
|
@@ -37,6 +40,7 @@ export interface RuntimeConfig {
|
|
|
37
40
|
apiProtocol?: ApiProtocol;
|
|
38
41
|
modelSettings?: ModelSettingsMap;
|
|
39
42
|
quotaRefreshSeconds?: number;
|
|
43
|
+
maxRequestImageBytes?: number;
|
|
40
44
|
}
|
|
41
45
|
export declare function assertBaseURL(raw: string): string;
|
|
42
46
|
export declare function readConfig(config: LiveConfig): RuntimeConfig;
|
package/lib/device-auth.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface DeviceTokens {
|
|
|
3
3
|
runtimeKey: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const DEVICE_AUTH_ENDPOINT = "https://amr-api.open-design.ai/api/v1/cli/device-authorizations";
|
|
6
|
-
export declare const DEVICE_AUTH_PLUGIN_VERSION = "0.1.
|
|
6
|
+
export declare const DEVICE_AUTH_PLUGIN_VERSION = "0.1.14";
|
|
7
7
|
export declare const DEVICE_REQUEST_TIMEOUT_MS = 20000;
|
|
8
8
|
/** One bounded launch step of the temporary activation window. */
|
|
9
9
|
export declare const DEVICE_OPEN_TIMEOUT_MS = 30000;
|
|
@@ -86,6 +86,11 @@ function parseModelSettingsMap(value) {
|
|
|
86
86
|
return out;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
// src/image-budget.ts
|
|
90
|
+
var MIN_REQUEST_IMAGE_BYTES = 1024 * 1024;
|
|
91
|
+
var DEFAULT_MAX_REQUEST_IMAGE_BYTES = 20 * 1024 * 1024;
|
|
92
|
+
var MAX_REQUEST_IMAGE_BYTES = 100 * 1024 * 1024;
|
|
93
|
+
|
|
89
94
|
// src/remote.ts
|
|
90
95
|
var MAX_REVISION = 256;
|
|
91
96
|
var MAX_JOB_ID = 128;
|
|
@@ -274,7 +279,8 @@ function parseStatusConfig(value) {
|
|
|
274
279
|
...value.modelSettings === void 0 ? {} : { modelSettings: parseModelSettingsMap(value.modelSettings) },
|
|
275
280
|
...value.requestTimeoutMs === void 0 ? {} : { requestTimeoutMs: positiveInteger(value.requestTimeoutMs, "\u8BF7\u6C42\u8D85\u65F6", 36e5, 1e3) },
|
|
276
281
|
...value.streamIdleTimeoutMs === void 0 ? {} : { streamIdleTimeoutMs: positiveInteger(value.streamIdleTimeoutMs, "\u6D41\u7A7A\u95F2\u8D85\u65F6", 18e5, 1e3) },
|
|
277
|
-
...value.quotaRefreshSeconds === void 0 ? {} : { quotaRefreshSeconds: positiveInteger(value.quotaRefreshSeconds, "\u81EA\u52A8\u5237\u65B0\u95F4\u9694", 3600, 5) }
|
|
282
|
+
...value.quotaRefreshSeconds === void 0 ? {} : { quotaRefreshSeconds: positiveInteger(value.quotaRefreshSeconds, "\u81EA\u52A8\u5237\u65B0\u95F4\u9694", 3600, 5) },
|
|
283
|
+
...value.maxRequestImageBytes === void 0 ? {} : { maxRequestImageBytes: positiveInteger(value.maxRequestImageBytes, "\u8BF7\u6C42\u56FE\u7247\u9884\u7B97", MAX_REQUEST_IMAGE_BYTES, MIN_REQUEST_IMAGE_BYTES) }
|
|
278
284
|
};
|
|
279
285
|
}
|
|
280
286
|
function parseStatus(value) {
|
|
@@ -86,6 +86,11 @@ function parseModelSettingsMap(value) {
|
|
|
86
86
|
return out;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
// src/image-budget.ts
|
|
90
|
+
var MIN_REQUEST_IMAGE_BYTES = 1024 * 1024;
|
|
91
|
+
var DEFAULT_MAX_REQUEST_IMAGE_BYTES = 20 * 1024 * 1024;
|
|
92
|
+
var MAX_REQUEST_IMAGE_BYTES = 100 * 1024 * 1024;
|
|
93
|
+
|
|
89
94
|
// src/remote.ts
|
|
90
95
|
var MAX_REVISION = 256;
|
|
91
96
|
var MAX_JOB_ID = 128;
|
|
@@ -274,7 +279,8 @@ function parseStatusConfig(value) {
|
|
|
274
279
|
...value.modelSettings === void 0 ? {} : { modelSettings: parseModelSettingsMap(value.modelSettings) },
|
|
275
280
|
...value.requestTimeoutMs === void 0 ? {} : { requestTimeoutMs: positiveInteger(value.requestTimeoutMs, "\u8BF7\u6C42\u8D85\u65F6", 36e5, 1e3) },
|
|
276
281
|
...value.streamIdleTimeoutMs === void 0 ? {} : { streamIdleTimeoutMs: positiveInteger(value.streamIdleTimeoutMs, "\u6D41\u7A7A\u95F2\u8D85\u65F6", 18e5, 1e3) },
|
|
277
|
-
...value.quotaRefreshSeconds === void 0 ? {} : { quotaRefreshSeconds: positiveInteger(value.quotaRefreshSeconds, "\u81EA\u52A8\u5237\u65B0\u95F4\u9694", 3600, 5) }
|
|
282
|
+
...value.quotaRefreshSeconds === void 0 ? {} : { quotaRefreshSeconds: positiveInteger(value.quotaRefreshSeconds, "\u81EA\u52A8\u5237\u65B0\u95F4\u9694", 3600, 5) },
|
|
283
|
+
...value.maxRequestImageBytes === void 0 ? {} : { maxRequestImageBytes: positiveInteger(value.maxRequestImageBytes, "\u8BF7\u6C42\u56FE\u7247\u9884\u7B97", MAX_REQUEST_IMAGE_BYTES, MIN_REQUEST_IMAGE_BYTES) }
|
|
278
284
|
};
|
|
279
285
|
}
|
|
280
286
|
function parseStatus(value) {
|