feat(project-config): simplify plugin and model drawers
This commit is contained in:
@@ -118,10 +118,67 @@ describe('PI-130 feature-complete Coding UI', () => {
|
||||
|
||||
expect(options.map((option) => option.modelId)).toEqual(['model-a', 'model-b']);
|
||||
expect(options[0].label).toBe('Work account · Custom vendor / model-a');
|
||||
expect(options[0]).toMatchObject({
|
||||
availableThinkingLevels: null,
|
||||
});
|
||||
expect(parseCodingModelKey(options[0].key)).toEqual({ accountId: 'account-1', modelId: 'model-a' });
|
||||
expect(JSON.stringify(options)).not.toMatch(/opencode|providerID/i);
|
||||
});
|
||||
|
||||
it('projects only verified selectable thinking strengths for configured models', async () => {
|
||||
const { buildCodingModelOptions } = await import('@/lib/coding-model-options');
|
||||
const account = {
|
||||
id: 'account-reasoning',
|
||||
vendorId: 'custom',
|
||||
label: 'Reasoning account',
|
||||
authMode: 'api_key',
|
||||
model: 'server-model',
|
||||
fallbackModels: ['deepseek-v4-pro', 'qwen3.8-max', 'unknown-model'],
|
||||
enabled: true,
|
||||
isDefault: true,
|
||||
metadata: {
|
||||
worksSquareModelCapabilities: {
|
||||
'server-model': {
|
||||
reasoningEfforts: ['max', 'low'],
|
||||
reasoningCanDisable: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
createdAt: '2026-08-24T00:00:00.000Z',
|
||||
updatedAt: '2026-08-24T00:00:00.000Z',
|
||||
} satisfies ProviderAccount;
|
||||
|
||||
const options = buildCodingModelOptions([account], []);
|
||||
|
||||
expect(Object.fromEntries(options.map((option) => [option.modelId, option.availableThinkingLevels]))).toEqual({
|
||||
'server-model': ['off', 'low', 'max'],
|
||||
'deepseek-v4-pro': ['off', 'low', 'high', 'max'],
|
||||
'qwen3.8-max': ['off', 'low', 'medium', 'high'],
|
||||
'unknown-model': null,
|
||||
});
|
||||
});
|
||||
|
||||
it('shows the exact configured model name and its selectable thinking strengths', async () => {
|
||||
const { ModelList } = await import('@/pages/ProjectConfiguration');
|
||||
render(<ModelList models={[{
|
||||
key: JSON.stringify(['account-a', 'qwen3.8-max']),
|
||||
accountId: 'account-a',
|
||||
modelId: 'qwen3.8-max',
|
||||
label: '团队模型 · 模型广场 / qwen3.8-max',
|
||||
availableThinkingLevels: ['off', 'low', 'medium', 'high'],
|
||||
}]} />);
|
||||
|
||||
const card = screen.getByTestId(/model-card-/);
|
||||
expect(card).toHaveTextContent('qwen3.8-max');
|
||||
expect(card).toHaveTextContent('可选思考强度');
|
||||
for (const level of ['关闭', '低', '中等', '高']) {
|
||||
expect(within(card).getByText(level)).toBeVisible();
|
||||
}
|
||||
expect(card).not.toHaveTextContent('account-a');
|
||||
expect(card).not.toHaveTextContent('团队模型');
|
||||
expect(card).not.toHaveTextContent('已配置');
|
||||
});
|
||||
|
||||
it('exposes steer/follow-up modes and queue waiting state while a turn runs', async () => {
|
||||
const onModeChange = vi.fn();
|
||||
const onSubmit = vi.fn();
|
||||
|
||||
Reference in New Issue
Block a user