feat: display upstream model maximums as read-only capacity facts

This commit is contained in:
Agent Workbench Dev
2026-11-06 09:31:24 +08:00
parent fda264e40a
commit 2a6554cdc8
7 changed files with 57 additions and 15 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
## 1.25.6
- 默认透传时,模型连接列表、编辑器与原连接设置统一显示“由上游决定”,不再把旧 16000/2048 等非活动容量声明显示成请求上限。上游目录容量独立标明信息来源。
- 默认透传时,模型连接列表、编辑器与原连接设置统一显示“由上游决定”,不再把旧 16000/2048 等非活动容量声明显示成请求上限。逐型号只读显示上游目录声明的最大上下文/最大输出,缺失时显示本地无限制,由上游决定。
- 源码与程序可分别发布:`npm run package:source` 只导出已提交源码;`npm run package:app` 只生成程序与安装器。均不依赖用户项目数据,历史原始证据不再随每次常规发布重复打包。
## 1.25.5 · 默认透传、操作权限与自动Git回滚(已本地交付)
+6
View File
@@ -11,3 +11,9 @@
阶段验证:构建第二轮通过;首轮两个 TypeScript 分支缩窄错误已修复,原日志保留。三协议透传、容量及上游原文相关 25/25 通过;首相关轮 21 项 20 通过、1 个安装回退夹具未到达预期注入点而返回“本机状态文件不存在”,当轮曾与重新构建并行,串行单项复验通过;完整发行专项另行串行复核,不倒改首轮结果。独立源码包与不遍历历史证据的验证已通过。网页真实流程 11 组通过,覆盖 1440/390、连接编辑器、原连接入口、实际无输出上限请求、上游 429 原文、自动写入及回滚,未出现应用/继续审查按钮。Electron 与发行验证继续,正式服务仍是 1.25.5,不以源码已修改代替已经部署。
历史真实供应商稳定性、自主工程交付、缓存收益、普遍重复读取改善、真实预留边界和 Purge 收益仍按原记录保持未验证。本次只使用合成模型服务,不读取或转存真实 Key,不续跑用户项目或旧实验。
用户随后进一步明确需要直接看到每个模型的最大容量:本次将上游目录的当前型号最大上下文/最大输出只读显示在连接卡片和编辑器;代理连接采用相同规则。目录未提供或手动换成另一型号时,显示“本地无限制 · 由上游决定”,不借用旧型号或人工初始值。不修改真实连接或发起真实模型请求。此前 fda264e4 的源码 ZIP 与程序候选已独立生成(源码 1063 文件/3319185 字节),按当时范围保留;未安装正式机。新 UI 重新构建、验证后另冻候选。
补充:发行专项完整串行 16/16 已通过,权限相关原轮 5 项均通过;第一个 21 项轮次的 1 项失败仍按原事实保留。首网页11/Electron12结果属于 fda264e4 对应的第一版显示,不能代签追加最大容量后的屏幕。
追加容量展示已完成构建第3/4轮,网页与实际Electron的1440/390四组定向验证通过:自有代理上游131072上下文/32768输出如实显示且不能编辑;手动换到无元数据型号时两项均显示本地无限制。最终网页再次验证0并发无限制连接的表单可正常保存,修复了原生number输入仍min=1的遗漏。源码导出也先按允许路径筛选再核对Git blob大小,避免扫描历史证据的blob元数据;两项源码归档专项再次通过。准备冻结第二候选,正式升级尚未进行。
+5 -2
View File
@@ -18,7 +18,11 @@ export function packageSource({ root = process.cwd(), outputRoot = path.join(roo
const sourceCommit = git(['rev-parse', 'HEAD']).toString().trim();
const version = JSON.parse(git(['show', sourceCommit + ':package.json'])).version;
if (!/^\d+\.\d+\.\d+(?:-[a-z0-9.-]+)?$/i.test(version)) throw new Error('Invalid committed program version.');
const tree = git(['ls-tree', '-r', '--long', '-z', sourceCommit]).toString('utf8').split('\0').filter(Boolean).map(line => {
const selectedPaths = git(['ls-tree', '-r', '--name-only', '-z', sourceCommit]).toString('utf8').split('\0').filter(name =>
files.includes(name) || directories.some(directory => name.startsWith(directory + '/')) || guide(name));
const roots = [...directories.filter(name => selectedPaths.some(file => file.startsWith(name + '/'))),
...files.filter(name => selectedPaths.includes(name)), ...selectedPaths.filter(guide)];
const tree = git(['ls-tree', '-r', '--long', '-z', sourceCommit, '--', ...roots]).toString('utf8').split('\0').filter(Boolean).map(line => {
const match = /^(\d+) (\w+) ([a-f0-9]+)\s+(\d+|-)\t([\s\S]+)$/.exec(line);
if (!match) throw new Error('Invalid committed source entry.');
return { mode: match[1], type: match[2], gitBlob: match[3], bytes: Number(match[4]), path: match[5] };
@@ -26,7 +30,6 @@ export function packageSource({ root = process.cwd(), outputRoot = path.join(roo
const entries = tree.filter(row => files.includes(row.path) || directories.some(name => row.path.startsWith(name + '/')) || guide(row.path));
if (!entries.some(row => row.path === 'package-lock.json') || !entries.some(row => row.path.startsWith('src/'))) throw new Error('Committed source and dependency lock are required.');
if (entries.some(row => row.type !== 'blob' || !['100644', '100755'].includes(row.mode))) throw new Error('Source release requires regular committed files, without links or submodules.');
const roots = [...directories.filter(name => entries.some(row => row.path.startsWith(name + '/'))), ...files.filter(name => entries.some(row => row.path === name)), ...entries.filter(row => guide(row.path)).map(row => row.path)];
const name = `Agent-Workbench-${version}-source-code-${sourceCommit.slice(0, 8)}-${randomUUID()}`;
fs.mkdirSync(outputRoot, { recursive: true });
const archive = path.join(outputRoot, name + '.zip'), fd = fs.openSync(archive, 'wx');
+20 -2
View File
@@ -12,9 +12,10 @@ import { openDefaults } from '../src/shared/contracts/execution-policy.mjs';
if (process.argv.includes('--help')) { console.log('node scripts/verify-open-formal-ui.mjs [--desktop] — read-only formal installed UI inspection; no model requests, permission edits or user project execution.'); process.exit(0); }
assert.ok(process.argv.slice(2).every(arg => arg === '--desktop'));
const desktop = process.argv.includes('--desktop'), url = 'http://127.0.0.1:4318';
const root = path.resolve('.qa/unrestricted-1.25.5', (desktop ? 'formal-electron-' : 'formal-web-') + randomUUID()); fs.mkdirSync(root, { recursive: true });
const expectedVersion = JSON.parse(fs.readFileSync('package.json', 'utf8')).version;
const root = path.resolve('.qa/open-formal-ui-' + expectedVersion, (desktop ? 'formal-electron-' : 'formal-web-') + randomUUID()); fs.mkdirSync(root, { recursive: true });
const boot = await (await fetch(url + '/api/bootstrap', { headers: { Connection: 'close' } })).json();
assert.equal(boot.version, '1.25.5'); assert.equal(boot.config.approvalMode, 'full');
assert.equal(boot.version, expectedVersion); assert.equal(boot.config.approvalMode, 'full');
for (const [key, value] of Object.entries(openDefaults)) assert.equal(boot.config[key], value, key);
const host = await (await fetch(url + '/api/host/status', { headers: { 'X-Workbench-Token': boot.token, Connection: 'close' } })).json(); assert.equal(host.activity.active, false);
let browser, app, page, window, result; const screenshots = [], errors = [];
@@ -39,6 +40,23 @@ try {
await expect(dialog.getByLabel('额度策略', { exact: true })).toHaveValue('unrestricted');
await expect(dialog.getByLabel('输出上限', { exact: true })).toHaveCount(0);
const file = path.join(root, 'open-budget-390.png'); await page.screenshot({ path: file, fullPage: true }); screenshots.push(file);
await dialog.getByRole('button', { name: '模型连接', exact: true }).click();
const center = await (await fetch(url + '/api/model-center', { headers: { 'X-Workbench-Token': boot.token, Connection: 'close' } })).json();
const connection = center.connections.find(value => value.id !== 'legacy-default' && value.enabled);
if (connection) {
const card = dialog.locator('.mc-connection').filter({ has: page.getByRole('heading', { name: connection.name, exact: true }) });
await card.getByRole('button', { name: '编辑', exact: true }).click();
const editor = dialog.getByRole('form', { name: '编辑模型连接', exact: true });
await expect(editor.getByLabel('上下文上限', { exact: true })).toHaveCount(0);
await expect(editor.getByLabel('输出上限', { exact: true })).toHaveCount(0);
const upstream = connection.upstreamModel?.id === connection.model ? connection.upstreamModel : {};
for (const [field, label] of [['contextLimit', '模型最大上下文'], ['maxOutputTokens', '模型最大输出']]) {
await expect(editor.getByLabel(label, { exact: true })).toHaveText(upstream[field] ? Number(upstream[field]).toLocaleString() + ' tokens' : '本地无限制 · 由上游决定');
}
await editor.getByLabel('连接容量策略', { exact: true }).scrollIntoViewIfNeeded();
const capacityFile = path.join(root, 'model-capacity-390.png'); await page.screenshot({ path: capacityFile, fullPage: true }); screenshots.push(capacityFile);
await editor.getByRole('button', { name: '取消', exact: true }).click();
}
await dialog.getByRole('button', { name: '关闭窗口', exact: true }).click();
assert.deepEqual(errors, []); result = { success: true, version: boot.version, pid: host.identity.pid, runtimeRoot: boot.runtimeRoot, desktop, screenshots, errors, realModelRequests: 0, userProjectsExecuted: 0, writes: 0 };
} catch (error) { if (page) await page.screenshot({ path: path.join(root, 'failure.png'), fullPage: true }).catch(() => {}); result = { success: false, error: error.stack, desktop, screenshots, errors }; }
+17 -7
View File
@@ -13,9 +13,9 @@ import { HostController } from '../src/core/desktop/host-controller.mjs';
import { desktopExecutableIdentity } from '../src/core/desktop/app-installation.mjs';
import { projectEnvironment } from '../src/core/process-environment.mjs';
if (process.argv.includes('--help')) { console.log('node scripts/verify-unrestricted-ui.mjs [--desktop] — isolated actual passthrough, permissions, automatic writes/rollback, upstream errors and cache UI. Optional AGENT_WORKBENCH_QA_APP_ROOT selects the immutable app. No real-model keys.'); process.exit(0); }
assert.ok(process.argv.slice(2).every(value => value === '--desktop'));
const desktop = process.argv.includes('--desktop'), appRoot = path.resolve(process.env.AGENT_WORKBENCH_QA_APP_ROOT || '.');
if (process.argv.includes('--help')) { console.log('node scripts/verify-unrestricted-ui.mjs [--desktop] [--capacity-only] — isolated passthrough, permissions, model capacity, writes/rollback, errors and cache UI. --capacity-only focuses on permissions and model-capacity display. Optional AGENT_WORKBENCH_QA_APP_ROOT selects the immutable app. No real-model keys.'); process.exit(0); }
assert.ok(process.argv.slice(2).every(value => ['--desktop', '--capacity-only'].includes(value)));
const desktop = process.argv.includes('--desktop'), capacityOnly = process.argv.includes('--capacity-only'), appRoot = path.resolve(process.env.AGENT_WORKBENCH_QA_APP_ROOT || '.');
const directory = path.resolve('.qa/unrestricted-1.25.5', (desktop ? 'open-electron-' : 'open-web-') + randomUUID());
fs.mkdirSync(directory, { recursive: true }); console.log('EVIDENCE ' + directory);
const disposers = [], t = { after: fn => disposers.push(fn) }, f = fixture(t, { modernDefaults: true }), checks = [], screenshots = [], errors = [];
@@ -114,14 +114,21 @@ try {
mark('open defaults save as real zeros, survive reload, hide local quotas and retain model selection at 1440 and 390 pixels');
await resize(1440); await dialog().getByRole('button', { name: '模型连接', exact: true }).click();
const connectedCard = () => dialog().locator('.mc-connection').filter({ has: page.getByRole('heading', { name: connection.name, exact: true }) });
await expect(connectedCard()).toContainText('默认透传 · 由上游决定');
await expect(connectedCard()).toContainText('模型最大上下文'); await expect(connectedCard()).toContainText('131,072 tokens');
await expect(connectedCard()).toContainText('32,768 tokens');
await connectedCard().getByRole('button', { name: '编辑', exact: true }).click();
const connectionEditor = () => dialog().getByRole('form', { name: '编辑模型连接', exact: true });
await expect(connectionEditor().getByLabel('上下文上限', { exact: true })).toHaveCount(0);
await expect(connectionEditor().getByLabel('输出上限', { exact: true })).toHaveCount(0);
await expect(connectionEditor().getByLabel('连接容量策略', { exact: true })).toContainText('默认透传 · 不设本地上限');
await expect(connectionEditor().getByLabel('模型最大上下文', { exact: true })).toHaveText('131,072 tokens');
await expect(connectionEditor().getByLabel('模型最大输出', { exact: true })).toHaveText('32,768 tokens');
assert.equal(await connectionEditor().evaluate(form => form.checkValidity()), true, 'An unlimited zero-concurrency connection must remain saveable.');
await expect(connectionEditor().getByRole('button', { name: '填入开发初始值', exact: true })).toHaveCount(0);
for (const width of [1440, 390]) { await resize(width); await connectionEditor().getByLabel('连接容量策略', { exact: true }).scrollIntoViewIfNeeded(); await shot('connection-passthrough-' + width); }
await connectionEditor().getByLabel('请求模型名称', { exact: true }).fill('owned-model-without-metadata');
await expect(connectionEditor().getByLabel('模型最大上下文', { exact: true })).toHaveText('本地无限制 · 由上游决定');
await expect(connectionEditor().getByLabel('模型最大输出', { exact: true })).toHaveText('本地无限制 · 由上游决定');
await connectionEditor().getByRole('button', { name: '取消', exact: true }).click();
await resize(1440); await dialog().locator('.mc-connection').filter({ has: page.getByRole('heading', { name: '原模型连接', exact: true }) }).getByRole('button', { name: '编辑', exact: true }).click();
const legacy = page.getByRole('dialog', { name: '原连接与演示设置', exact: true });
@@ -129,7 +136,8 @@ try {
await expect(legacy.getByLabel('上下文预算', { exact: true })).toHaveCount(0);
await expect(legacy.getByLabel('输出上限', { exact: true })).toHaveCount(0);
await legacy.getByRole('button', { name: '取消', exact: true }).click(); await open();
mark('connection list, editor and legacy settings display active passthrough without inactive 16000/2048 ceilings');
mark('proxy models display upstream maximums read-only; absent or different-model metadata shows unlimited local passthrough without 16000/2048 ceilings');
if (!capacityOnly) {
await resize(1440); await dialog().getByRole('button', { name: '等待时限', exact: true }).click();
const waits = () => dialog().getByRole('form', { name: '模型等待时限', exact: true });
await expect(waits().getByLabel('单次模型响应上限(秒)', { exact: true })).toHaveValue('0');
@@ -247,9 +255,11 @@ try {
await host.api('/sessions/' + browserSession.id + '/browsing/tabs/' + ownedTabId + '/close', { approved: true });
mark('actual Electron full access opens localhost, retains large DOM and 133 controls, fills password/select and navigates across origins without a manual approval');
}
}
assert.deepEqual(errors, []);
assert.equal(model.requests.filter(row => row.input).length, desktop ? 13 : 7);
result={success:true,version:host.bootstrap.version,appRoot,actualElectron:desktop,checks,screenshots,errors,realModelRequests:0,ownedModelRequests:desktop ? 13 : 7,directoryGets:model.requests.filter(row => !row.input).length,officialServiceTouched:false};
const expectedRequests = capacityOnly ? 2 : desktop ? 13 : 7;
assert.equal(model.requests.filter(row => row.input).length, expectedRequests);
result={success:true,version:host.bootstrap.version,appRoot,actualElectron:desktop,capacityOnly,checks,screenshots,errors,realModelRequests:0,ownedModelRequests:expectedRequests,directoryGets:model.requests.filter(row => !row.input).length,officialServiceTouched:false};
} catch(error) {if(page)await shot('failure').catch(()=>{});result={success:false,appRoot,actualElectron:desktop,checks,screenshots,errors,error:error.stack,realModelRequests:0};}
finally {if(application)await application.close();if(browser)await browser.close();if(controller&&await controller.health())await controller.stop();await host?.close?.();for(const dispose of disposers.reverse())await dispose();fs.writeFileSync(path.join(directory,'result.json'),JSON.stringify(result,null,2));}
console.log(JSON.stringify({directory,...result}));if(!result.success)process.exitCode=1;
+1
View File
@@ -28,3 +28,4 @@
.mc-section-title .mc-row-actions,.mc-catalog .mc-row-actions{display:flex;flex-wrap:wrap;gap:8px}.mc-catalog{margin-bottom:24px;border-top:3px solid #2560a3;min-width:0}.mc-catalog-heading{display:flex;align-items:end;flex-wrap:wrap;gap:12px;margin:18px 0 12px}.mc-catalog-heading label{display:grid;gap:7px;flex:1;min-width:180px}.mc-catalog-heading input{padding:10px;border:1px solid #a9bdcf;border-radius:5px;width:100%;min-width:0;background:#fff}.mc-catalog-heading>span{font-size:12px;color:#40566e;padding:10px 0}.mc-catalog-list{margin:12px 0;max-height:440px;overflow:auto;border:1px solid #b8cadb;border-radius:5px;background:#fff;overscroll-behavior:contain}.mc-catalog-model{display:flex;gap:12px;align-items:start;padding:13px 14px;border-bottom:1px solid #d3dde7;cursor:pointer;min-width:0}.mc-catalog-model:last-child{border-bottom:0}.mc-catalog-model.is-selected{background:#eaf2fa}.mc-catalog-model>input{margin-top:4px;flex:0 0 auto;width:18px;height:18px;accent-color:#2560a3}.mc-catalog-model>span{display:grid;gap:5px;min-width:0;overflow-wrap:anywhere;line-height:1.6}.mc-catalog-model strong{font-family:Consolas,"Microsoft YaHei",monospace;font-size:13px}.mc-catalog-model small{font-size:12px;color:#40566e}.mc-catalog input:focus-visible{outline:2px solid #2560a3;outline-offset:2px}.mc-catalog>.mc-checkbox{display:flex;align-items:start;gap:9px;line-height:1.8;margin:16px 0;color:#40566e;font-size:12px}.mc-catalog>.mc-checkbox>input{flex:0 0 auto;margin-top:4px}
@media(max-width:620px){.mc-catalog-heading{align-items:stretch}.mc-catalog-heading>span{padding:0}.mc-catalog-model{padding:12px 10px;gap:10px}.mc-catalog-model>input{width:22px;height:22px}.mc-catalog-list{max-height:380px}.mc-catalog .mc-section-title>.button{align-self:flex-end}}
.mc-reasoning .mc-form-grid{margin-top:12px}.mc-reasoning .mc-help{color:#40566e;font-size:12px}.mc-feature-scope{font-size:12px;line-height:1.7;margin:12px 0;overflow-wrap:anywhere}.mc-feature-scope summary{cursor:pointer;color:#245b92;padding:8px 0;min-height:40px}.mc-feature-scope table{width:100%;table-layout:fixed;border-collapse:collapse;margin-top:10px}.mc-feature-scope th,.mc-feature-scope td{text-align:left;vertical-align:top;border-bottom:1px solid #d3dde7;padding:9px 7px;font-size:12px;color:#40566e}.mc-feature-scope th{font-weight:600}.mc-reasoning input:focus-visible{outline:2px solid #2560a3;outline-offset:2px}
.mc-capacity-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:16px 0}.mc-capacity-facts dt{color:#40566e;font-size:12px;margin-bottom:6px}.mc-capacity-facts dd{margin:0;color:#16324c;font-size:16px;font-weight:650;line-height:1.5;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}@media(max-width:620px){.mc-capacity-facts{grid-template-columns:1fr;gap:12px}}
+7 -3
View File
@@ -16,6 +16,10 @@ import { ModelCatalog } from './ModelCatalog';
import type { CatalogModel } from '../shared/contracts/model-catalog.mjs';
const previewUrl = (value: { protocol: string; baseUrl: string }) => { try { return modelRequestUrl(value); } catch { return '请填写有效的接口根地址'; } };
const upstreamCapacity = (value: { model: string; upstreamModel?: CatalogModel }, field: 'contextLimit' | 'maxOutputTokens') => {
const tokens = value.upstreamModel?.id === value.model ? value.upstreamModel[field] : undefined;
return typeof tokens === 'number' && tokens > 0 ? tokens.toLocaleString() + ' tokens' : '本地无限制 · 由上游决定';
};
type Connection = { id: string; name: string; brand: string; protocol: string; parameterProfile?: string; messagesAuth?: string; baseUrl: string; model: string; enabled: boolean; revision: number; hasKey: boolean; credentialSource?: { connectionId: string }; upstreamModel?: CatalogModel;
requiresKey: boolean; modelIdentityPolicy?: string; modelIdentityAliases?: string[]; modelIdentityAliasSource?: string; nativeParameters?: Record<string, unknown>; outputTokenField?: string; streaming?: boolean; capabilityDeclarations?: Record<string, string>; capabilities?: Record<string, string>; capabilityEvidence?: { checkedAt: string }; contextLimit: number; maxOutputTokens: number; concurrency: number; status: string; activeRequests: number; savedCredential?: { status: string }; health: { state: string; reason?: string; cooldownUntil?: number } };
@@ -120,7 +124,7 @@ export function ModelCenter({ onConfig, onLegacy, busy, runModel }: { onConfig:
{catalogSource !== null && <ModelCatalog key={catalogSource} sources={view.connections} sourceId={catalogSource} busy={locked} onSaved={refresh} onClose={() => setCatalogSource(null)} />}
<div className="mc-connections">{view.connections.map(value => <article className={'mc-connection ' + (!value.enabled ? 'mc-disabled' : '')} key={value.id}>
<div className="mc-card-heading"><span className="mc-service-icon"><Server size={20} /></span><div><h4>{value.name}</h4><span>{value.brand} · {protocolLabel(value.protocol)}{value.streaming ? ' · 流式开启' : ''}</span></div><span className={'mc-state mc-state-' + value.status}>{states[value.status]}</span></div>
<dl><dt>模型</dt><dd>{value.model || '尚未填写'}</dd><dt>请求地址</dt><dd>{previewUrl(value)}</dd>{value.protocol === 'anthropic-messages' && <><dt>鉴权</dt><dd>{value.messagesAuth === 'bearer' ? 'Bearer' : 'x-api-key'} · anthropic-version 2023-06-01</dd></>}<dt>凭据</dt><dd>{value.credentialSource ? '共用 ' + (view.connections.find(source => source.id === value.credentialSource!.connectionId)?.name ?? '源连接') + (value.hasKey ? ' 的上游凭据' : ';请核对源连接是否启用及凭据') : value.hasKey ? value.savedCredential?.status === 'saved' ? '已设置,可从本机加密保存加载' : '已设置,重启需重新填写' : value.requiresKey ? '尚未填写' : '此服务可不填'}</dd><dt>当前请求</dt><dd>{value.activeRequests} 在途 · 并发 {value.concurrency}</dd><dt>{passthrough ? '上下文 / 输出' : '连接容量声明'}</dt><dd>{passthrough ? '默认透传 · 由上游决定' : `上下文 ${value.contextLimit.toLocaleString()} · 输出 ${value.maxOutputTokens.toLocaleString()}`}</dd></dl>
<dl><dt>模型</dt><dd>{value.model || '尚未填写'}</dd><dt>请求地址</dt><dd>{previewUrl(value)}</dd>{value.protocol === 'anthropic-messages' && <><dt>鉴权</dt><dd>{value.messagesAuth === 'bearer' ? 'Bearer' : 'x-api-key'} · anthropic-version 2023-06-01</dd></>}<dt>凭据</dt><dd>{value.credentialSource ? '共用 ' + (view.connections.find(source => source.id === value.credentialSource!.connectionId)?.name ?? '源连接') + (value.hasKey ? ' 的上游凭据' : ';请核对源连接是否启用及凭据') : value.hasKey ? value.savedCredential?.status === 'saved' ? '已设置,可从本机加密保存加载' : '已设置,重启需重新填写' : value.requiresKey ? '尚未填写' : '此服务可不填'}</dd><dt>当前请求</dt><dd>{value.activeRequests} 在途 · 并发 {value.concurrency}</dd>{passthrough ? <><dt>模型最大上下文</dt><dd>{upstreamCapacity(value, 'contextLimit')}</dd><dt>模型最大输出</dt><dd>{upstreamCapacity(value, 'maxOutputTokens')}</dd></> : <><dt>连接容量声明</dt><dd>上下文 {value.contextLimit.toLocaleString()} · 输出 {value.maxOutputTokens.toLocaleString()}</dd></>}</dl>
{value.upstreamModel && <p className="mc-help">型号来自上游目录,能力按目录声明与显式设置保存;可在“推理与能力”查看已接入范围。</p>}
<div className="mc-capabilities">{Object.entries(capabilityLabels).map(([key, title]) => <span key={key} data-capability={value.capabilities?.[key] ?? 'unknown'}>{title}:{capabilityStates[value.capabilities?.[key] ?? 'unknown']}</span>)}</div>
{value.health.reason && <p className="mc-card-warning">{value.health.reason}{!!value.health.cooldownUntil && value.health.cooldownUntil > Date.now() && ' · 冷却至 ' + new Date(value.health.cooldownUntil).toLocaleTimeString()}</p>}
@@ -149,12 +153,12 @@ export function ModelCenter({ onConfig, onLegacy, busy, runModel }: { onConfig:
<label className="mc-full">允许的返回型号(可选,逗号分隔)<input value={draft.modelIdentityAliasesText} onChange={event => setDraft({ ...draft, modelIdentityAliasesText: event.target.value })} /></label>
<label className="mc-full">型号映射依据<input required={draft.modelIdentityAliasesText.trim().length > 0} value={draft.modelIdentityAliasSource} placeholder="填写供应商映射说明或可核对的出处" onChange={event => setDraft({ ...draft, modelIdentityAliasSource: event.target.value })} /></label>
<label>临时 API Key<input type="password" autoComplete="off" value={key} placeholder={draft.id ? '留空保留本次凭据' : '按服务要求填写'} onChange={event => setKey(event.target.value)} /></label>
{passthrough ? <div className="mc-full" aria-label="连接容量策略"><strong>默认透传 · 不设本地上限</strong><p className="mc-help">完整发送上下文,不附加输出 token 上限。实际容量与限额由上游决定,上游错误原文保留。</p>{(draft.upstreamModel?.contextLimit || draft.upstreamModel?.maxOutputTokens) && <p className="mc-help">上游目录声明:{[draft.upstreamModel?.contextLimit && `上下文 ${draft.upstreamModel.contextLimit.toLocaleString()}`, draft.upstreamModel?.maxOutputTokens && `最大输出 ${draft.upstreamModel.maxOutputTokens.toLocaleString()}`].filter(Boolean).join(' · ')}。仅展示上游信息。</p>}</div> : <>
{passthrough ? <div className="mc-full" aria-label="连接容量策略"><strong>默认透传 · 不设本地上限</strong><dl className="mc-capacity-facts"><div><dt>模型最大上下文</dt><dd aria-label="模型最大上下文">{upstreamCapacity(draft, 'contextLimit')}</dd></div><div><dt>模型最大输出</dt><dd aria-label="模型最大输出">{upstreamCapacity(draft, 'maxOutputTokens')}</dd></div></dl><p className="mc-help">容量数值来自当前型号的上游目录,仅供查看;上游未提供时显示本地无限制。完整发送上下文,不附加输出 token 上限,上游错误原文保留。</p></div> : <>
<label>上下文上限<input type="number" required step="1" min="1000" value={draft.contextLimit} onChange={event => setDraft({ ...draft, contextLimit: Number(event.target.value) })} /></label>
<label>输出上限<input type="number" required step="1" min="256" value={draft.maxOutputTokens} onChange={event => setDraft({ ...draft, maxOutputTokens: Number(event.target.value) })} /></label>
<div className="mc-full"><p className="mc-help">容量优先使用上游目录声明;未提供时需要按供应商核对。推理可能共享输出额度。</p><button type="button" className="button secondary" onClick={() => setDraft({ ...draft, contextLimit: draft.upstreamModel?.contextLimit ?? DEFAULT_MODEL_CAPACITY.contextLimit, maxOutputTokens: draft.upstreamModel?.maxOutputTokens ?? DEFAULT_MODEL_CAPACITY.maxOutputTokens })}>{draft.upstreamModel?.contextLimit || draft.upstreamModel?.maxOutputTokens ? '采用上游容量' : '填入开发初始值'}</button></div>
</>}
<label>并发请求上限<input type="number" min="1" max="8" value={draft.concurrency} onChange={event => setDraft({ ...draft, concurrency: Number(event.target.value) })} /></label>
<label>{runtimeConfig?.executionMode === 'unrestricted' ? '并发请求数(0 为不限)' : '并发请求上限'}<input type="number" min={runtimeConfig?.executionMode === 'unrestricted' ? 0 : 1} max={runtimeConfig?.executionMode === 'unrestricted' ? undefined : 8} value={draft.concurrency} onChange={event => setDraft({ ...draft, concurrency: Number(event.target.value) })} /></label>
<label className="mc-checkbox"><input type="checkbox" checked={draft.requiresKey} onChange={event => setDraft({ ...draft, requiresKey: event.target.checked })} />服务需要 API Key</label></div>
<label className="mc-checkbox"><input type="checkbox" checked={persistKey} onChange={event => setPersistKey(event.target.checked)} />本机加密保存本次填写的 API Key</label>
<p className="mc-help"><CircleHelp size={14} />品牌仅用于分类,请选择服务实际提供的协议。能力检测会发起一次模型请求,可能产生费用;使用合成输入,不发送项目文件。文本检测不能证明工具或视觉能力。配置变化后需重新检测并核对凭据保存状态。</p>