(self)
| 138 | return results |
| 139 | |
| 140 | def save(self): |
| 141 | data = { |
| 142 | "user_profiles": self.user_profiles, |
| 143 | "knowledge_base": list(self.knowledge_base), # Convert deques to lists for JSON serialization |
| 144 | "assistant_knowledge": list(self.assistant_knowledge) |
| 145 | } |
| 146 | try: |
| 147 | with open(self.file_path, "w", encoding="utf-8") as f: |
| 148 | json.dump(data, f, ensure_ascii=False, indent=2) |
| 149 | except IOError as e: |
| 150 | print(f"Error saving LongTermMemory to {self.file_path}: {e}") |
| 151 | |
| 152 | def load(self): |
| 153 | try: |
no outgoing calls
no test coverage detected