🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
fix parse
femto6091f1dd7376
diff --git a/metagpt/actions/design_api.py b/metagpt/actions/design_api.pyindex f19fcbeaa..75df8b909 100644--- a/metagpt/actions/design_api.py+++ b/metagpt/actions/design_api.py@@ -207,5 +207,11 @@ class WriteDesign(Action):prompt = prompt_template.format(context=context, format_example=format_example)# system_design = await self._aask(prompt)system_design = await self._aask_v1(prompt, "system_design", OUTPUT_MAPPING, format=format)+ # fix Python package name, we can't system_design.instruct_content.python_package_name = "xxx" since "Python package name" contain space, have to use setattr+ setattr(+ system_design.instruct_content,+ "Python package name",+ system_design.instruct_content.dict()["Python package name"].strip().strip("'").strip('"'),+ )await self._save(context, system_design)return system_designdiff --git a/metagpt/utils/common.py b/metagpt/utils/common.pyindex 65cc15e82..59d179808 100644--- a/metagpt/utils/common.py+++ b/metagpt/utils/common.py@@ -180,7 +180,7 @@ class OutputParser:if start_index != -1 and end_index != -1:# Extract the structure part- structure_text = text[start_index:end_index + 1]+ structure_text = text[start_index : end_index + 1]try:# Attempt to convert the text to a Python data type using ast.literal_eval@@ -237,7 +237,7 @@ class CodeParser:logger.error(f"{pattern} not match following text:")logger.error(text)# raise Exception- return ""+ return text # just assume original text is codereturn code@classmethod