From 0b7aeb7d8a094effd63c919d76b160c03e5a4d69 Mon Sep 17 00:00:00 2001 From: kdletters Date: Sun, 13 Sep 2026 12:56:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20master=20=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=90=8E=E7=9A=84=E5=AE=A2=E6=88=B7=E7=AB=AF=20CI=20?= =?UTF-8?q?=E5=9B=9E=E5=BD=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免空项目首页调用插件路径清理命令 恢复首页项目类型和未识别项目提示契约 隐藏创建过程中的底层错误文本并保留稳定重试提示 补充项目路径引用清理,避免切换项目重复调用 --- apps/ai-game-creator-shell/src/App.tsx | 10 ++++++++-- .../src/features/app-shell/ProjectCreation.tsx | 2 +- .../src/features/app-shell/useHomeProjectCreation.ts | 6 +----- apps/ai-game-creator-shell/src/view/home/index.tsx | 11 +++++++---- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/apps/ai-game-creator-shell/src/App.tsx b/apps/ai-game-creator-shell/src/App.tsx index 7cea61ad6..dbd27da4b 100644 --- a/apps/ai-game-creator-shell/src/App.tsx +++ b/apps/ai-game-creator-shell/src/App.tsx @@ -598,11 +598,14 @@ export function App({ : null, ); const localProjectPathRef = useRef(null); - localProjectPathRef.current = localProject?.projectPath ?? null; useEffect(() => { if (supervisorChatOnly) return; const nextProjectPath = localProject?.projectPath ?? null; + const previousProjectPath = localProjectPathRef.current; + localProjectPathRef.current = nextProjectPath; + // 未绑定项目时无需触发插件宿主;这也避免启动空首页时产生无意义的 Tauri 调用。 + if (!nextProjectPath && !previousProjectPath) return; void setAgcPluginProjectPath(nextProjectPath) .then(async () => { if (workspaceProjectKind === 'cocos' && nextProjectPath) { @@ -620,7 +623,10 @@ export function App({ ); }); return () => { - void setAgcPluginProjectPath(null).catch(() => undefined); + if (nextProjectPath || previousProjectPath) { + void setAgcPluginProjectPath(null).catch(() => undefined); + } + localProjectPathRef.current = null; }; }, [localProject?.projectPath, supervisorChatOnly, workspaceProjectKind]); diff --git a/apps/ai-game-creator-shell/src/features/app-shell/ProjectCreation.tsx b/apps/ai-game-creator-shell/src/features/app-shell/ProjectCreation.tsx index db9b11200..69ae5d245 100644 --- a/apps/ai-game-creator-shell/src/features/app-shell/ProjectCreation.tsx +++ b/apps/ai-game-creator-shell/src/features/app-shell/ProjectCreation.tsx @@ -39,7 +39,7 @@ function projectKindLabel(project: RecentProjectRow) { : 'Godot'; } if (project.projectKind === 'web') { - return 'Phaser'; + return 'GameAgent'; } return '待识别'; } diff --git a/apps/ai-game-creator-shell/src/features/app-shell/useHomeProjectCreation.ts b/apps/ai-game-creator-shell/src/features/app-shell/useHomeProjectCreation.ts index c09d75787..0da1cefe8 100644 --- a/apps/ai-game-creator-shell/src/features/app-shell/useHomeProjectCreation.ts +++ b/apps/ai-game-creator-shell/src/features/app-shell/useHomeProjectCreation.ts @@ -490,9 +490,7 @@ export function useHomeProjectCreation({ ); projectManifest = result.manifest; } else { - setStatus( - '未识别为支持的 AGC、Godot 或 Cocos Creator 项目,请选择项目根目录。', - ); + setStatus('这不是已初始化的 AI 游戏项目,请使用新建项目。'); return; } const runtimeMode = await invoke<{ @@ -613,11 +611,9 @@ export function useHomeProjectCreation({ if (!invoke) { throw new Error('需要在陶泥儿客户端内运行'); } - setStatus(options.suggestName ? '正在提炼项目名称' : '正在创建工作区'); const suggestedName = options.suggestName ? await suggestAutomaticProjectName(invoke, draft) : null; - setStatus('正在创建工作区'); const result = await invoke( 'create_automatic_local_game_project', { diff --git a/apps/ai-game-creator-shell/src/view/home/index.tsx b/apps/ai-game-creator-shell/src/view/home/index.tsx index b94a4cd7d..e037e01e5 100644 --- a/apps/ai-game-creator-shell/src/view/home/index.tsx +++ b/apps/ai-game-creator-shell/src/view/home/index.tsx @@ -154,12 +154,13 @@ export default function HomeView({ const referencedAttachments = richTextToAttachments(homeRichText); const prompt = richTextToPrompt(homeRichText); if (!prompt && referencedAttachments.length === 0) { - onStatusChange(activeCreationType.emptyPrompt); + if (homeCreationType !== 'doc') { + onStatusChange(activeCreationType.emptyPrompt); + } return; } homeCreationBusyRef.current = true; setHomeCreationBusy(true); - onStatusChange('正在创建工作区'); try { onStatusChange( await onCreateDraftAutomatically( @@ -171,8 +172,10 @@ export default function HomeView({ startMode, ), ); - } catch (error) { - onStatusChange(error instanceof Error ? error.message : String(error)); + } catch { + // 详细错误已由工作区创建控制器记录;首页只显示稳定的用户可执行提示, + // 避免把底层 Provider/IPC 文本直接渲染到首页状态区。 + onStatusChange('创建未完成,请重试'); } finally { homeCreationBusyRef.current = false; setHomeCreationBusy(false);