Add debug logging to clearSession to diagnose Cancel button bug
This commit is contained in:
@@ -164,15 +164,24 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const clearSession = () => {
|
const clearSession = () => {
|
||||||
|
// Store current state in case we need to debug
|
||||||
|
console.log("clearSession called, messages count:", messages.length);
|
||||||
|
|
||||||
const confirmed = window.confirm(
|
const confirmed = window.confirm(
|
||||||
"Are you sure? This will clear all messages and reset the conversation context.",
|
"Are you sure? This will clear all messages and reset the conversation context.",
|
||||||
);
|
);
|
||||||
if (confirmed) {
|
|
||||||
|
console.log("User confirmed:", confirmed);
|
||||||
|
|
||||||
|
if (confirmed === true) {
|
||||||
|
console.log("Clearing session...");
|
||||||
setMessages([]);
|
setMessages([]);
|
||||||
setStreamingContent("");
|
setStreamingContent("");
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
// TODO: Add backend call to clear context when implemented
|
// TODO: Add backend call to clear context when implemented
|
||||||
// invoke("clear_session").catch(console.error);
|
// invoke("clear_session").catch(console.error);
|
||||||
|
} else {
|
||||||
|
console.log("User cancelled, keeping messages");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user