Delete chat (#77)

This commit is contained in:
Will Chen
2025-05-02 15:43:40 -07:00
committed by GitHub
parent b9dc2cc0f9
commit 4e4bf51bba
4 changed files with 103 additions and 25 deletions

View File

@@ -63,4 +63,15 @@ export function registerChatHandlers() {
return allChats;
}
);
ipcMain.handle("delete-chat", async (_, chatId: number) => {
try {
// Delete the chat and its associated messages
await db.delete(chats).where(eq(chats.id, chatId));
return { success: true };
} catch (error) {
console.error("Error deleting chat:", error);
return { success: false, error: (error as Error).message };
}
});
}