|
|
|
@@ -55,7 +55,7 @@ try {
|
|
|
|
|
}
|
|
|
|
|
return completion([], 'Owned full browser flow complete.');
|
|
|
|
|
};
|
|
|
|
|
const model = await compatibleFixture(t, (url, body) => ownedFailure ? { status: 429, body: { error: { code: 'owned_rate', type: 'owned_original', message: 'UI-UPSTREAM-ORIGINAL', detail: '原始上游正文'.repeat(6000) } }, headers: { 'x-request-id': 'owned-ui-error-id' } } : url.endsWith('/models') ? { data: [{ id: 'owned-capacity', context_length: 131072, max_output_tokens: 32768, capabilities: { text: true, tools: true } }] }
|
|
|
|
|
const model = await compatibleFixture(t, (url, body) => ownedFailure ? { status: 429, body: { error: { code: 'owned_rate', type: 'owned_original', message: 'UI-UPSTREAM-ORIGINAL', detail: '原始上游正文'.repeat(6000) } }, headers: { 'x-request-id': 'owned-ui-error-id' } } : url.endsWith('/models') ? { data: [{ id: 'owned-capacity', context_length: 131072, max_output_tokens: 32768, capabilities: { text: true, tools: true } }, ...Array.from({ length: 121 }, (_, index) => ({ id: 'owned-bulk-' + index, capabilities: { text: true, tools: true } }))] }
|
|
|
|
|
: body.messages.some(row => row.role === 'user' && row.content.includes('FULL-BROWSER-FLOW')) ? browserReply(body)
|
|
|
|
|
: body.messages.some(row => row.role === 'user' && row.content.includes('PERMISSION-FLOW')) ? completion(body.messages.some(row => row.role === 'tool') ? [] : [call('owned-permission', 'run_command', { command: process.platform === 'win32' ? 'Write-Output "OWNED-PERMISSION-MARKER"' : 'printf OWNED-PERMISSION-MARKER', reason: 'Verify permission switching in the actual UI.' })], 'Permission flow complete.')
|
|
|
|
|
: body.messages.some(row => row.role === 'user' && row.content.includes('AUTO-WRITE-FLOW')) ? completion(body.messages.some(row => row.role === 'tool') ? [] : [call('owned-write', 'propose_file', { path: 'ui-auto.txt', content: 'OWNED-APPLIED\n', reason: 'Verify automatic writes and exact rollback.' })], 'File flow complete.')
|
|
|
|
@@ -112,6 +112,50 @@ try {
|
|
|
|
|
await expect(budgets().getByLabel('额度策略', { exact: true })).toHaveValue('unrestricted');
|
|
|
|
|
for (const width of [1440,390]) { await resize(width); assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1)); await shot('open-settings-' + width); }
|
|
|
|
|
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 waits = () => dialog().getByRole('form', { name: '模型等待时限', exact: true });
|
|
|
|
|
await expect(waits().getByLabel('单次模型响应上限(秒)', { exact: true })).toHaveValue('0');
|
|
|
|
|
await expect(waits().getByLabel('流式无数据上限(秒)', { exact: true })).toHaveValue('0');
|
|
|
|
|
await waits().getByLabel('单次模型响应上限(秒)', { exact: true }).fill('960');
|
|
|
|
|
await waits().getByLabel('流式无数据上限(秒)', { exact: true }).fill('901');
|
|
|
|
|
await waits().getByRole('button', { name: '保存等待时限', exact: true }).click();
|
|
|
|
|
await expect(dialog().getByRole('status').filter({ hasText: '等待时限已保存' })).toBeVisible();
|
|
|
|
|
await page.reload(); await open(); await dialog().getByRole('button', { name: '等待时限', exact: true }).click();
|
|
|
|
|
await expect(waits().getByLabel('单次模型响应上限(秒)', { exact: true })).toHaveValue('960');
|
|
|
|
|
await expect(waits().getByLabel('流式无数据上限(秒)', { exact: true })).toHaveValue('901');
|
|
|
|
|
for (const label of ['单次模型响应上限(秒)', '流式无数据上限(秒)']) await waits().getByLabel(label, { exact: true }).fill('0');
|
|
|
|
|
await waits().getByRole('button', { name: '保存等待时限', exact: true }).click();
|
|
|
|
|
await expect(dialog().getByRole('status').filter({ hasText: '等待时限已保存' })).toBeVisible();
|
|
|
|
|
assert.deepEqual((await host.api('/model-center')).waitSettings, { modelResponseTimeoutMs: 0, modelStreamIdleTimeoutMs: 0 });
|
|
|
|
|
for (const width of [1440,390]) { await resize(width); await shot('unlimited-waits-' + width); }
|
|
|
|
|
mark('wait settings accept zero and values beyond old ceilings, persist after reload and restore unlimited waits');
|
|
|
|
|
await resize(1440); await dialog().getByRole('button', { name: '模型连接', exact: true }).click();
|
|
|
|
|
await dialog().getByRole('button', { name: '从上游添加模型', exact: true }).click();
|
|
|
|
|
const catalog = () => dialog().getByRole('region', { name: '上游模型目录', exact: true });
|
|
|
|
|
await catalog().getByLabel('目录上游连接', { exact: true }).selectOption(source.id);
|
|
|
|
|
await catalog().getByRole('button', { name: '获取上游模型', exact: true }).click();
|
|
|
|
|
await expect(catalog().getByLabel('上游模型列表', { exact: true }).getByRole('checkbox')).toHaveCount(122);
|
|
|
|
|
await catalog().getByRole('button', { name: '选中当前筛选', exact: true }).click();
|
|
|
|
|
await catalog().getByLabel('模型使用方式', { exact: true }).selectOption('auto');
|
|
|
|
|
await expect(catalog().getByRole('button', { name: '保存所选 122 个模型', exact: true })).toBeEnabled();
|
|
|
|
|
await expect(catalog()).toContainText('目录、连接和自动池不设本地数量上限');
|
|
|
|
|
for (const width of [1440,390]) { await resize(width); await shot('open-model-selection-' + width); }
|
|
|
|
|
await catalog().getByRole('button', { name: '关闭目录', exact: true }).click();
|
|
|
|
|
assert.deepEqual((await host.api('/model-center')).selected, originalSelection);
|
|
|
|
|
await dialog().getByRole('navigation', { name: '模型中心分类', exact: true }).getByRole('button', { name: '连接诊断', exact: true }).click();
|
|
|
|
|
const network = () => dialog().getByRole('region', { name: '模型连接诊断', exact: true });
|
|
|
|
|
await network().getByLabel('诊断连接', { exact: true }).selectOption(source.id);
|
|
|
|
|
await network().getByRole('button', { name: '开始直连检查', exact: true }).click();
|
|
|
|
|
await expect(network().getByRole('status')).toHaveText('直连握手通过');
|
|
|
|
|
await expect(network()).toContainText('保留全部检查记录');
|
|
|
|
|
await network().locator('details summary').click();
|
|
|
|
|
await expect(network().getByText('不限 / 不限', { exact: true })).toBeVisible();
|
|
|
|
|
const diagnostic = (await host.api('/model-center/network-diagnostics')).jobs[0];
|
|
|
|
|
assert.equal(diagnostic.status, 'passed'); assert.equal(diagnostic.budgetMs, 0); assert.equal(diagnostic.stageTimeoutMs, 0);
|
|
|
|
|
assert.equal(diagnostic.httpRequests, 0); assert.equal(diagnostic.modelRequests, 0);
|
|
|
|
|
for (const width of [1440,390]) { await resize(width); await shot('open-network-diagnostic-' + width); }
|
|
|
|
|
mark('catalog UI selects 122 models and enables automatic routing; actual TCP diagnostics show unlimited waits and complete history');
|
|
|
|
|
await resize(1440); await dialog().getByRole('button', { name: '运行预算', exact: true }).click();
|
|
|
|
|
await budgets().getByLabel('额度策略', { exact: true }).selectOption('restricted');
|
|
|
|
|
await budgets().getByLabel('容量策略', { exact: true }).selectOption('manual');
|
|
|
|
|
await budgets().getByLabel('输出上限', { exact: true }).fill('32768');
|
|
|
|
@@ -184,7 +228,7 @@ try {
|
|
|
|
|
}
|
|
|
|
|
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:1,officialServiceTouched:false};
|
|
|
|
|
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};
|
|
|
|
|
} 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;
|
|
|
|
|