From f3e5a3bb35a886e4ee08501f6023c7aec14f5b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=87=AF?= Date: Wed, 1 Jul 2026 14:48:40 +0800 Subject: [PATCH] fix: prevent notebook writing redirect to agent chat --- frontend-web/src/open-canvas/pages/AIWritingPage.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend-web/src/open-canvas/pages/AIWritingPage.tsx b/frontend-web/src/open-canvas/pages/AIWritingPage.tsx index 4c56e940..2cd88cd4 100644 --- a/frontend-web/src/open-canvas/pages/AIWritingPage.tsx +++ b/frontend-web/src/open-canvas/pages/AIWritingPage.tsx @@ -414,6 +414,8 @@ function AIWritingBody({ const routeBase = useAIWritingRouteBase(); const agentRoute = useAIWritingAgentRouteState(routeBase); const isAdmin = getStoredAuth()?.system_role === 'admin'; + const externalNotebookMode = + studioToken != null || initialNotebookId != null || initialDocumentIds != null; // 需求 0616 #5:左栏点「笔记本 / 所有空间」→ 在右侧内嵌打开对应页,替换右侧内容 // (写作布局不卸载,仅 display:none 隐藏,避免 WritingSetupChat 重挂丢线程)。 @@ -432,12 +434,12 @@ function AIWritingBody({ } }, [agentRoute.active]); - const agentsActive = sidebarTab === 'agents'; + const agentsActive = !externalNotebookMode && sidebarTab === 'agents'; // 研究模板侧栏在「写作配置(idle)」与「历史回看」两态都展示(点历史记录后保留侧栏、 // 历史内容显示到右侧区域);写作进行中收起;嵌入态(studioToken)始终不展示。 const showSidebar = - !studioToken && (state.status === 'idle' || isHistoryMode || agentsActive); + !externalNotebookMode && (state.status === 'idle' || isHistoryMode || agentsActive); const compactAppearanceActions = compactChrome ? ( ) : null;