openoperator / plugins /_memory /tools /memory_save.py
OpenOperator Deployer
Deploy source revision ef73a4b421f2d1ececca20f99c9118f4621c5e28
6918275
Raw History Blame Contribute Delete
512 Bytes
from helpers.tool import Tool, Response
from plugins._memory.helpers.memory import Memory
class MemorySave(Tool):
async def execute(self, text="", area="", **kwargs):
if not area:
area = Memory.Area.MAIN.value
metadata = {"area": area, **kwargs}
db = await Memory.get(self.agent)
id = await db.insert_text(text, metadata)
result = self.agent.read_prompt("fw.memory_saved.md", memory_id=id)
return Response(message=result, break_loop=False)