fix(agent): unify live and historical conversation state

This commit is contained in:
yu
2026-08-01 22:11:05 +08:00
parent ee5804e586
commit ea0414e88c
24 changed files with 3246 additions and 576 deletions
-6
View File
@@ -157,7 +157,6 @@ function InfiniteCanvasPage() {
const agentPanelOpen = useAgentStore((state) => state.panelOpen);
const toggleAgentPanel = useAgentStore((state) => state.togglePanel);
const openAgentPanel = useAgentStore((state) => state.openPanel);
const setAgentState = useAgentStore((state) => state.setAgentState);
const containerRef = useRef<HTMLDivElement>(null);
const imageInputRef = useRef<HTMLInputElement>(null);
const uploadTargetRef = useRef<{ nodeId?: string; position?: Position } | null>(null);
@@ -353,11 +352,6 @@ function InfiniteCanvasPage() {
void restore();
}, [hydrated, navigate, openProject, projectId]);
useEffect(() => {
if (!projectLoaded) return;
setAgentState({ activeThreadId: "", messages: [], tokenUsage: null, pendingTool: null });
}, [projectId, projectLoaded, setAgentState]);
useEffect(() => {
if (!projectLoaded || !["new", "recent", "choose"].includes(searchParams.get("mode") || "")) return;
if (!searchParams.has("agentUrl")) openAgentPanel();