Load a JSON file.
(self, path: str)
| 115 | self.logger.warning(f"Error saving file {path}: {e}") |
| 116 | |
| 117 | def load_json_file(self, path: str) -> dict: |
| 118 | """Load a JSON file.""" |
| 119 | json_memory = {} |
| 120 | try: |
| 121 | with open(path, 'r') as f: |
| 122 | json_memory = json.load(f) |
| 123 | except FileNotFoundError: |
| 124 | self.logger.warning(f"File not found: {path}") |
| 125 | return {} |
| 126 | except json.JSONDecodeError: |
| 127 | self.logger.warning(f"Error decoding JSON from file: {path}") |
| 128 | return {} |
| 129 | except Exception as e: |
| 130 | self.logger.warning(f"Error loading file {path}: {e}") |
| 131 | return {} |
| 132 | return json_memory |
| 133 | |
| 134 | def load_memory(self, agent_type: str = "casual_agent") -> None: |
| 135 | """Load the memory from the last session.""" |