Dump the MemCube to a dictionary. Args: load_dir (str): The directory to load the MemCube from. user_id (str, optional): The identifier of the user to load the MemCube from. If None, the default user is used. mem_cube_id (str, optional): Th
(
self,
load_dir: str,
user_id: str | None = None,
mem_cube_id: str | None = None,
memory_types: list[Literal["text_mem", "act_mem", "para_mem", "pref_mem"]] | None = None,
)
| 1107 | logger.info(f"MemCube {mem_cube_id} dumped to {dump_dir}") |
| 1108 | |
| 1109 | def load( |
| 1110 | self, |
| 1111 | load_dir: str, |
| 1112 | user_id: str | None = None, |
| 1113 | mem_cube_id: str | None = None, |
| 1114 | memory_types: list[Literal["text_mem", "act_mem", "para_mem", "pref_mem"]] | None = None, |
| 1115 | ) -> None: |
| 1116 | """Dump the MemCube to a dictionary. |
| 1117 | Args: |
| 1118 | load_dir (str): The directory to load the MemCube from. |
| 1119 | user_id (str, optional): The identifier of the user to load the MemCube from. |
| 1120 | If None, the default user is used. |
| 1121 | mem_cube_id (str, optional): The identifier of the MemCube to load. |
| 1122 | If None, the default MemCube for the user is used. |
| 1123 | """ |
| 1124 | target_user_id = user_id if user_id is not None else self.user_id |
| 1125 | accessible_cubes = self.user_manager.get_user_cubes(target_user_id) |
| 1126 | if not mem_cube_id: |
| 1127 | mem_cube_id = accessible_cubes[0].cube_id |
| 1128 | if mem_cube_id not in self.mem_cubes: |
| 1129 | raise ValueError(f"MemCube with ID {mem_cube_id} does not exist. please regiester") |
| 1130 | self.mem_cubes[mem_cube_id].load(load_dir, memory_types=memory_types) |
| 1131 | logger.info(f"MemCube {mem_cube_id} loaded from {load_dir}") |
| 1132 | |
| 1133 | def get_user_info(self) -> dict[str, Any]: |
| 1134 | """Get current user information including accessible cubes. |