diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/design_runtime.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/design_runtime.rs index b2717c739..f20f92c23 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/design_runtime.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/design_runtime.rs @@ -164,6 +164,7 @@ fn prepare_design_input( return Err("当前没有需要恢复的回合".into()); } session.last_error = None; + begin_design_turn(session, id); } else { if session.turn.as_ref().is_some_and(|turn| turn.pending) { return Err("上次回合尚未完成,请先恢复回合".into()); diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/design_tools.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/design_tools.rs index cc66a469e..6d65f9dd3 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/design_tools.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/design_tools.rs @@ -257,7 +257,7 @@ pub(crate) fn execute_design_file_tool( let content = args .get("content") .and_then(Value::as_str) - .unwrap_or_default(); + .ok_or("content 必须是字符串")?; let (display, path) = resolve_design_workspace_path(root, &relative)?; crate::write_game_creator_private_file(&path, content.as_bytes(), "策划工作区文件")?; Ok(Value::String(format!("已写入 {display}"))) diff --git a/apps/ai-game-creator-shell/src/App.tsx b/apps/ai-game-creator-shell/src/App.tsx index 70b253576..c074688fd 100644 --- a/apps/ai-game-creator-shell/src/App.tsx +++ b/apps/ai-game-creator-shell/src/App.tsx @@ -11622,6 +11622,12 @@ export function App({ return; } const clientTurnId = createAgentChatRunId('design-agent-turn'); + designAgentTurnRef.current = { + projectPath: nextProjectPath, + clientTurnId, + }; + setPlanningV2TransientReply(''); + setChatAgentBusy(true); setPlanGddDecisionBusy(true); void invoke('decide_design_phase', { projectPath: nextProjectPath, @@ -11636,7 +11642,12 @@ export function App({ .catch((error) => { setPlanGddError(String(error)); }) - .finally(() => setPlanGddDecisionBusy(false)); + .finally(() => { + designAgentTurnRef.current = null; + setPlanningV2TransientReply(''); + setChatAgentBusy(false); + setPlanGddDecisionBusy(false); + }); } : undefined } diff --git a/apps/ai-game-creator-shell/src/features/project-workspace/DesignAgentSurface.tsx b/apps/ai-game-creator-shell/src/features/project-workspace/DesignAgentSurface.tsx index ed9034bef..88d5f9914 100644 --- a/apps/ai-game-creator-shell/src/features/project-workspace/DesignAgentSurface.tsx +++ b/apps/ai-game-creator-shell/src/features/project-workspace/DesignAgentSurface.tsx @@ -61,7 +61,7 @@ export function DesignAgentSurface({ ) : null} {error ?

{error}

: null} - {pending ? ( + {pending && phase !== 'consultant' ? (

当前阶段产物已提交,是否批准进入下一阶段?

diff --git a/apps/ai-game-creator-shell/src/features/project-workspace/DesignWorkspacePanel.tsx b/apps/ai-game-creator-shell/src/features/project-workspace/DesignWorkspacePanel.tsx index 789a96fbd..0cd20991c 100644 --- a/apps/ai-game-creator-shell/src/features/project-workspace/DesignWorkspacePanel.tsx +++ b/apps/ai-game-creator-shell/src/features/project-workspace/DesignWorkspacePanel.tsx @@ -19,6 +19,7 @@ const PHASES = [ ['architecture', '系统架构'], ['systems', '系统文档'], ['tdd', '技术文档'], + ['consultant', '顾问'], ] as const; type DesignWorkspacePanelProps = {