修复画布 Agent 默认被任务列表隐藏
打开画布时 Agent 开关启用则保持 Agent 默认展开。 恢复任务自动打开任务列表时不再抢占 Agent 默认态。 用户手动打开任务列表时仍按右侧面板互斥关闭 Agent。 补充恢复任务场景下 Agent 默认显示的回归测试。
This commit is contained in:
@@ -1449,6 +1449,40 @@ describe('ImageCanvasEditorView', () => {
|
||||
expect(screen.queryByLabelText('发送给画布 Agent')).toBeNull();
|
||||
});
|
||||
|
||||
it('keeps the Agent conversation panel open when restored tasks auto-open the task list', async () => {
|
||||
enableEditorAgentSidebarForTest();
|
||||
loadOrCreateRecentEditorProjectMock.mockResolvedValueOnce({
|
||||
projectId: 'editor-project-with-restored-task',
|
||||
title: '恢复任务项目',
|
||||
viewport: { x: 0, y: 0, scale: 1 },
|
||||
layers: [
|
||||
...defaultEditorProjectLayers,
|
||||
{
|
||||
layerId: 'generation-dialog:restored-task',
|
||||
resourceId: 'generation-dialog:restored-task',
|
||||
itemType: 'generation-dialog',
|
||||
dialog: {
|
||||
id: 'restored-task',
|
||||
mode: 'generate',
|
||||
prompt: '继续生成',
|
||||
status: 'idle',
|
||||
},
|
||||
},
|
||||
],
|
||||
resources: defaultEditorProjectResources,
|
||||
updatedAt: '2026-07-06T00:00:00.000Z',
|
||||
});
|
||||
|
||||
render(<ImageCanvasEditorView />);
|
||||
|
||||
expect(await screen.findByLabelText('发送给画布 Agent')).toBeTruthy();
|
||||
await waitFor(() => {
|
||||
expect(
|
||||
screen.queryByRole('complementary', { name: '画布任务列表' }),
|
||||
).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
it('keeps the left resource sidebar independent from right-side task and Agent panels', async () => {
|
||||
enableEditorAgentSidebarForTest();
|
||||
render(<ImageCanvasEditorView />);
|
||||
|
||||
@@ -1199,13 +1199,19 @@ export function ImageCanvasEditorView({
|
||||
[toggleSidebarPanel],
|
||||
);
|
||||
useEffect(() => {
|
||||
if (!isAgentConversationEnabled && isAgentConversationOpen) {
|
||||
setIsAgentConversationOpen(false);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
(!isAgentConversationEnabled || generationSurface.isTaskSidebarOpen) &&
|
||||
isAgentConversationEnabled &&
|
||||
generationSurface.isTaskSidebarOpen &&
|
||||
isAgentConversationOpen
|
||||
) {
|
||||
setIsAgentConversationOpen(false);
|
||||
generationSurface.toggleTaskSidebar();
|
||||
}
|
||||
}, [
|
||||
generationSurface,
|
||||
generationSurface.isTaskSidebarOpen,
|
||||
isAgentConversationEnabled,
|
||||
isAgentConversationOpen,
|
||||
|
||||
Reference in New Issue
Block a user