dsh-opendesign-corouter 0.1.11 → 0.1.13
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 +2 -2
- package/SECURITY.md +1 -0
- package/lib/adapter.d.ts +2 -0
- package/lib/catalog.d.ts +8 -6
- package/lib/claude-capabilities.d.ts +8 -0
- package/lib/claude-parameters.d.ts +3 -0
- package/lib/client.d.ts +7 -1
- package/lib/client.js +248 -45
- package/lib/device-auth.d.ts +1 -1
- package/lib/generated/typert.host.js +12 -1
- package/lib/generated/typert.remote-client.js +12 -1
- package/lib/index.js +453 -118
- package/lib/index.js.map +4 -4
- package/lib/model-settings.d.ts +4 -3
- package/lib/protocols/messages.d.ts +5 -7
- package/lib/protocols/types.d.ts +10 -1
- package/lib/remote.d.ts +2 -0
- package/lib/replay-key.d.ts +13 -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.13.tgz
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
`web` 只是示例,请替换为目标 Profile。Desktop 使用桌面安装器提供的 `dsh` 入口;独立公共 CLI 不能代管保留的 `desktop` Profile。安装后的启用与重载按目标 DSH 的管理流程进行。
|
|
@@ -55,7 +55,7 @@ dsh plugin --profile web add /absolute/path/to/dsh-opendesign-corouter-0.1.11.tg
|
|
|
55
55
|
| `opendesign-corouter-plan` | 13 | Core / Design Plan 附赠通道,含预检确认覆盖的 MiniMax M3.1 Flash |
|
|
56
56
|
| `opendesign-corouter-paid` | 26 | Plan 套餐模型及其他钱包付费模型 |
|
|
57
57
|
|
|
58
|
-
上表为内置目录。模型页可通过当前配置网关的 OpenAI 兼容 `/models`
|
|
58
|
+
上表为内置目录。模型页可通过当前配置网关的 OpenAI 兼容 `/models` 接口刷新目录,逐个启用或停用模型、控制图片输入,并配置温度、top-p、默认输出上限、上下文预算及思考深度。高级参数默认折叠,图片输入可手动覆盖或恢复自动。未知模态保持未知并尝试发送图片;实际支持情况由网关决定。[图片能力证据](docs/model-capabilities.md)。
|
|
59
59
|
|
|
60
60
|
推理协议可选 **OpenAI Chat Completions、OpenAI Responses、Anthropic Messages**。模型发现始终使用当前网关的 OpenAI 兼容 `/models` 接口,不随推理协议切换。
|
|
61
61
|
|
package/SECURITY.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
- 推理、桌面控制面和控制台 Cookie 分属独立通道,不互相替代鉴权材料。
|
|
4
4
|
- API Key 与设备授权的 controlKey / runtimeKey 仅经 DSH 凭据服务写入插件专属记录;设置页只读取存在性和状态,不回填秘密。
|
|
5
|
+
- Claude Messages 使用凭据服务中的插件专属随机绑定密钥,确保同一网关切换推理 Key 时不向新身份回放旧签名;会话和备份包含上游签名及加密思考元数据。无凭据服务时绑定仅在当前插件实例内有效。
|
|
5
6
|
- 桌面配置只读。仅支持已核实的生产环境,控制令牌只能发送到 `https://amr-api.open-design.ai`。控制台和推理请求禁止自动跟随重定向。
|
|
6
7
|
- 设备授权双令牌原子保存;runtimeKey 只自动提供给请求快照中的官方推理 origin,controlKey 只发往官方控制面。旧 Cookie grant 保留只读兼容。
|
|
7
8
|
- 推理自定义地址由用户显式配置;除本机回环外要求 HTTPS,拒绝 URL 内嵌凭据、查询串与片段。
|
package/lib/adapter.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export interface AdapterOptions {
|
|
|
9
9
|
imageDataUrl?(image: ImageAttachmentRef, signal: AbortSignal): Promise<string | undefined>;
|
|
10
10
|
onEmptyTurn?(): void;
|
|
11
11
|
fetch?: typeof fetch;
|
|
12
|
+
/** Caller-owned random binding-secret bytes from the Host credential service. */
|
|
13
|
+
replayBindingSecret?(signal: AbortSignal): Promise<Uint8Array>;
|
|
12
14
|
}
|
|
13
15
|
export declare class CoRouterAdapter extends LlmAdapter {
|
|
14
16
|
#private;
|
package/lib/catalog.d.ts
CHANGED
|
@@ -6,12 +6,13 @@
|
|
|
6
6
|
* 详情页内联 `data-model="{...}"` JSON(公开页面,2026-10-26)。
|
|
7
7
|
* - group:官网首页套餐卡 `https://corouter.open-design.ai/zh/` 的
|
|
8
8
|
* `data-model-module="design-plan"` 12 款归 `plan`;其余在售对话模型归 `paid`。
|
|
9
|
-
* - `plan` 原有 12 款的 contextWindow / maxOutputTokens
|
|
9
|
+
* - `plan` 原有 12 款的 contextWindow / maxOutputTokens 与原模态
|
|
10
10
|
* 来自 Go 侧 `dsh-opendesign-go` 0.1.9 的 MODEL_DEFAULTS(同一 `amr-link` endpoint 部署资料),
|
|
11
|
-
*
|
|
12
|
-
* -
|
|
13
|
-
*
|
|
14
|
-
*
|
|
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
|
* 与本表不同代,故不用于本目录。
|
|
@@ -32,7 +33,8 @@
|
|
|
32
33
|
* 走 `/api/v1/media/*`,不应出现在对话模型列表里,避免选中后 chat 请求必败。
|
|
33
34
|
*
|
|
34
35
|
* 思考档位按厂商型号资料记录,来源见 docs/reasoning-evidence.md;网关逐路由行为未实测。
|
|
35
|
-
*
|
|
36
|
+
* 图片输入能力按精确型号的厂商资料补充,证据与网关限制见 docs/model-capabilities.md;
|
|
37
|
+
* 不可确认的模态与容量保持缺省。
|
|
36
38
|
*/
|
|
37
39
|
export interface CatalogModel {
|
|
38
40
|
id: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ApiProtocol } from './protocol-options.js';
|
|
2
|
+
/** This policy is scoped to the native Messages API and evidenced model IDs. */
|
|
3
|
+
export declare function hasRestrictedClaudeSampling(model: string, protocol: ApiProtocol): boolean;
|
|
4
|
+
/** Return a validation reason without changing an explicitly requested value. */
|
|
5
|
+
export declare function claudeSamplingError(model: string, protocol: ApiProtocol, temperature: number | undefined, topP: number | undefined): string | undefined;
|
|
6
|
+
/** Vendor-documented synchronous Messages output ceiling for these exact model IDs. */
|
|
7
|
+
export declare const CLAUDE_MESSAGES_MAX_OUTPUT = 128000;
|
|
8
|
+
export declare function claudeOutputError(model: string, protocol: ApiProtocol, maxTokens: number | undefined): string | undefined;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Reject unsupported explicit overrides rather than silently changing their meaning. */
|
|
2
|
+
export declare function validateClaudeSampling(model: string, temperature: number | undefined, topP: number | undefined): void;
|
|
3
|
+
export declare function validateClaudeOutput(model: string, maxTokens: number | undefined): void;
|
package/lib/client.d.ts
CHANGED
|
@@ -120,6 +120,10 @@ export declare function modelSettingsEntry(map: ModelSettingsMap | undefined, id
|
|
|
120
120
|
* `Status.models[].enabled`, which can lag one refresh behind a reset.
|
|
121
121
|
*/
|
|
122
122
|
export declare function modelEnabled(model: StatusModel, settings: ModelSettings | undefined, authoritative?: boolean): boolean;
|
|
123
|
+
/** Manual image policy wins; automatic mode only treats an explicit catalog image modality as confirmed. */
|
|
124
|
+
export declare function modelImageInput(model: StatusModel, settings: ModelSettings | undefined): boolean;
|
|
125
|
+
/** Enabled rows come first without changing the catalog's order within either state. */
|
|
126
|
+
export declare function sortModelsByEnabled(models: readonly StatusModel[], settingsMap: ModelSettingsMap, authoritative: boolean): StatusModel[];
|
|
123
127
|
export interface NumberInputSpec {
|
|
124
128
|
label: string;
|
|
125
129
|
min: number;
|
|
@@ -170,11 +174,13 @@ export interface ModelRowProps {
|
|
|
170
174
|
authoritative: boolean;
|
|
171
175
|
writable: boolean;
|
|
172
176
|
pending: boolean;
|
|
177
|
+
disabledReason?: string | undefined;
|
|
178
|
+
protocol?: ApiProtocol;
|
|
173
179
|
price?: PriceCatalog['models'][number] | undefined;
|
|
174
180
|
priceKnown?: boolean | undefined;
|
|
175
181
|
onCommit: (next: ModelSettings | undefined) => Promise<boolean>;
|
|
176
182
|
}
|
|
177
|
-
export declare function ModelRow({ model, settings, authoritative, writable, pending, price, priceKnown, onCommit }: ModelRowProps): React.DetailedReactHTMLElement<{
|
|
183
|
+
export declare function ModelRow({ model, settings, authoritative, writable, pending, disabledReason, protocol, price, priceKnown, onCommit }: ModelRowProps): React.DetailedReactHTMLElement<{
|
|
178
184
|
className: string;
|
|
179
185
|
}, HTMLElement>;
|
|
180
186
|
export interface ModelsProps {
|
package/lib/client.js
CHANGED
|
@@ -47,6 +47,7 @@ __export(client_exports, {
|
|
|
47
47
|
formatWindowCredits: () => formatWindowCredits,
|
|
48
48
|
inject: () => inject,
|
|
49
49
|
modelEnabled: () => modelEnabled,
|
|
50
|
+
modelImageInput: () => modelImageInput,
|
|
50
51
|
modelSettingsEntry: () => modelSettingsEntry,
|
|
51
52
|
name: () => name,
|
|
52
53
|
nextWindowResetAt: () => nextWindowResetAt,
|
|
@@ -55,6 +56,7 @@ __export(client_exports, {
|
|
|
55
56
|
protocolEndpoint: () => protocolEndpoint,
|
|
56
57
|
quotaAutoRefresh: () => quotaAutoRefresh,
|
|
57
58
|
quotaStatusView: () => quotaStatusView,
|
|
59
|
+
sortModelsByEnabled: () => sortModelsByEnabled,
|
|
58
60
|
tabAfter: () => tabAfter,
|
|
59
61
|
writeModelSettings: () => writeModelSettings
|
|
60
62
|
});
|
|
@@ -19979,7 +19981,7 @@ function parseModelSettingsMap(value) {
|
|
|
19979
19981
|
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
19980
19982
|
const keys = Object.keys(value);
|
|
19981
19983
|
if (keys.length > 512) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u6700\u591A\u5141\u8BB8 512 \u4E2A\u6A21\u578B");
|
|
19982
|
-
const fields = /* @__PURE__ */ new Set(["enabled", "temperature", "topP", "maxTokens", "contextWindow", "reasoningEffort"]);
|
|
19984
|
+
const fields = /* @__PURE__ */ new Set(["enabled", "imageInput", "temperature", "topP", "maxTokens", "contextWindow", "reasoningEffort"]);
|
|
19983
19985
|
const efforts = ["none", "minimal", "low", "medium", "high", "xhigh", "ultra", "max"];
|
|
19984
19986
|
const out = {};
|
|
19985
19987
|
for (const id of keys) {
|
|
@@ -19996,6 +19998,10 @@ function parseModelSettingsMap(value) {
|
|
|
19996
19998
|
if (typeof settings.enabled !== "boolean") throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 enabled \u5FC5\u987B\u662F\u5E03\u5C14\u503C");
|
|
19997
19999
|
parsed.enabled = settings.enabled;
|
|
19998
20000
|
}
|
|
20001
|
+
if (settings.imageInput !== void 0) {
|
|
20002
|
+
if (typeof settings.imageInput !== "boolean") throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 imageInput \u5FC5\u987B\u662F\u5E03\u5C14\u503C");
|
|
20003
|
+
parsed.imageInput = settings.imageInput;
|
|
20004
|
+
}
|
|
19999
20005
|
for (const [field, max] of [["temperature", 2], ["topP", 1]]) {
|
|
20000
20006
|
const item = settings[field];
|
|
20001
20007
|
if (item === void 0) continue;
|
|
@@ -20067,6 +20073,12 @@ function parseEfforts(value) {
|
|
|
20067
20073
|
if (!Array.isArray(value) || value.length > 16) throw new Error("\u6A21\u578B\u601D\u8003\u6863\u4F4D\u683C\u5F0F\u65E0\u6548");
|
|
20068
20074
|
return value.map((item) => text(item, "\u601D\u8003\u6863\u4F4D", 32));
|
|
20069
20075
|
}
|
|
20076
|
+
function parseModalities(value) {
|
|
20077
|
+
if (!Array.isArray(value) || value.length < 1 || value.length > 2) throw new Error("\u6A21\u578B\u8F93\u5165\u6A21\u6001\u683C\u5F0F\u65E0\u6548");
|
|
20078
|
+
const modes = value.map((item) => member(item, ["text", "image"], "\u6A21\u578B\u8F93\u5165\u6A21\u6001"));
|
|
20079
|
+
if (!modes.includes("text") || new Set(modes).size !== modes.length) throw new Error("\u6A21\u578B\u8F93\u5165\u6A21\u6001\u683C\u5F0F\u65E0\u6548");
|
|
20080
|
+
return modes;
|
|
20081
|
+
}
|
|
20070
20082
|
function member(value, allowed, label) {
|
|
20071
20083
|
const hit = allowed.find((candidate) => candidate === value);
|
|
20072
20084
|
if (hit === void 0) throw new Error(`${label} \u4E0D\u5728\u5141\u8BB8\u7684\u53D6\u503C\u5185`);
|
|
@@ -20181,6 +20193,7 @@ function parseStatusModel(value) {
|
|
|
20181
20193
|
name: text(value.name, "\u6A21\u578B\u540D", 128),
|
|
20182
20194
|
group: member(value.group, MODEL_GROUPS, "\u6A21\u578B\u5206\u7EC4"),
|
|
20183
20195
|
...value.enabled === void 0 ? {} : { enabled: flag(value.enabled, "\u6A21\u578B\u542F\u7528\u72B6\u6001") },
|
|
20196
|
+
...value.inputModalities === void 0 ? {} : { inputModalities: parseModalities(value.inputModalities) },
|
|
20184
20197
|
...value.contextWindow === void 0 ? {} : { contextWindow: positiveInteger(value.contextWindow, "\u4E0A\u4E0B\u6587\u9884\u7B97", 1e8) },
|
|
20185
20198
|
...value.maxOutputTokens === void 0 ? {} : { maxOutputTokens: positiveInteger(value.maxOutputTokens, "\u6700\u5927\u8F93\u51FA", 1e7) },
|
|
20186
20199
|
...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) }
|
|
@@ -20287,6 +20300,32 @@ function modelReasoningEfforts(model, protocol) {
|
|
|
20287
20300
|
return model.reasoningEfforts?.filter((effort) => protocolAcceptsEffort(protocol, effort));
|
|
20288
20301
|
}
|
|
20289
20302
|
|
|
20303
|
+
// src/claude-capabilities.ts
|
|
20304
|
+
var RESTRICTED_MESSAGES_SAMPLING = /* @__PURE__ */ new Set([
|
|
20305
|
+
"claude-fable-5.1",
|
|
20306
|
+
"claude-fable-5",
|
|
20307
|
+
"claude-opus-5.5",
|
|
20308
|
+
"claude-opus-5",
|
|
20309
|
+
"claude-opus-4.8",
|
|
20310
|
+
"claude-sonnet-5.5",
|
|
20311
|
+
"claude-sonnet-5",
|
|
20312
|
+
"claude-haiku-5.5"
|
|
20313
|
+
]);
|
|
20314
|
+
function hasRestrictedClaudeSampling(model, protocol) {
|
|
20315
|
+
return protocol === "messages" && RESTRICTED_MESSAGES_SAMPLING.has(model);
|
|
20316
|
+
}
|
|
20317
|
+
function claudeSamplingError(model, protocol, temperature, topP) {
|
|
20318
|
+
if (!hasRestrictedClaudeSampling(model, protocol)) return void 0;
|
|
20319
|
+
if (temperature !== void 0 && topP !== void 0) return "\u6B64 Claude \u6A21\u578B\u7684 Messages \u8BF7\u6C42\u4E0D\u80FD\u540C\u65F6\u8BBE\u7F6E\u6E29\u5EA6\u548C Top P\uFF0C\u8BF7\u81F3\u5C11\u6E05\u7A7A\u4E00\u9879\u3002";
|
|
20320
|
+
if (temperature !== void 0 && temperature !== 1) return "\u6B64 Claude \u6A21\u578B\u7684 Messages \u8BF7\u6C42\u4EC5\u63A5\u53D7\u9ED8\u8BA4\u6E29\u5EA6 1\uFF0C\u8BF7\u6E05\u7A7A\u6216\u6539\u4E3A 1\u3002";
|
|
20321
|
+
if (topP !== void 0 && topP !== 0.99) return "\u6B64 Claude \u6A21\u578B\u7684 Messages \u8BF7\u6C42\u4EC5\u63A5\u53D7\u9ED8\u8BA4 Top P 0.99\uFF0C\u8BF7\u6E05\u7A7A\u6216\u6539\u4E3A 0.99\u3002";
|
|
20322
|
+
return void 0;
|
|
20323
|
+
}
|
|
20324
|
+
var CLAUDE_MESSAGES_MAX_OUTPUT = 128e3;
|
|
20325
|
+
function claudeOutputError(model, protocol, maxTokens) {
|
|
20326
|
+
return hasRestrictedClaudeSampling(model, protocol) && maxTokens !== void 0 && maxTokens > CLAUDE_MESSAGES_MAX_OUTPUT ? "\u6B64 Claude \u6A21\u578B\u7684 Messages \u6700\u5927\u8F93\u51FA\u4E3A 128000\uFF0C\u8BF7\u51CF\u5C0F\u8F93\u51FA\u4E0A\u9650\u3002" : void 0;
|
|
20327
|
+
}
|
|
20328
|
+
|
|
20290
20329
|
// src/client.ts
|
|
20291
20330
|
var h = React.createElement;
|
|
20292
20331
|
var SETTINGS_NS = "llm-opendesign-corouter";
|
|
@@ -20343,7 +20382,9 @@ function installStyles() {
|
|
|
20343
20382
|
.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))}
|
|
20344
20383
|
.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}
|
|
20345
20384
|
.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}
|
|
20385
|
+
.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}
|
|
20346
20386
|
.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}
|
|
20387
|
+
.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}
|
|
20347
20388
|
.odc-input option{background:var(--dsw-alias-bg-layer-2,Canvas);color:var(--dsw-alias-label-primary,CanvasText)}
|
|
20348
20389
|
.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))}
|
|
20349
20390
|
.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}
|
|
@@ -20358,7 +20399,7 @@ function installStyles() {
|
|
|
20358
20399
|
.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}
|
|
20359
20400
|
.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}
|
|
20360
20401
|
.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}
|
|
20361
|
-
@media(forced-colors:active){.odc-window progress{appearance:auto;accent-color:Highlight;forced-color-adjust:auto}.odc-window progress::-webkit-progress-value{background:Highlight}}
|
|
20402
|
+
@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}}
|
|
20362
20403
|
.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}
|
|
20363
20404
|
.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)}
|
|
20364
20405
|
.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}
|
|
@@ -20718,6 +20759,7 @@ function writeModelSettings(map2, id, next) {
|
|
|
20718
20759
|
}
|
|
20719
20760
|
const entry = {};
|
|
20720
20761
|
if (next.enabled !== void 0) entry.enabled = next.enabled;
|
|
20762
|
+
if (next.imageInput !== void 0) entry.imageInput = next.imageInput;
|
|
20721
20763
|
if (next.temperature !== void 0) entry.temperature = next.temperature;
|
|
20722
20764
|
if (next.topP !== void 0) entry.topP = next.topP;
|
|
20723
20765
|
if (next.maxTokens !== void 0) entry.maxTokens = next.maxTokens;
|
|
@@ -20735,6 +20777,18 @@ function modelEnabled(model, settings, authoritative = true) {
|
|
|
20735
20777
|
if (authoritative) return true;
|
|
20736
20778
|
return model.enabled !== false;
|
|
20737
20779
|
}
|
|
20780
|
+
function modelImageInput(model, settings) {
|
|
20781
|
+
if (settings?.imageInput !== void 0) return settings.imageInput;
|
|
20782
|
+
return model.inputModalities === void 0 ? true : model.inputModalities.includes("image");
|
|
20783
|
+
}
|
|
20784
|
+
function sortModelsByEnabled(models, settingsMap, authoritative) {
|
|
20785
|
+
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);
|
|
20786
|
+
}
|
|
20787
|
+
function imageInputSource(model, settings) {
|
|
20788
|
+
if (settings.imageInput !== void 0) return settings.imageInput ? "\u624B\u52A8 \xB7 \u5F00\u542F" : "\u624B\u52A8 \xB7 \u5173\u95ED";
|
|
20789
|
+
if (model.inputModalities === void 0) return "\u81EA\u52A8 \xB7 \u672A\u77E5\uFF0C\u5C1D\u8BD5\u53D1\u9001";
|
|
20790
|
+
return model.inputModalities.includes("image") ? "\u81EA\u52A8 \xB7 \u652F\u6301\u56FE\u7247" : "\u81EA\u52A8 \xB7 \u4EC5\u6587\u672C";
|
|
20791
|
+
}
|
|
20738
20792
|
var DECIMAL_TEXT = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/u;
|
|
20739
20793
|
function parseNumberInput(raw, spec) {
|
|
20740
20794
|
const text2 = raw.trim();
|
|
@@ -20799,7 +20853,7 @@ var NUMERIC_FIELDS = {
|
|
|
20799
20853
|
contextWindow: { label: "\u4E0A\u4E0B\u6587\u9884\u7B97\uFF08tokens\uFF09", hint: "\u6B63\u6574\u6570\uFF1B\u7559\u7A7A\u7EE7\u627F\u76EE\u5F55\u9ED8\u8BA4\u3002", min: 1, max: MAX_CONTEXT_WINDOW, integer: true }
|
|
20800
20854
|
};
|
|
20801
20855
|
var NUMERIC_ORDER = ["temperature", "topP", "maxTokens", "contextWindow"];
|
|
20802
|
-
function OptionalNumberField({ id, field, value, disabled, resetToken, onSave }) {
|
|
20856
|
+
function OptionalNumberField({ id, field, value, disabled, restricted = false, invalid = false, maxOutputLimit, resetToken, onSave }) {
|
|
20803
20857
|
const spec = NUMERIC_FIELDS[field];
|
|
20804
20858
|
const mounted = useMounted();
|
|
20805
20859
|
const [draft, setDraft] = React.useState(void 0);
|
|
@@ -20843,11 +20897,11 @@ function OptionalNumberField({ id, field, value, disabled, resetToken, onSave })
|
|
|
20843
20897
|
type: "number",
|
|
20844
20898
|
inputMode: "decimal",
|
|
20845
20899
|
min: spec.min,
|
|
20846
|
-
max: spec.max,
|
|
20847
|
-
step: spec.integer === true ? 1 : 0.1,
|
|
20900
|
+
max: maxOutputLimit ?? spec.max,
|
|
20901
|
+
step: spec.integer === true ? 1 : field === "topP" ? 0.01 : 0.1,
|
|
20848
20902
|
value: draft ?? (value === void 0 ? "" : String(value)),
|
|
20849
20903
|
disabled,
|
|
20850
|
-
"aria-invalid": error62 !== void 0,
|
|
20904
|
+
"aria-invalid": error62 !== void 0 || invalid,
|
|
20851
20905
|
"aria-describedby": `${id}-hint`,
|
|
20852
20906
|
onChange: (event) => setDraft(event.target.value),
|
|
20853
20907
|
onBlur: () => {
|
|
@@ -20858,43 +20912,121 @@ function OptionalNumberField({ id, field, value, disabled, resetToken, onSave })
|
|
|
20858
20912
|
className: error62 === void 0 ? "odc-hint" : "odc-hint odc-field-error",
|
|
20859
20913
|
id: `${id}-hint`,
|
|
20860
20914
|
...error62 === void 0 ? {} : { role: "alert" }
|
|
20861
|
-
}, error62 ?? spec.hint)
|
|
20915
|
+
}, 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))
|
|
20862
20916
|
);
|
|
20863
20917
|
}
|
|
20864
|
-
function EffortField({ id, model, value, disabled,
|
|
20918
|
+
function EffortField({ id, model, value, disabled, pending, disabledReason, onSave }) {
|
|
20865
20919
|
const mounted = useMounted();
|
|
20920
|
+
const [editing, setEditing] = React.useState(false);
|
|
20921
|
+
const [draft, setDraft] = React.useState(value ?? "");
|
|
20922
|
+
const [baseValue, setBaseValue] = React.useState(value);
|
|
20923
|
+
const [saving, setSaving] = React.useState(false);
|
|
20866
20924
|
const [error62, setError] = React.useState(void 0);
|
|
20867
20925
|
const listed = model.reasoningEfforts ?? [];
|
|
20868
20926
|
const invalidDefault = value !== void 0 && !listed.includes(value);
|
|
20869
|
-
const
|
|
20927
|
+
const invalidDraft = editing && draft !== "" && !listed.includes(draft);
|
|
20928
|
+
const options = [...listed];
|
|
20929
|
+
for (const effort of [value, draft]) {
|
|
20930
|
+
if (effort !== void 0 && effort !== "" && !options.includes(effort)) options.push(effort);
|
|
20931
|
+
}
|
|
20870
20932
|
const unavailable = listed.length === 0;
|
|
20933
|
+
const busy = saving || pending;
|
|
20934
|
+
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;
|
|
20935
|
+
const externallyChanged = editing && value !== baseValue && !(saving && value === draft);
|
|
20936
|
+
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");
|
|
20937
|
+
const cancel = () => {
|
|
20938
|
+
if (saving) return;
|
|
20939
|
+
setEditing(false);
|
|
20940
|
+
setError(void 0);
|
|
20941
|
+
};
|
|
20942
|
+
const save = async () => {
|
|
20943
|
+
if (disabled || pending || saving || invalidDraft) return;
|
|
20944
|
+
if (draft === (value ?? "")) {
|
|
20945
|
+
setEditing(false);
|
|
20946
|
+
setError(void 0);
|
|
20947
|
+
return;
|
|
20948
|
+
}
|
|
20949
|
+
setSaving(true);
|
|
20950
|
+
setError(void 0);
|
|
20951
|
+
try {
|
|
20952
|
+
const saved = await onSave(draft);
|
|
20953
|
+
if (!mounted.current) return;
|
|
20954
|
+
if (saved) {
|
|
20955
|
+
setEditing(false);
|
|
20956
|
+
setError(void 0);
|
|
20957
|
+
} else setError("\u8BBE\u7F6E\u672A\u4FDD\u5B58\uFF0C\u5DF2\u4FDD\u7559\u5F53\u524D\u8349\u7A3F\uFF0C\u8BF7\u91CD\u8BD5\u3002");
|
|
20958
|
+
} catch {
|
|
20959
|
+
if (mounted.current) setError("\u8BBE\u7F6E\u672A\u4FDD\u5B58\uFF0C\u5DF2\u4FDD\u7559\u5F53\u524D\u8349\u7A3F\uFF0C\u8BF7\u91CD\u8BD5\u3002");
|
|
20960
|
+
} finally {
|
|
20961
|
+
if (mounted.current) setSaving(false);
|
|
20962
|
+
}
|
|
20963
|
+
};
|
|
20871
20964
|
return h(
|
|
20872
20965
|
"div",
|
|
20873
|
-
{
|
|
20874
|
-
|
|
20875
|
-
|
|
20876
|
-
|
|
20877
|
-
|
|
20878
|
-
|
|
20879
|
-
|
|
20880
|
-
|
|
20881
|
-
|
|
20882
|
-
|
|
20883
|
-
|
|
20884
|
-
|
|
20885
|
-
|
|
20886
|
-
|
|
20887
|
-
|
|
20888
|
-
|
|
20889
|
-
|
|
20890
|
-
|
|
20891
|
-
|
|
20892
|
-
|
|
20966
|
+
{
|
|
20967
|
+
className: "odc-field odc-field-compact odc-effort",
|
|
20968
|
+
"data-mode": editing ? "editing" : "summary",
|
|
20969
|
+
onKeyDown: (event) => {
|
|
20970
|
+
if (event.key !== "Escape" || !editing || saving) return;
|
|
20971
|
+
event.preventDefault();
|
|
20972
|
+
cancel();
|
|
20973
|
+
}
|
|
20974
|
+
},
|
|
20975
|
+
editing ? h(
|
|
20976
|
+
React.Fragment,
|
|
20977
|
+
null,
|
|
20978
|
+
h("label", { htmlFor: id }, "\u9ED8\u8BA4\u601D\u8003\u6DF1\u5EA6"),
|
|
20979
|
+
h("select", {
|
|
20980
|
+
id,
|
|
20981
|
+
className: "odc-input",
|
|
20982
|
+
value: draft,
|
|
20983
|
+
disabled: busy || disabled,
|
|
20984
|
+
"aria-describedby": `${id}-hint${error62 === void 0 ? "" : ` ${id}-error`}`,
|
|
20985
|
+
"aria-invalid": invalidDraft || error62 !== void 0,
|
|
20986
|
+
onChange: (event) => {
|
|
20987
|
+
setDraft(event.target.value);
|
|
20988
|
+
setError(void 0);
|
|
20989
|
+
}
|
|
20990
|
+
}, [
|
|
20991
|
+
h("option", { key: "", value: "" }, "\u7EE7\u627F\u9ED8\u8BA4"),
|
|
20992
|
+
...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`))
|
|
20993
|
+
]),
|
|
20994
|
+
h(
|
|
20995
|
+
"div",
|
|
20996
|
+
{ className: "odc-effort-actions" },
|
|
20997
|
+
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: () => {
|
|
20998
|
+
void save();
|
|
20999
|
+
} }, saving ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58"),
|
|
21000
|
+
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")
|
|
21001
|
+
)
|
|
21002
|
+
) : h(
|
|
21003
|
+
React.Fragment,
|
|
21004
|
+
null,
|
|
21005
|
+
h(
|
|
21006
|
+
"div",
|
|
21007
|
+
{ className: "odc-effort-head" },
|
|
21008
|
+
h("span", { className: "odc-effort-label" }, "\u9ED8\u8BA4\u601D\u8003\u6DF1\u5EA6"),
|
|
21009
|
+
h("button", {
|
|
21010
|
+
className: "odc-button odc-button-small",
|
|
21011
|
+
type: "button",
|
|
21012
|
+
disabled: busy || disabled || unavailable && value === void 0,
|
|
21013
|
+
"aria-label": "\u7F16\u8F91\u9ED8\u8BA4\u601D\u8003\u6DF1\u5EA6",
|
|
21014
|
+
"aria-describedby": `${id}-hint`,
|
|
21015
|
+
onClick: () => {
|
|
21016
|
+
setDraft(value ?? "");
|
|
21017
|
+
setBaseValue(value);
|
|
21018
|
+
setError(void 0);
|
|
21019
|
+
setEditing(true);
|
|
21020
|
+
}
|
|
21021
|
+
}, "\u7F16\u8F91")
|
|
21022
|
+
),
|
|
21023
|
+
h("p", { className: "odc-effort-value" }, invalidDefault ? `${value}\uFF08\u5F53\u524D\u4E0D\u53EF\u7528\uFF09` : value ?? "\u7EE7\u627F\u9ED8\u8BA4")
|
|
21024
|
+
),
|
|
20893
21025
|
h("small", {
|
|
20894
|
-
className:
|
|
20895
|
-
id: `${id}-hint
|
|
20896
|
-
|
|
20897
|
-
|
|
21026
|
+
className: "odc-hint",
|
|
21027
|
+
id: `${id}-hint`
|
|
21028
|
+
}, hint),
|
|
21029
|
+
error62 === void 0 ? null : h("small", { className: "odc-hint odc-field-error", id: `${id}-error`, role: "alert" }, error62)
|
|
20898
21030
|
);
|
|
20899
21031
|
}
|
|
20900
21032
|
var PRICE_SITE = "https://corouter.open-design.ai/zh/models/";
|
|
@@ -20913,12 +21045,17 @@ function PriceDetails({ tiers }) {
|
|
|
20913
21045
|
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)))))
|
|
20914
21046
|
)));
|
|
20915
21047
|
}
|
|
20916
|
-
function ModelRow({ model, settings, authoritative, writable, pending, price, priceKnown = false, onCommit }) {
|
|
21048
|
+
function ModelRow({ model, settings, authoritative, writable, pending, disabledReason, protocol = "chat-completions", price, priceKnown = false, onCommit }) {
|
|
20917
21049
|
const id = React.useId();
|
|
20918
21050
|
const mounted = useMounted();
|
|
20919
21051
|
const [error62, setError] = React.useState(void 0);
|
|
20920
21052
|
const [resetToken, setResetToken] = React.useState(0);
|
|
20921
21053
|
const enabled = modelEnabled(model, settings, authoritative);
|
|
21054
|
+
const imageInput = modelImageInput(model, settings);
|
|
21055
|
+
const imageInputManual = settings.imageInput !== void 0;
|
|
21056
|
+
const samplingRestricted = hasRestrictedClaudeSampling(model.id, protocol);
|
|
21057
|
+
const samplingError = claudeSamplingError(model.id, protocol, settings.temperature, settings.topP);
|
|
21058
|
+
const outputError = claudeOutputError(model.id, protocol, settings.maxTokens);
|
|
20922
21059
|
const hasOverrides = Object.keys(settings).length > 0;
|
|
20923
21060
|
const commit = async (next) => {
|
|
20924
21061
|
const saved = await onCommit(next);
|
|
@@ -20929,6 +21066,20 @@ function ModelRow({ model, settings, authoritative, writable, pending, price, pr
|
|
|
20929
21066
|
const next = { ...settings };
|
|
20930
21067
|
if (value === void 0) delete next[key];
|
|
20931
21068
|
else next[key] = value;
|
|
21069
|
+
if ((key === "temperature" || key === "topP") && value !== void 0) {
|
|
21070
|
+
const reason = claudeSamplingError(model.id, protocol, next.temperature, next.topP);
|
|
21071
|
+
if (reason !== void 0) {
|
|
21072
|
+
setError(reason);
|
|
21073
|
+
return false;
|
|
21074
|
+
}
|
|
21075
|
+
}
|
|
21076
|
+
if (key === "maxTokens" && value !== void 0) {
|
|
21077
|
+
const reason = claudeOutputError(model.id, protocol, value);
|
|
21078
|
+
if (reason !== void 0) {
|
|
21079
|
+
setError(reason);
|
|
21080
|
+
return false;
|
|
21081
|
+
}
|
|
21082
|
+
}
|
|
20932
21083
|
const output2 = next.maxTokens ?? model.maxOutputTokens;
|
|
20933
21084
|
const context = next.contextWindow ?? model.contextWindow;
|
|
20934
21085
|
if (output2 !== void 0 && context !== void 0 && output2 >= context) {
|
|
@@ -20943,6 +21094,14 @@ function ModelRow({ model, settings, authoritative, writable, pending, price, pr
|
|
|
20943
21094
|
setResetToken((token) => token + 1);
|
|
20944
21095
|
await commit(void 0);
|
|
20945
21096
|
};
|
|
21097
|
+
const restoreImageInput = async () => {
|
|
21098
|
+
if (!imageInputManual) return;
|
|
21099
|
+
const next = { ...settings };
|
|
21100
|
+
delete next.imageInput;
|
|
21101
|
+
setError(void 0);
|
|
21102
|
+
await commit(next);
|
|
21103
|
+
};
|
|
21104
|
+
const imageDisabledReason = pending ? " \xB7 \u6B63\u5728\u4FDD\u5B58" : !writable ? " \xB7 \u914D\u7F6E\u4E0D\u53EF\u5199" : "";
|
|
20946
21105
|
const facts = [
|
|
20947
21106
|
`\u4E0A\u4E0B\u6587 ${formatTokens(model.contextWindow)}`,
|
|
20948
21107
|
`\u6700\u5927\u8F93\u51FA ${formatTokens(model.maxOutputTokens)}`,
|
|
@@ -20977,11 +21136,46 @@ function ModelRow({ model, settings, authoritative, writable, pending, price, pr
|
|
|
20977
21136
|
)
|
|
20978
21137
|
),
|
|
20979
21138
|
price !== void 0 ? h("p", { className: "odc-price-summary" }, `\u5B98\u7F51\u53C2\u8003 \xB7 ${price.tiers[0].label} \xB7 \u8F93\u5165 ${priceAmount(price.tiers[0].input, price.tiers[0].currency)} / \u8F93\u51FA ${priceAmount(price.tiers[0].output, price.tiers[0].currency)} \xB7 ${priceUnit(price.tiers[0])}${price.tiers.length > 1 ? ` \xB7 \u5171 ${price.tiers.length} \u6863` : ""}`) : priceKnown ? h("p", { className: "odc-price-summary" }, "\u5B98\u7F51\u6682\u672A\u5217\u51FA\u6B64\u6A21\u578B\u4EF7\u683C") : null,
|
|
21139
|
+
h(
|
|
21140
|
+
"div",
|
|
21141
|
+
{ className: "odc-model-image" },
|
|
21142
|
+
h(
|
|
21143
|
+
"label",
|
|
21144
|
+
{ className: "odc-image-toggle" },
|
|
21145
|
+
h("input", {
|
|
21146
|
+
type: "checkbox",
|
|
21147
|
+
checked: imageInput,
|
|
21148
|
+
disabled: !writable || pending,
|
|
21149
|
+
"aria-label": `${model.name} \u56FE\u7247\u8F93\u5165`,
|
|
21150
|
+
"aria-describedby": `${id}-image-state`,
|
|
21151
|
+
onChange: (event) => {
|
|
21152
|
+
setError(void 0);
|
|
21153
|
+
void commit({ ...settings, imageInput: event.target.checked });
|
|
21154
|
+
}
|
|
21155
|
+
}),
|
|
21156
|
+
h("span", null, "\u56FE\u7247\u8F93\u5165")
|
|
21157
|
+
),
|
|
21158
|
+
h("small", { className: "odc-image-state", id: `${id}-image-state` }, imageInputSource(model, settings) + imageDisabledReason),
|
|
21159
|
+
imageInputManual ? h("button", {
|
|
21160
|
+
className: "odc-image-reset",
|
|
21161
|
+
type: "button",
|
|
21162
|
+
disabled: !writable || pending,
|
|
21163
|
+
"aria-label": `${model.name} \u6062\u590D\u56FE\u7247\u8F93\u5165\u81EA\u52A8`,
|
|
21164
|
+
title: "\u4EC5\u79FB\u9664\u56FE\u7247\u8F93\u5165\u624B\u52A8\u8986\u76D6\uFF0C\u4FDD\u7559\u5176\u4ED6\u6A21\u578B\u8BBE\u7F6E",
|
|
21165
|
+
onClick: () => {
|
|
21166
|
+
void restoreImageInput();
|
|
21167
|
+
}
|
|
21168
|
+
}, "\u6062\u590D\u81EA\u52A8") : null
|
|
21169
|
+
),
|
|
20980
21170
|
h(
|
|
20981
21171
|
"details",
|
|
20982
21172
|
{ className: "odc-model-details" },
|
|
20983
21173
|
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"}`),
|
|
20984
21174
|
h("p", { className: "odc-model-meta" }, facts),
|
|
21175
|
+
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,
|
|
21176
|
+
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,
|
|
21177
|
+
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,
|
|
21178
|
+
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,
|
|
20985
21179
|
price === void 0 ? null : h(PriceDetails, { tiers: price.tiers }),
|
|
20986
21180
|
h("p", { className: "odc-hint" }, "\u6570\u503C\u79BB\u5F00\u8F93\u5165\u6846\u540E\u4FDD\u5B58\uFF0C\u7559\u7A7A\u7EE7\u627F\u9ED8\u8BA4\u3002"),
|
|
20987
21181
|
h(
|
|
@@ -20993,6 +21187,9 @@ function ModelRow({ model, settings, authoritative, writable, pending, price, pr
|
|
|
20993
21187
|
field: key,
|
|
20994
21188
|
value: settings[key],
|
|
20995
21189
|
disabled: !writable || pending,
|
|
21190
|
+
restricted: samplingRestricted && (key === "temperature" || key === "topP"),
|
|
21191
|
+
invalid: samplingError !== void 0 && settings[key] !== void 0 && (key === "temperature" || key === "topP") || key === "maxTokens" && outputError !== void 0,
|
|
21192
|
+
maxOutputLimit: samplingRestricted && key === "maxTokens" ? CLAUDE_MESSAGES_MAX_OUTPUT : void 0,
|
|
20996
21193
|
resetToken,
|
|
20997
21194
|
onSave: (value) => saveField(key, value)
|
|
20998
21195
|
})),
|
|
@@ -21000,13 +21197,15 @@ function ModelRow({ model, settings, authoritative, writable, pending, price, pr
|
|
|
21000
21197
|
id: `${id}-effort`,
|
|
21001
21198
|
model,
|
|
21002
21199
|
value: settings.reasoningEffort,
|
|
21003
|
-
disabled: !writable
|
|
21004
|
-
|
|
21200
|
+
disabled: !writable,
|
|
21201
|
+
pending,
|
|
21202
|
+
disabledReason,
|
|
21203
|
+
onSave: async (value) => {
|
|
21005
21204
|
const next = { ...settings };
|
|
21006
21205
|
if (value === "") delete next.reasoningEffort;
|
|
21007
21206
|
else next.reasoningEffort = value;
|
|
21008
21207
|
setError(void 0);
|
|
21009
|
-
return
|
|
21208
|
+
return onCommit(next);
|
|
21010
21209
|
}
|
|
21011
21210
|
})
|
|
21012
21211
|
)
|
|
@@ -21014,12 +21213,12 @@ function ModelRow({ model, settings, authoritative, writable, pending, price, pr
|
|
|
21014
21213
|
error62 !== void 0 ? h("p", { className: "odc-hint odc-field-error", role: "alert" }, error62) : null
|
|
21015
21214
|
);
|
|
21016
21215
|
}
|
|
21017
|
-
function ModelGroup({ title, group, models, settingsMap, authoritative, writable, pending, onCommit, prices }) {
|
|
21216
|
+
function ModelGroup({ title, group, models, settingsMap, authoritative, writable, pending, disabledReason, protocol, onCommit, prices }) {
|
|
21018
21217
|
const [query, setQuery] = React.useState("");
|
|
21019
21218
|
const [expanded, setExpanded] = React.useState(false);
|
|
21020
21219
|
const id = React.useId();
|
|
21021
21220
|
const normalized = query.trim().toLocaleLowerCase();
|
|
21022
|
-
const groupModels = models.filter((model) => model.group === group);
|
|
21221
|
+
const groupModels = sortModelsByEnabled(models.filter((model) => model.group === group), settingsMap, authoritative);
|
|
21023
21222
|
const filtered = groupModels.filter((model) => normalized === "" || `${model.name} ${model.id}`.toLocaleLowerCase().includes(normalized));
|
|
21024
21223
|
const visible = normalized !== "" || expanded ? filtered : filtered.slice(0, 6);
|
|
21025
21224
|
const enabledCount = groupModels.filter((model) => modelEnabled(model, settingsMap[model.id], authoritative)).length;
|
|
@@ -21048,6 +21247,8 @@ function ModelGroup({ title, group, models, settingsMap, authoritative, writable
|
|
|
21048
21247
|
authoritative,
|
|
21049
21248
|
writable,
|
|
21050
21249
|
pending,
|
|
21250
|
+
disabledReason,
|
|
21251
|
+
protocol,
|
|
21051
21252
|
price: prices?.models.find((entry) => entry.id === model.id),
|
|
21052
21253
|
priceKnown: prices !== void 0 && (prices.state !== "error" || prices.stale),
|
|
21053
21254
|
onCommit: (next) => onCommit(model.id, next)
|
|
@@ -21067,6 +21268,7 @@ function Models({ status, formSnapshot, setFormField, pendingField, onRefreshMod
|
|
|
21067
21268
|
const settingsMap = formReady ? formSnapshot.value?.modelSettings ?? {} : status?.config.modelSettings ?? {};
|
|
21068
21269
|
const authoritative = formReady || status?.config.modelSettings !== void 0;
|
|
21069
21270
|
const writable = formSnapshot.status === "ready" && formSnapshot.value !== void 0 && formSnapshot.writable;
|
|
21271
|
+
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";
|
|
21070
21272
|
const pending = pendingField.includes("modelSettings");
|
|
21071
21273
|
const latestSettings = React.useRef(settingsMap);
|
|
21072
21274
|
React.useEffect(() => {
|
|
@@ -21099,7 +21301,7 @@ function Models({ status, formSnapshot, setFormField, pendingField, onRefreshMod
|
|
|
21099
21301
|
"div",
|
|
21100
21302
|
null,
|
|
21101
21303
|
h("h3", null, "\u53EF\u7528\u6A21\u578B"),
|
|
21102
|
-
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")
|
|
21304
|
+
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\u5BB9\u91CF\u4E3A\u76EE\u5F55\u53C2\u8003\uFF0C\u7F51\u5173\u9650\u5236\u53EF\u80FD\u4E0D\u540C\uFF0C\u53EF\u5728\u6A21\u578B\u8BBE\u7F6E\u4E2D\u8986\u76D6\u3002")
|
|
21103
21305
|
),
|
|
21104
21306
|
h(
|
|
21105
21307
|
"div",
|
|
@@ -21132,8 +21334,8 @@ function Models({ status, formSnapshot, setFormField, pendingField, onRefreshMod
|
|
|
21132
21334
|
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(
|
|
21133
21335
|
"div",
|
|
21134
21336
|
{ className: "odc-model-groups" },
|
|
21135
|
-
h(ModelGroup, { title: "\u5957\u9910\u8D60\u9001\u6A21\u578B", group: "plan", models, settingsMap, authoritative, writable, pending, onCommit: commit, prices }),
|
|
21136
|
-
h(ModelGroup, { title: "\u4ED8\u8D39\u6A21\u578B", group: "paid", models, settingsMap, authoritative, writable, pending, onCommit: commit, prices })
|
|
21337
|
+
h(ModelGroup, { title: "\u5957\u9910\u8D60\u9001\u6A21\u578B", group: "plan", models, settingsMap, authoritative, writable, pending, disabledReason, protocol, onCommit: commit, prices }),
|
|
21338
|
+
h(ModelGroup, { title: "\u4ED8\u8D39\u6A21\u578B", group: "paid", models, settingsMap, authoritative, writable, pending, disabledReason, protocol, onCommit: commit, prices })
|
|
21137
21339
|
)
|
|
21138
21340
|
);
|
|
21139
21341
|
}
|
|
@@ -21345,12 +21547,13 @@ function Advanced({ status, formSnapshot, setFormField, pendingField }) {
|
|
|
21345
21547
|
)
|
|
21346
21548
|
);
|
|
21347
21549
|
}
|
|
21348
|
-
function Switch({ checked, disabled, label, hint, onChange }) {
|
|
21550
|
+
function Switch({ checked, disabled, label, ariaLabel, hint, onChange }) {
|
|
21551
|
+
const hintId = React.useId();
|
|
21349
21552
|
return h(
|
|
21350
21553
|
"label",
|
|
21351
21554
|
{ className: "odc-switch" },
|
|
21352
|
-
h("input", { type: "checkbox", checked, disabled, onChange: (event) => onChange(event.target.checked) }),
|
|
21353
|
-
h("span", null, h("span", { className: "odc-switch-text" }, label), h("small", { className: "odc-hint" }, hint))
|
|
21555
|
+
h("input", { type: "checkbox", checked, disabled, "aria-label": ariaLabel, "aria-describedby": hintId, onChange: (event) => onChange(event.target.checked) }),
|
|
21556
|
+
h("span", null, h("span", { className: "odc-switch-text" }, label), h("small", { className: "odc-hint", id: hintId }, hint))
|
|
21354
21557
|
);
|
|
21355
21558
|
}
|
|
21356
21559
|
function loginInFlight(state) {
|