🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
chore: return plan by list.
刘棒棒9f5108a4643b
diff --git a/metagpt/actions/plan.py b/metagpt/actions/plan.pyindex ab3963c72..8bc575992 100644--- a/metagpt/actions/plan.py+++ b/metagpt/actions/plan.py@@ -9,6 +9,7 @@ from typing import Unionfrom metagpt.actions import Actionfrom metagpt.prompts.plan import TASK_PLAN_SYSTEM_MSGfrom metagpt.schema import Message+from metagpt.utils.common import CodeParserclass Plan(Action):@@ -19,4 +20,5 @@ class Plan(Action):if role:system_msg = TASK_PLAN_SYSTEM_MSG.format(role=role)rsp = self._aask(system_msg + prompt.content) if isinstance(prompt, Message) else await self._aask(system_msg + prompt)- return Message(rsp, role="assistant", sent_from=self.__class__.__name__)+ plan = CodeParser.parse_code(None, rsp).split('\n\n')+ return Message(plan, role="assistant", sent_from=self.__class__.__name__)diff --git a/metagpt/prompts/plan.py b/metagpt/prompts/plan.pyindex c4b056ab0..4d3add211 100644--- a/metagpt/prompts/plan.py+++ b/metagpt/prompts/plan.py@@ -1,7 +1,8 @@TASK_PLAN_SYSTEM_MSG = """You are a {role}. Write a plan with single digits steps. make sure others can understand what you are doing.-Example:-# plan+Example, must start with ```, and end with ```:+```1. ...\n\n2. ...\n\n...+```"""diff --git a/tests/metagpt/actions/test_plan.py b/tests/metagpt/actions/test_plan.pyindex 35f8f20cc..1b1b90513 100644--- a/tests/metagpt/actions/test_plan.py+++ b/tests/metagpt/actions/test_plan.py@@ -10,3 +10,4 @@ async def test_plan():rsp = await p.run(task_desc, role="data analyst")assert len(rsp.content) > 0assert rsp.sent_from == "Plan"+ print(rsp)