openoperator / plugins /_memory /tools /memory_delete.py
Leon4gr45's picture
Upload folder using huggingface_hub (part 5)
57d4e72 verified
Raw History Blame Contribute Delete
495 Bytes
from helpers.tool import Tool, Response
from plugins._memory.helpers.memory import Memory
class MemoryDelete(Tool):
async def execute(self, ids="", **kwargs):
db = await Memory.get(self.agent)
ids = [id.strip() for id in ids.split(",") if id.strip()]
dels = await db.delete_documents_by_ids(ids=ids, cascade=True)
result = self.agent.read_prompt("fw.memories_deleted.md", memory_count=len(dels))
return Response(message=result, break_loop=False)