diff --git a/frontend/src/components/WorkspaceChat/index.jsx b/frontend/src/components/WorkspaceChat/index.jsx index 47a3bbebc2..17e9aaa4bf 100644 --- a/frontend/src/components/WorkspaceChat/index.jsx +++ b/frontend/src/components/WorkspaceChat/index.jsx @@ -18,6 +18,16 @@ export default function WorkspaceChat({ loading, workspace }) { const [history, setHistory] = useState([]); const [loadingHistory, setLoadingHistory] = useState(true); + // --- Agent Mode Toggle State --- + const [agentMode, setAgentMode] = useState( + JSON.parse(localStorage.getItem("agentMode") || "false") + ); + + useEffect(() => { + localStorage.setItem("agentMode", JSON.stringify(agentMode)); + }, [agentMode]); + // ------------------------------- + useEffect(() => { async function getHistory() { if (loading) return; @@ -34,9 +44,10 @@ export default function WorkspaceChat({ loading, workspace }) { setLoadingHistory(false); } getHistory(); - }, [workspace, loading]); + }, [workspace, loading, threadSlug]); if (loadingHistory) return ; + if (!loading && !loadingHistory && !workspace) { return ( <> @@ -77,10 +88,30 @@ export default function WorkspaceChat({ loading, workspace }) { } setEventDelegatorForCodeSnippets(); + return ( - + {/* Agent Mode Toggle UI */} +
+ +
+ + {/* Pass agentMode and setter to ChatContainer */} +
);