feat: improve project agent onboarding
This commit is contained in:
@@ -80,8 +80,8 @@ const agent: CodingProjectAgent = {
|
||||
pinned: true,
|
||||
createdAt: '2026-08-23T00:00:00.000Z',
|
||||
updatedAt: '2026-08-23T00:00:00.000Z',
|
||||
model: null,
|
||||
modelResolution: 'required',
|
||||
model: { accountId: 'account-1', modelId: 'model-1', thinkingLevel: 'off' },
|
||||
modelResolution: 'resolved',
|
||||
};
|
||||
const config: CodingProjectConfig = {
|
||||
schemaVersion: 2,
|
||||
@@ -199,6 +199,24 @@ describe('CodingChatPanel first Conversation', () => {
|
||||
vi.resetModules();
|
||||
});
|
||||
|
||||
it('shows an actionable setup state when the active project has no usable Agent', async () => {
|
||||
projectApi.list.mockResolvedValue({ projects: [project], activeProjectId: project.id });
|
||||
projectApi.config.mockResolvedValue({ project, config: configForAgents([]) });
|
||||
projectApi.conversations.mockResolvedValue([]);
|
||||
const onOpenProjectSettings = vi.fn();
|
||||
const { CodingChatPanel } = await import('@/pages/Chat/CodingChatPanel');
|
||||
|
||||
render(<CodingChatPanel onOpenProjectSettings={onOpenProjectSettings} />);
|
||||
|
||||
expect(await screen.findByTestId('coding-chat-agent-setup-empty-state')).toBeVisible();
|
||||
expect(screen.getByText('创建项目智能体后开始对话')).toBeVisible();
|
||||
expect(screen.queryByRole('textbox')).not.toBeInTheDocument();
|
||||
expect(projectApi.create).not.toHaveBeenCalled();
|
||||
expect(conversationApi.snapshot).not.toHaveBeenCalled();
|
||||
fireEvent.click(screen.getByRole('button', { name: '创建或恢复项目智能体' }));
|
||||
expect(onOpenProjectSettings).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it('makes the first-Conversation textarea editable while runtime metadata is held', async () => {
|
||||
projectApi.list.mockResolvedValue({ projects: [project], activeProjectId: project.id });
|
||||
projectApi.config.mockResolvedValue({ project, config });
|
||||
|
||||
Reference in New Issue
Block a user