| 1 | from helpers.tool import Tool, Response |
| 2 | from plugins._memory.helpers.memory import Memory |
| 3 | |
| 4 | |
| 5 | |
| 6 | class MemorySave(Tool): |
| 7 | |
| 8 | async def execute(self, text="", area="", **kwargs): |
| 9 | |
| 10 | if not area: |
| 11 | area = Memory.Area.MAIN.value |
| 12 | |
| 13 | metadata = {"area": area, **kwargs} |
| 14 | |
| 15 | db = await Memory.get(self.agent) |
| 16 | id = await db.insert_text(text, metadata) |
| 17 | |
| 18 | result = self.agent.read_prompt("fw.memory_saved.md", memory_id=id) |
| 19 | return Response(message=result, break_loop=False) |