Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

feat: +git import

莘权 马66b68399eb53
diff --git a/metagpt/actions/intent_detect.py b/metagpt/actions/intent_detect.py
index 07b4ad09d..056125618 100644
--- a/metagpt/actions/intent_detect.py
+++ b/metagpt/actions/intent_detect.py
@@ -55,6 +55,13 @@ SOP_CONFIG = [
"Stage and commit changes for the project repository using Git.",
],
),
+ SOPItem(
+ description="download repository from git and format the project to MetaGPT project",
+ sop=[
+ "Imports a project from a Git website and formats it to MetaGPT project format to enable incremental appending requirements.",
+ "Stage and commit changes for the project repository using Git.",
+ ],
+ ),
]
diff --git a/tests/metagpt/actions/test_intent_detect.py b/tests/metagpt/actions/test_intent_detect.py
index 00e866e55..d20080673 100644
--- a/tests/metagpt/actions/test_intent_detect.py
+++ b/tests/metagpt/actions/test_intent_detect.py
@@ -130,11 +130,15 @@ DEMO2_CONTENT = [
{"role": "user", "content": "TypeError: __init__() takes 1 positional argument but 2 were given"},
]
+DEMO3_CONTENT = [
+ {"role": "user", "content": "git clone 'https://github.com/spec-first/connexion' and format to MetaGPT project"}
+]
+
@pytest.mark.asyncio
@pytest.mark.parametrize(
"content",
- [json.dumps(DEMO1_CONTENT), json.dumps(DEMO_CONTENT), json.dumps(DEMO2_CONTENT)],
+ [json.dumps(DEMO1_CONTENT), json.dumps(DEMO_CONTENT), json.dumps(DEMO2_CONTENT), json.dumps(DEMO3_CONTENT)],
)
async def test_intent_detect(content: str, context):
action = IntentDetect(context=context)
@@ -151,7 +155,7 @@ async def test_intent_detect(content: str, context):
@pytest.mark.asyncio
@pytest.mark.parametrize(
"content",
- [json.dumps(DEMO1_CONTENT), json.dumps(DEMO_CONTENT), json.dumps(DEMO2_CONTENT)],
+ [json.dumps(DEMO1_CONTENT), json.dumps(DEMO_CONTENT), json.dumps(DEMO2_CONTENT), json.dumps(DEMO3_CONTENT)],
)
async def test_light_intent_detect(content: str, context):
action = LightIntentDetect(context=context)
diff --git a/tests/metagpt/roles/di/test_mgx.py b/tests/metagpt/roles/di/test_mgx.py
index d4ed0f86a..995b686dc 100644
--- a/tests/metagpt/roles/di/test_mgx.py
+++ b/tests/metagpt/roles/di/test_mgx.py
@@ -4,12 +4,12 @@ from typing import List
import pytest
-from metagpt.context import Context
from metagpt.roles.di.mgx import MGX
from metagpt.schema import Message
from tests.metagpt.actions.test_intent_detect import (
DEMO1_CONTENT,
DEMO2_CONTENT,
+ DEMO3_CONTENT,
DEMO_CONTENT,
)
@@ -23,10 +23,9 @@ from tests.metagpt.actions.test_intent_detect import (
[Message.model_validate(i) for i in DEMO1_CONTENT if i["role"] == "user"],
],
)
-# @pytest.mark.skip
async def test_mgx(user_messages: List[Message], context):
- ctx = context
- mgx = MGX(context=ctx, tools=["<all>"])
+ mgx = MGX(context=context, tools=["<all>"])
for i, msg in enumerate(user_messages):
await mgx.run(msg)
@@ -39,15 +38,21 @@ async def test_mgx(user_messages: List[Message], context):
("user_message", "history_messages"),
[(Message.model_validate(DEMO2_CONTENT[2]), [Message.model_validate(i) for i in DEMO2_CONTENT[0:2]])],
)
-# @pytest.mark.skip
async def test_mgx_fixbug(user_message: Message, history_messages: List[Message], context):
- ctx = Context()
- mgx = MGX(context=ctx, tools=["<all>"])
+ mgx = MGX(context=context, tools=["<all>"])
mgx.rc.memory.add_batch(history_messages)
await mgx.run(user_message)
data = mgx.model_dump_json()
await context.repo.test_outputs.save(filename="test_mgx_fixbug.json", content=data)
[email protected]("user_message", [Message.model_validate(i) for i in DEMO3_CONTENT if i.role == "user"])
+async def test_git_import(user_message, context):
+ mgx = MGX(context=context, tools=["<all>"])
+ await mgx.run(user_message)
+
+
if __name__ == "__main__":
pytest.main([__file__, "-s"])