From 811abdd37586fd7ba7f1acf978bbf0ac8134317c Mon Sep 17 00:00:00 2001 From: Linghong Date: Fri, 11 Sep 2026 10:57:49 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AD=96=E5=88=92=20Agent=20?= =?UTF-8?q?=E5=9B=9B=E4=B8=AA=E5=AE=A1=E6=9F=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 Retry 流式回合身份与阶段审批 transient 清理 拒绝无效 write_file 内容并补齐顾问阶段导轨 --- .../src-tauri/src/agent/design_runtime.rs | 1 + .../src-tauri/src/agent/design_tools.rs | 2 +- apps/ai-game-creator-shell/src/App.tsx | 13 ++++++++++++- .../project-workspace/DesignAgentSurface.tsx | 2 +- .../project-workspace/DesignWorkspacePanel.tsx | 1 + 5 files changed, 16 insertions(+), 3 deletions(-) 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 = {