MCPcopy
hub / github.com/agent0ai/agent-zero / deleteMemory

Function deleteMemory

plugins/_memory/webui/memory-dashboard-store.js:554–585  ·  view source on GitHub ↗
(memory)

Source from the content-addressed store, hash-verified

552 },
553
554 async deleteMemory(memory) {
555 try {
556 // Check if this is the memory currently being viewed in detail modal
557 const isViewingThisMemory =
558 this.detailMemory && this.detailMemory.id === memory.id;
559
560 const response = await API.callJsonApi(MEMORY_DASHBOARD_API, {
561 action: "delete",
562 memory_subdir: this.selectedMemorySubdir,
563 memory_id: memory.id,
564 });
565
566 if (response.success) {
567 justToast("Memory deleted successfully", "success");
568
569 // If we were viewing this memory in detail modal, close it
570 if (isViewingThisMemory) {
571 this.detailMemory = null;
572 closeModal(); // Close the detail modal
573 }
574
575 // Let polling refresh the data instead of manual manipulation
576 // Trigger an immediate refresh to get updated state from backend
577 await this.searchMemories(true); // silent refresh
578 } else {
579 justToast(`Failed to delete memory: ${response.error}`, "error");
580 }
581 } catch (error) {
582 console.error("Memory deletion error:", error);
583 justToast("Failed to delete memory", "error");
584 }
585 },
586
587 exportMemories() {
588 if (this.memories.length === 0) {

Callers

nothing calls this directly

Calls 3

closeModalFunction · 0.90
justToastFunction · 0.70
errorMethod · 0.45

Tested by

no test coverage detected