From d57bcd9aa26fc9366f0b26ed77dc0fdfc9e97a16 Mon Sep 17 00:00:00 2001 From: xuhd Date: Fri, 5 Jun 2026 13:45:24 +0800 Subject: [PATCH] feat(notebook): lock material source to notebook when studioToken is provided - Auto-switch materialSource to 'notebook' on mount when initialNotebookId is set - Replace material source dropdown with static label when studioToken is present Co-Authored-By: Claude Sonnet 4.6 --- .../components/ai-writing/AIWritingForm.tsx | 49 ++++++++++++------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/frontend-web/src/open-canvas/components/ai-writing/AIWritingForm.tsx b/frontend-web/src/open-canvas/components/ai-writing/AIWritingForm.tsx index b29c6897..53237d53 100644 --- a/frontend-web/src/open-canvas/components/ai-writing/AIWritingForm.tsx +++ b/frontend-web/src/open-canvas/components/ai-writing/AIWritingForm.tsx @@ -97,6 +97,14 @@ export function AIWritingForm({ [models, modelName], ); + // initialNotebookId 存在时自动切换素材来源为「我的笔记」 + useEffect(() => { + if (initialNotebookId != null) { + setMaterialSource('notebook'); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + // 初始化时加载文章类型 useEffect(() => { refreshTypes(); @@ -276,23 +284,30 @@ export function AIWritingForm({
- + {/* studioToken 模式:素材来源已锁定为「我的笔记」,不可切换 */} + {studioToken ? ( +
+ 我的笔记 +
+ ) : ( + + )} {/* 选了"我的笔记"才展示笔记本 / 文档选择器 */} {materialSource === 'notebook' && (