mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-05 22:02:38 +02:00
feat: +log
This commit is contained in:
parent
6067245ae3
commit
e01d4b3125
5 changed files with 44 additions and 4 deletions
|
|
@ -13,6 +13,7 @@ from typing import Dict, Optional
|
|||
|
||||
from metagpt.actions import Action, UserRequirement
|
||||
from metagpt.const import REQUIREMENT_FILENAME
|
||||
from metagpt.logs import logger
|
||||
from metagpt.schema import AIMessage
|
||||
from metagpt.utils.common import any_to_str
|
||||
from metagpt.utils.file_repository import FileRepository
|
||||
|
|
@ -56,6 +57,7 @@ class PrepareDocuments(Action):
|
|||
if not v or k in ["resources", "reason"]:
|
||||
continue
|
||||
self.context.kwargs.set(k, v)
|
||||
logger.info(f"{k}={v}")
|
||||
if self.context.kwargs.project_path:
|
||||
self.config.update_via_cli(
|
||||
project_path=self.context.kwargs.project_path,
|
||||
|
|
|
|||
|
|
@ -202,6 +202,8 @@ class Environment(ExtEnv):
|
|||
for _ in range(k):
|
||||
futures = []
|
||||
for role in self.roles.values():
|
||||
if role.is_idle:
|
||||
continue
|
||||
future = role.run()
|
||||
futures.append(future)
|
||||
|
||||
|
|
|
|||
|
|
@ -505,11 +505,11 @@ class GitRepository:
|
|||
issue=issue,
|
||||
)
|
||||
else:
|
||||
head_branch = base_repo.get_branch(base)
|
||||
base_branch = head_repo.get_branch(head)
|
||||
base_branch = base_repo.get_branch(base)
|
||||
head_branch = head_repo.get_branch(head)
|
||||
pr = base_repo.create_pull(
|
||||
base=base_branch.name,
|
||||
head=head_branch.commit.sha,
|
||||
head=f"{head_repo.full_name}:{head_branch.name}",
|
||||
title=title,
|
||||
body=body,
|
||||
maintainer_can_modify=maintainer_can_modify,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ serdeser_path = Path(__file__).absolute().parent.joinpath("../data/serdeser_stor
|
|||
|
||||
class MockEnv(Environment):
|
||||
def publish_message(self, message: Message, peekable: bool = True) -> bool:
|
||||
logger.info(f"{message.metadata}:{message.content}")
|
||||
consumers = []
|
||||
for role, addrs in self.member_addrs.items():
|
||||
if is_send_to(message, addrs):
|
||||
|
|
@ -87,6 +88,7 @@ async def test_publish_and_process_message(env: Environment):
|
|||
assert len(env.history.storage) == 0
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize(
|
||||
("content", "send_to"),
|
||||
|
|
@ -105,7 +107,7 @@ async def test_publish_and_process_message(env: Environment):
|
|||
any_to_str(ProjectManager),
|
||||
),
|
||||
(
|
||||
"Rewrite 'main.py' of the project at '/Users/iorishinier/github/MetaGPT/workspace/snake_game'",
|
||||
"src filename is 'game.py', Uncaught SyntaxError: Identifier 'Position' has already been declared (at game.js:1:1), the project at '/Users/iorishinier/github/bak/MetaGPT/workspace/snake_game'",
|
||||
any_to_str(Engineer),
|
||||
),
|
||||
(
|
||||
|
|
|
|||
|
|
@ -91,6 +91,39 @@ async def test_new_pr():
|
|||
assert pr
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
@pytest.mark.asyncio
|
||||
async def test_new_pr1():
|
||||
body = """
|
||||
>>> SUMMARY
|
||||
>>> Change HTTP library used to send requests
|
||||
>>>
|
||||
>>> TESTS
|
||||
>>> - [x] Send 'GET' request
|
||||
>>> - [x] Send 'POST' request with/without body
|
||||
"""
|
||||
pr = await GitRepository.create_pull(
|
||||
base_repo_name="iorisa/MetaGPT",
|
||||
base="fixbug/vscode",
|
||||
head_repo_name="send18/MetaGPT",
|
||||
head="dev",
|
||||
title="Test pr",
|
||||
body=body,
|
||||
access_token=await get_env(key="access_token", app_name="github"),
|
||||
)
|
||||
# pr = await GitRepository.create_pull(
|
||||
# head_repo_name="iorisa/MetaGPT",
|
||||
# head="fixbug/vscode",
|
||||
# base_repo_name="send18/MetaGPT",
|
||||
# base="dev",
|
||||
# title="Test pr",
|
||||
# body=body,
|
||||
# access_token=await get_env(key="access_token", app_name="github"),
|
||||
# )
|
||||
print(pr)
|
||||
assert pr
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
@pytest.mark.asyncio
|
||||
async def test_auth():
|
||||
|
|
@ -124,6 +157,7 @@ async def test_github(context):
|
|||
assert pr
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize(
|
||||
"content",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue