mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-11 15:15:18 +02:00
feat: +git import
This commit is contained in:
parent
b70ed4cf0b
commit
66b68399eb
3 changed files with 25 additions and 9 deletions
|
|
@ -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.",
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
@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
|
||||
@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)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("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"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue