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 <noreply@anthropic.com>
This commit is contained in:
1 parent
0e7149eec3
commit
d57bcd9aa2
1 file changed
+15
@@ -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,6 +284,12 @@ export function AIWritingForm({
|
||||
|
||||
<div className="mt-4 space-y-2">
|
||||
<label className={FIELD_LABEL_CLASS}>素材来源</label>
|
||||
{/* studioToken 模式:素材来源已锁定为「我的笔记」,不可切换 */}
|
||||
{studioToken ? (
|
||||
<div className={`${FIELD_TRIGGER_CLASS} flex items-center px-3 border rounded-xl bg-white text-sm text-muted-foreground`}>
|
||||
我的笔记
|
||||
</div>
|
||||
) : (
|
||||
<Select
|
||||
value={materialSource}
|
||||
onValueChange={(v) => handleMaterialSourceChange(v as MaterialSource)}
|
||||
@@ -293,6 +307,7 @@ export function AIWritingForm({
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
)}
|
||||
|
||||
{/* 选了"我的笔记"才展示笔记本 / 文档选择器 */}
|
||||
{materialSource === 'notebook' && (
|
||||
|
||||
Reference in new issue
Block a user