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);