project management

This commit is contained in:
femto 2023-09-11 13:19:05 +08:00
parent d18a419d4b
commit f17b00ed1c
3 changed files with 7 additions and 5 deletions

View file

@ -9,6 +9,7 @@ from typing import List
from metagpt.actions.action import Action
from metagpt.const import WORKSPACE_ROOT
from metagpt.utils.common import CodeParser
from metagpt.utils.json_to_markdown import json_to_markdown
PROMPT_TEMPLATE = """
@ -83,9 +84,10 @@ class WriteTasks(Action):
super().__init__(name, context, llm)
def _save(self, context, rsp):
ws_name = context[-1].instruct_content.dict()[
"Python package name"
] # CodeParser.parse_str(block="Python package name", text=context[-1].content)
if context[-1].instruct_content:
ws_name = context[-1].instruct_content.dict()["Python package name"]
else:
ws_name = CodeParser.parse_str(block="Python package name", text=context[-1].content)
file_path = WORKSPACE_ROOT / ws_name / "docs/api_spec_and_tasks.md"
file_path.write_text(json_to_markdown(rsp.instruct_content.dict()))

View file

@ -36,7 +36,7 @@ class QaEngineer(Role):
@classmethod
def parse_workspace(cls, system_design_msg: Message) -> str:
if not system_design_msg.instruct_content:
if system_design_msg.instruct_content:
return system_design_msg.instruct_content.dict().get("Python package name")
return CodeParser.parse_str(block="Python package name", text=system_design_msg.content)

View file

@ -18,4 +18,4 @@ async def test_product_manager():
rsp = await product_manager.handle(MockMessages.req)
logger.info(rsp)
assert len(rsp.content) > 0
assert "产品目标" in rsp.content
assert "Product Goals" in rsp.content