mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-11 15:15:18 +02:00
chore: return plan by list.
This commit is contained in:
parent
8ef05bb19f
commit
9f5108a464
3 changed files with 7 additions and 3 deletions
|
|
@ -9,6 +9,7 @@ from typing import Union
|
|||
from metagpt.actions import Action
|
||||
from metagpt.prompts.plan import TASK_PLAN_SYSTEM_MSG
|
||||
from metagpt.schema import Message
|
||||
from metagpt.utils.common import CodeParser
|
||||
|
||||
|
||||
class 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__)
|
||||
|
|
|
|||
|
|
@ -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\n
|
||||
2. ...\n\n
|
||||
...
|
||||
```
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -10,3 +10,4 @@ async def test_plan():
|
|||
rsp = await p.run(task_desc, role="data analyst")
|
||||
assert len(rsp.content) > 0
|
||||
assert rsp.sent_from == "Plan"
|
||||
print(rsp)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue