Spaces:
Running
Running
Download plugins/_memory/tools/memory_save.py from Leon4gr45/openoperator: direct link, hf CLI and curl.
- Browser
- Download file 512 Bytes
-
https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/plugins/_memory/tools/memory_save.py
- Command line
-
hf download hf://spaces/Leon4gr45/openoperator/plugins/_memory/tools/memory_save.py
-
curl -L -o memory_save.py https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/plugins/_memory/tools/memory_save.py
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) | |