webui: add "delete all conversations" button to import/export tab (#17444)

* webui: add "delete all conversations" button to import/export tab

- Add 'Delete all conversations' functionality with confirmation dialog
- Add Trash icon and destructive styling for clear visual indication
- Redirects to "?new_chat=true#/" by using conversationsStore.deleteAll()

* chore: update webui build output
This commit is contained in:
Thomas Jarosch
2025-12-15 11:29:29 +01:00
committed by GitHub
parent b1f3a6e5db
commit e73d548659
3 changed files with 92 additions and 4 deletions
@@ -385,8 +385,7 @@ class ConversationsStore {
this.conversations = this.conversations.filter((c) => c.id !== convId);
if (this.activeConversation?.id === convId) {
this.activeConversation = null;
this.activeMessages = [];
this.clearActiveConversation();
await goto(`?new_chat=true#/`);
}
} catch (error) {
@@ -394,6 +393,29 @@ class ConversationsStore {
}
}
/**
* Deletes all conversations and their messages
*/
async deleteAll(): Promise<void> {
try {
const allConversations = await DatabaseService.getAllConversations();
for (const conv of allConversations) {
await DatabaseService.deleteConversation(conv.id);
}
this.clearActiveConversation();
this.conversations = [];
toast.success('All conversations deleted');
await goto(`?new_chat=true#/`);
} catch (error) {
console.error('Failed to delete all conversations:', error);
toast.error('Failed to delete conversations');
}
}
// ─────────────────────────────────────────────────────────────────────────────
// Import/Export
// ─────────────────────────────────────────────────────────────────────────────