diff --git a/src/components/Chat.tsx b/src/components/Chat.tsx index c0c670a..d6e08b7 100644 --- a/src/components/Chat.tsx +++ b/src/components/Chat.tsx @@ -1,5 +1,6 @@ import { invoke } from "@tauri-apps/api/core"; import { listen } from "@tauri-apps/api/event"; +import { ask } from "@tauri-apps/plugin-dialog"; import { useEffect, useRef, useState } from "react"; import Markdown from "react-markdown"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; @@ -163,25 +164,21 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) { } }; - const clearSession = () => { - // Store current state in case we need to debug - console.log("clearSession called, messages count:", messages.length); - - const confirmed = window.confirm( + const clearSession = async () => { + const confirmed = await ask( "Are you sure? This will clear all messages and reset the conversation context.", + { + title: "New Session", + kind: "warning", + }, ); - console.log("User confirmed:", confirmed); - - if (confirmed === true) { - console.log("Clearing session..."); + if (confirmed) { setMessages([]); setStreamingContent(""); setLoading(false); // TODO: Add backend call to clear context when implemented // invoke("clear_session").catch(console.error); - } else { - console.log("User cancelled, keeping messages"); } };