🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
fix critical bug for tool recommend
garylin209937fcd66cbc24
diff --git a/metagpt/roles/di/role_zero.py b/metagpt/roles/di/role_zero.pyindex 1c292fdde..234064088 100644--- a/metagpt/roles/di/role_zero.py+++ b/metagpt/roles/di/role_zero.py@@ -48,7 +48,7 @@ class RoleZero(Role):# Toolstools: list[str] = [] # Use special symbol ["<all>"] to indicate use of all registered tools- tool_recommender: ToolRecommender = ToolRecommender()+ tool_recommender: ToolRecommender = Nonetool_execution_map: dict[str, Callable] = {}special_tool_commands: list[str] = ["Plan.finish_current_task", "end"]# Equipped with three basic tools by default for optional use@@ -246,6 +246,7 @@ class RoleZero(Role):commands = CodeParser.parse_code(block=None, lang="json", text=self.command_rsp)commands = json.loads(repair_llm_raw_output(output=commands, req_keys=[None], repair_type=RepairType.JSON))except json.JSONDecodeError:+ logger.warning(f"Failed to parse JSON for: {self.command_rsp}. Trying to repair...")commands = await self.llm.aask(msg=JSON_REPAIR_PROMPT.format(json_data=self.command_rsp))commands = json.loads(CodeParser.parse_code(block=None, lang="json", text=commands))except Exception as e: