修复 AGC 运行时配置模型方案测试断言
Project CI / Repository checks (pull_request) Successful in 4m23s
Project CI / Frontend tests (pull_request) Successful in 5m11s
Project CI / Backend tests (pull_request) Successful in 7m25s
Project CI / Native shell tests (pull_request) Failing after 15m15s

将推理档断言迁移到模型方案管理面板的推理档位选择器

补充持久化测试 fixture 的 modelProfiles 与选中方案字段

同步保存回写断言中的模型方案结构
This commit is contained in:
2026-09-04 15:19:01 +08:00
parent 020f7d7a7a
commit 13639d9f8c
@@ -725,9 +725,17 @@ export function registerRuntimeSettingsTests() {
expect(
await screen.findByRole('dialog', { name: '运行时配置' }),
).not.toBeNull();
fireEvent.keyDown(screen.getByLabelText('推理档'), {
fireEvent.click(screen.getByRole('button', { name: '配置模型方案' }));
expect(
await screen.findByRole('dialog', { name: '模型方案管理' }),
).not.toBeNull();
fireEvent.keyDown(screen.getByLabelText('陶泥儿智能创作 显示名称'), {
key: 'Escape',
});
expect(screen.getByRole('dialog', { name: '模型方案管理' })).not.toBeNull();
fireEvent.keyDown(window, { key: 'Escape' });
expect(screen.queryByRole('dialog', { name: '模型方案管理' })).toBeNull();
expect(screen.getByRole('dialog', { name: '运行时配置' })).not.toBeNull();
fireEvent.keyDown(window, { key: 'Escape' });
@@ -869,6 +877,16 @@ export function registerPublishedRuntimeSettingsTests() {
baseUrl: 'http://127.0.0.1:8082',
apiKey: 'editor-loaded-secret',
},
modelProfiles: [
{
id: 'default',
name: '陶泥儿智能创作',
modelId: 'gpt-test',
enabled: true,
reasoningEffort: 'medium',
},
],
selectedModelProfileId: 'default',
},
};
}
@@ -933,12 +951,24 @@ export function registerPublishedRuntimeSettingsTests() {
expect(screen.getByText('已启用')).not.toBeNull();
fireEvent.click(screen.getByRole('button', { name: /常用设置/ }));
expect(screen.getByLabelText('推理档')).toHaveProperty('value', 'medium');
fireEvent.click(screen.getByRole('button', { name: '配置模型方案' }));
await screen.findByRole('dialog', {
name: '模型方案管理',
});
const reasoningSelect = screen.getByLabelText('陶泥儿智能创作 推理档位');
expect(reasoningSelect.textContent).toContain('medium');
fireEvent.click(reasoningSelect);
expect(
within(screen.getByLabelText('推理档')).getByRole('option', {
within(
screen.getByRole('listbox', {
name: '陶泥儿智能创作 推理档位',
}),
).getByRole('option', {
name: 'max',
}),
).not.toBeNull();
fireEvent.click(screen.getByRole('button', { name: '完成' }));
expect(screen.queryByRole('dialog', { name: '模型方案管理' })).toBeNull();
fireEvent.click(screen.getByLabelText('流式输出'));
fireEvent.click(screen.getByLabelText('联网检索'));
fireEvent.click(screen.getByRole('button', { name: /高级参数/ }));
@@ -997,6 +1027,16 @@ export function registerPublishedRuntimeSettingsTests() {
baseUrl: 'https://dev.genarrative.world',
apiKey: '',
},
modelProfiles: [
{
id: 'default',
name: '陶泥儿智能创作',
modelId: 'gpt-test',
enabled: true,
reasoningEffort: 'medium',
},
],
selectedModelProfileId: 'default',
},
});
expect(JSON.stringify(persistedConfig)).not.toContain(
@@ -1058,7 +1098,15 @@ export function registerPublishedRuntimeSettingsTests() {
expect(screen.queryByLabelText('LLM API Key')).toBeNull();
expect(screen.queryByLabelText('LLM Base URL')).toBeNull();
expect(screen.queryByLabelText('LLM 模型')).toBeNull();
expect(screen.getByLabelText('推理档')).toHaveProperty('value', 'max');
fireEvent.click(screen.getByRole('button', { name: '配置模型方案' }));
await screen.findByRole('dialog', {
name: '模型方案管理',
});
expect(
screen.getByLabelText('陶泥儿智能创作 推理档位').textContent,
).toContain('max');
fireEvent.click(screen.getByRole('button', { name: '完成' }));
expect(screen.queryByRole('dialog', { name: '模型方案管理' })).toBeNull();
expect(screen.getByLabelText('联网检索')).toHaveProperty('checked', true);
fireEvent.click(screen.getByRole('button', { name: /Agent 分工/ }));
expect(screen.getByText('已启用')).not.toBeNull();