🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
update SPO code
isaacJinyu2528581c4ce8
diff --git a/metagpt/ext/spo/utils/load.py b/metagpt/ext/spo/utils/load.pyindex 14dee74c6..2b3a1371d 100644--- a/metagpt/ext/spo/utils/load.py+++ b/metagpt/ext/spo/utils/load.py@@ -11,11 +11,19 @@ def set_file_name(name):def load_meta_data(k=SAMPLE_K):-# load yaml fileconfig_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'settings', FILE_NAME)- with open(config_path, 'r', encoding='utf-8') as file:- data = yaml.safe_load(file)++ if not os.path.exists(config_path):+ raise FileNotFoundError(f"Configuration file '{FILE_NAME}' not found in settings directory")++ try:+ with open(config_path, 'r', encoding='utf-8') as file:+ data = yaml.safe_load(file)+ except yaml.YAMLError as e:+ raise ValueError(f"Error parsing YAML file '{FILE_NAME}': {str(e)}")+ except Exception as e:+ raise Exception(f"Error reading file '{FILE_NAME}': {str(e)}")qa = []diff --git a/metagpt/ext/spo/utils/prompt_utils.py b/metagpt/ext/spo/utils/prompt_utils.pyindex 1fcc4cb4e..8bf1ec898 100644--- a/metagpt/ext/spo/utils/prompt_utils.py+++ b/metagpt/ext/spo/utils/prompt_utils.py@@ -33,6 +33,4 @@ class PromptUtils:with open(os.path.join(directory, "prompt.txt"), "w", encoding="utf-8") as file:file.write(prompt)- with open(os.path.join(directory, "__init__.py"), "w", encoding="utf-8") as file:- file.write("")