feat: +mgx

This commit is contained in:
莘权 马 2024-06-14 18:08:04 +08:00
parent d8f1a37334
commit c619b29d12
4 changed files with 16 additions and 5 deletions

View file

@ -40,6 +40,16 @@ class EnvBuilder(BaseModel):
env = Environment(context=self.context)
team_leader = TeamLeader()
architect = Architect()
architect.tools.extend(
[
"CompressExternalInterfaces",
"DetectInteraction",
"EvaluateTRD",
"WriteTRD",
"WriteFramework",
"EvaluateFramework",
]
)
# Prepare context
use_case_actors = "".join([f"- {v}: {k}\n" for k, v in self.actors.items()])
@ -98,12 +108,10 @@ async def develop(
msg = """
根据"User Requirements"中的用户需求写TRD
## User Requirements
```json
{user_requirements}
```
"""
env.publish_message(
UserMessage(content=msg.format(user_requirements=f"{user_requirements}"), send_to=any_to_str(TeamLeader))
UserMessage(content=msg.format(user_requirements="\n".join(user_requirements)), send_to=any_to_str(TeamLeader))
)
while not env.is_idle:

View file

@ -16,9 +16,11 @@ from pydantic import BaseModel
from metagpt.actions.requirement_analysis.framework.evaluate_framework import EvaluateFramework
from metagpt.actions.requirement_analysis.framework.write_framework import WriteFramework
from metagpt.const import DEFAULT_WORKSPACE_ROOT
from metagpt.tools.tool_registry import register_tool
from metagpt.utils.common import CodeParser, awrite
@register_tool(tags=["software framework"])
async def save_framework(dir_data: str, output_dir: Optional[Union[str, Path]] = None) -> List[str]:
output_dir = Path(output_dir) if output_dir else DEFAULT_WORKSPACE_ROOT / uuid.uuid4().hex
output_dir.mkdir(parents=True, exist_ok=True)

View file

@ -18,7 +18,8 @@ Note:
1. If the requirement is a pure DATA-RELATED requirement, such as bug fixes, issue reporting, environment setup, terminal operations, pip install, web browsing, web scraping, web searching, web imitation, data science, data analysis, machine learning, deep learning, text-to-image etc. DON'T decompose it, assign a single task with the original user requirement as instruction directly to Data Analyst.
2. If the requirement is developing a software, game, app, or website, excluding the above data-related tasks, you should decompose the requirement into multiple tasks and assign them to different team members based on their expertise, usually the sequence of Product Manager -> Architect -> Project Manager -> Engineer -> (optional: QaEngine if present) -> (optional: DataAnalyst if user requests deployment), each assigned ONE task. When publishing message to Product Manager, you should directly copy the full original user requirement.
3. If the requirement contains both DATA-RELATED part mentioned in 1 and software development part mentioned in 2, you should decompose the software development part and assign them to different team members based on their expertise, and assign the DATA-RELATED part to Data Analyst David directly.
4. It it helpful for Engineer to have both the system design and the project schedule for writing the code, so include paths of both files (if available) when publishing message to Engineer.
4. It is helpful for Engineer to have both the system design and the project schedule for writing the code, so include paths of both files (if available) when publishing message to Engineer.
5. If the requirement is writing a TRD, you should assign it to Architect. When publishing message to Architect, you should directly copy the full original user requirement.
"""
FINISH_CURRENT_TASK_CMD = """

View file

@ -162,7 +162,7 @@ class SimpleExpRetriever(ExpRetriever):
"""
def retrieve(self, context: str = "") -> str:
return self.EXAMPLE
return "" # byRFC243 self.EXAMPLE
class KeywordExpRetriever(ExpRetriever):