-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow users to delete their chat histories #252
Conversation
…displays menu on right click
…debar electron/main/storeHandlers: Added remove-chat-history ipcHandler
src/components/ChatsSidebar: Added useEffect to updateAllChatHistories src/components/FileEditorContainer: Passed setShowChatbot to SidebarManager so we can hide chat only if we're viewing it and choose to delete it. src/components/MainSidebar: Passed setShowChatbot to ChatsSidebar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good. Added 3 comments. Also, noticing weird bugs with the ordering changing when I toggle between the file sidebar and the chat sidebar. Is that something you've seen? Do you think it was introduced in this PR?
electron/main/Store/storeHandlers.ts
Outdated
@@ -198,6 +198,38 @@ export const registerStoreHandlers = ( | |||
const vaultChatHistories = allChatHistories[vaultDir] || []; | |||
return vaultChatHistories.find((chat) => chat.id === chatId); | |||
}); | |||
|
|||
ipcMain.handle("update-all-chat-history", (event, chatID: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we no longer use this handler. Perhaps remove it?
electron/preload/index.ts
Outdated
@@ -289,6 +294,9 @@ contextBridge.exposeInMainWorld("electronStore", { | |||
updateChatHistory: (chatHistory: ChatHistory) => { | |||
ipcRenderer.invoke("update-chat-history", chatHistory); | |||
}, | |||
updateAllChatHistories: (chatID: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this calls the remove handler, perhaps it should be called removeChatHistory?
src/components/Chat/ChatsSidebar.tsx
Outdated
if (chatID === currentSelectedChatID.current) { | ||
setShowChatbot(false); | ||
} | ||
window.electronStore.updateAllChatHistories(chatID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit but we should probably update the store first and then update the renderer process' record of the chat metadata
Right now there is no way to delete chat histories. The following PR allows users to:
Closes #245