diff --git a/frontend/src/pages/SwarmControlPage.js b/frontend/src/pages/SwarmControlPage.js index fef05b2..757465a 100644 --- a/frontend/src/pages/SwarmControlPage.js +++ b/frontend/src/pages/SwarmControlPage.js @@ -69,11 +69,11 @@ } = useSwarmControl({ pageContainerRef, onNewSessionCreated }); const [showConfigModal, setShowConfigModal] = useState(false); + const [showClearChatModal, setShowClearChatModal] = useState(false); const [isClearingHistory, setIsClearingHistory] = useState(false); - const handleClearHistory = async () => { + const confirmClearHistory = async () => { if (!sessionId) return; - if (!window.confirm("Clear all chat messages? Your nodes, workspace, and file sync will be preserved.")) return; setIsClearingHistory(true); try { await clearSessionHistory(sessionId); @@ -83,8 +83,15 @@ alert(`Failed to clear history: ${e.message}`); } finally { setIsClearingHistory(false); + setShowClearChatModal(false); } }; + + const handleClearHistory = () => { + if (!sessionId) return; + setShowClearChatModal(true); + }; + const [showNodeSelector, setShowNodeSelector] = useState(false); const isEditingMeshRef = useRef(false); useEffect(() => { @@ -837,6 +844,41 @@ )} + + {/* Clear Chat Confirmation Modal */} + {showClearChatModal && ( +
+ This will permanently delete all messages in this session. Your attached nodes, workspace files, and mesh configurations will be preserved. +
+