fix plan & task bugs, add task experience, update editor & browser, test issue fixing ability

This commit is contained in:
garylin2099 2024-05-13 15:11:43 +08:00
parent 91b11a2ab9
commit cb6484d01d
9 changed files with 102 additions and 29 deletions

View file

@ -1,20 +1,15 @@
import asyncio
import os
import threading
from metagpt.environment.mgx.mgx_env import MGXEnv
from metagpt.roles import (
Architect,
Engineer,
ProductManager,
ProjectManager,
QaEngineer,
)
from metagpt.roles import Architect, Engineer, ProductManager, ProjectManager
from metagpt.roles.di.data_analyst import DataAnalyst
from metagpt.roles.di.team_leader import TeamLeader
from metagpt.schema import Message
async def main(requirement, enable_human_input=False):
async def main(requirement="", enable_human_input=False):
env = MGXEnv()
env.add_roles(
[
@ -23,7 +18,7 @@ async def main(requirement, enable_human_input=False):
Architect(),
ProjectManager(),
Engineer(n_borg=5, use_code_review=False),
QaEngineer(),
# QaEngineer(),
DataAnalyst(tools=["<all>"]),
]
)
@ -32,7 +27,9 @@ async def main(requirement, enable_human_input=False):
# simulate human sending messages in chatbox
send_human_input(env)
env.publish_message(Message(content=requirement))
if requirement:
env.publish_message(Message(content=requirement))
# env.publish_message(Message(content=requirement, send_to={"David"}), user_defined_recipient="David")
while not env.is_idle:
await env.run()
@ -70,9 +67,25 @@ data_path = "data/titanic"
train_path = f"{data_path}/split_train.csv"
eval_path = f"{data_path}/split_eval.csv"
TITANIC_REQ = f"This is a titanic passenger survival dataset, your goal is to predict passenger survival outcome. The target column is Survived. Perform data analysis, data preprocessing, feature engineering, and modeling to predict the target. Report accuracy on the eval data. Train data path: '{train_path}', eval data path: '{eval_path}'."
FIX_ISSUE = """
Write a fix for this issue: https://github.com/langchain-ai/langchain/issues/20453,
you can fix it on this repo https://github.com/garylin2099/langchain,
checkout a branch named test-fix, commit your changes, push, and create a PR to the master branch of https://github.com/iorisa/langchain
"""
FIX_ISSUE_SIMPLE = """
Write a fix for this issue: https://github.com/mannaandpoem/simple_calculator/issues/1,
you can fix it on this repo https://github.com/garylin2099/simple_calculator,
checkout a branch named test, commit your changes, push, and create a PR to the original repo.
"""
PUSH_PR_REQ = """
clone https://github.com/garylin2099/simple_calculator, checkout a new branch named test-branch, add an empty file test_file.py to the repo.
Commit your changes and push, finally, create a PR to the master branch of https://github.com/mannaandpoem/simple_calculator.
"""
if __name__ == "__main__":
# NOTE: Add access_token to test github issue fixing
os.environ["access_token"] = "ghp_xxx"
# NOTE: Change the requirement to the one you want to test
# Set enable_human_input to True if you want to simulate sending messages in chatbox
asyncio.run(main(requirement=SIMPLE_REQ, enable_human_input=False))
asyncio.run(main(requirement=FIX_ISSUE, enable_human_input=False))