Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"mdast-util-gfm-autolink-literal": "2.0.0"
},
"dependencies": {
"@opensecret/react": "1.5.0",
"@opensecret/react": "1.5.1",
"@radix-ui/react-alert-dialog": "^1.1.1",
"@radix-ui/react-avatar": "^1.1.0",
"@radix-ui/react-checkbox": "^1.3.3",
Expand Down
26 changes: 22 additions & 4 deletions frontend/src/components/AccountMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,37 @@ import { ApiKeyManagementDialog } from "@/components/apikeys/ApiKeyManagementDia

function ConfirmDeleteDialog() {
const { clearHistory } = useLocalState();
const os = useOpenSecret();
const queryClient = useQueryClient();
const navigate = useNavigate();

async function handleDeleteHistory() {
// 1. Delete archived chats (KV)
try {
await clearHistory();
console.log("History cleared");
console.log("History (KV) cleared");
} catch (error) {
console.error("Error clearing history:", error);
} finally {
queryClient.invalidateQueries({ queryKey: ["chatHistory"] });
navigate({ to: "/" });
// Continue to delete server conversations even if this fails
}

// 2. Delete server conversations (API) if any exist
try {
// Check if we have any conversations to delete
const conversations = await os.listConversations({ limit: 1 });
if (conversations.data && conversations.data.length > 0) {
await os.deleteConversations();
console.log("Server conversations deleted");
}
Comment thread
AnthonyRonning marked this conversation as resolved.
} catch (e) {
console.error("Error deleting conversations:", e);
}

// Always refresh UI and navigate home
queryClient.invalidateQueries({ queryKey: ["chatHistory"] });
queryClient.invalidateQueries({ queryKey: ["conversations"] });
queryClient.invalidateQueries({ queryKey: ["archivedChats"] });
navigate({ to: "/" });
}

return (
Expand Down
Loading