Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
add config file validation
Vivian Fangc47f7b426caf
diff --git a/memgpt/config.py b/memgpt/config.pyindex 0e495dcaa..a75020c02 100644--- a/memgpt/config.py+++ b/memgpt/config.py@@ -225,6 +225,17 @@ class Config:f"{Style.BRIGHT}{Fore.MAGENTA}⚙️ Saved config file to {self.config_file}.{Style.RESET_ALL}")+ @staticmethod+ def is_valid_config_file(file: str):+ cfg = Config()+ try:+ cfg.load_config(file)+ except Exception:+ return False+ return (+ cfg.memgpt_persona is not None and cfg.human_persona is not None+ ) # TODO: more validation for configs+@staticmethoddef get_memgpt_personas():dir_path = Config.personas_dir@@ -319,6 +330,7 @@ class Config:os.path.join(configs_dir, f)for f in os.listdir(configs_dir)if os.path.isfile(os.path.join(configs_dir, f))+ and Config.is_valid_config_file(os.path.join(configs_dir, f))]# Return the file with the most recent modification timeif len(files) == 0: