feat(agent): 会话接续 - 首页创作带入画布原助手

This commit is contained in:
王志伟
2026-09-08 18:24:37 +08:00
parent e782009db5
commit 88f4b9ccdf
6 changed files with 153 additions and 13 deletions

View File

@@ -555,6 +555,21 @@ function InfiniteCanvasPage() {
openAgent("local");
}, [codexAutoConnect, codexCompactAgent, openAgent, projectLoaded, setAgentMode]);
useEffect(() => {
const sessionId = searchParams.get("conversation");
if (!projectLoaded || !sessionId) return;
if (!chatSessions.some((session) => session.id === sessionId)) {
message.warning("未找到要接续的会话,请从首页重新进入。");
} else {
activeChatIdRef.current = sessionId;
setActiveChatId(sessionId);
openAgent("online");
}
const next = new URLSearchParams(searchParams);
next.delete("conversation");
setSearchParams(next, { replace: true });
}, [projectLoaded, chatSessions, searchParams, setSearchParams, openAgent, message]);
// 沉浸专注进入时收起智能体与小地图、重置 Dock 唤出态;仅响应「进入」瞬间,避免关闭专注内主动唤出的面板。
const prevFocusModeRef = useRef(focusMode);
useEffect(() => {