diff --git a/apps/ai-game-creator-shell/src/App.tsx b/apps/ai-game-creator-shell/src/App.tsx index b1e65d5fc..703ebcaf7 100644 --- a/apps/ai-game-creator-shell/src/App.tsx +++ b/apps/ai-game-creator-shell/src/App.tsx @@ -787,6 +787,17 @@ export function App({ useState(false); const queuedChatTurnSequenceRef = useRef(0); const chatComposerRef = useRef(null); + /** + * 切项目即清空只属于上一个项目的输入盒状态:待发附件的 `localPath` 是**项目相对**的, + * 队列也属于刚结束的那条对话;留着会把 A 项目的附件路径带进 B 项目的下一个回合。 + */ + useEffect(() => { + setChatAttachments([]); + setChatAttachmentNotice(''); + setChatComposerNotice(''); + setChatTurnQueue([]); + chatTurnQueueRef.current = []; + }, [localProject?.projectPath]); const [chatAgentBusy, setChatAgentBusy] = useState(false); const [directCodexProgress, setDirectCodexProgress] = useState(''); const [directCodexStatus, setDirectCodexStatus] = useState<