Skip to content

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

fixbug: fixbug intent

莘权 马de53a1ae3563
diff --git a/metagpt/actions/intent_detect.py b/metagpt/actions/intent_detect.py
index 052547798..a520763cd 100644
--- a/metagpt/actions/intent_detect.py
+++ b/metagpt/actions/intent_detect.py
@@ -47,7 +47,14 @@ SOP_CONFIG = [
# "Run QA test on the project repository.",
"Stage and commit changes for the project repository using Git.",
],
- )
+ ),
+ SOPItem(
+ description="Error message, issues, fix bug",
+ sop=[
+ "Fix bugs in the project repository.",
+ "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 95efc16d8..1a7acd3e7 100644
--- a/tests/metagpt/actions/test_intent_detect.py
+++ b/tests/metagpt/actions/test_intent_detect.py
@@ -42,11 +42,17 @@ DEMO1_CONTENT = [
}
]
+DEMO2_CONTENT = [
+ {"role": "user", "content": 'Create a "2048 game"'},
+ {"role": "assistant", "content": ""},
+ {"role": "user", "content": "TypeError: __init__() takes 1 positional argument but 2 were given"},
+]
+
@pytest.mark.asyncio
@pytest.mark.parametrize(
"content",
- [json.dumps(DEMO1_CONTENT), json.dumps(DEMO_CONTENT)],
+ [json.dumps(DEMO1_CONTENT), json.dumps(DEMO_CONTENT), json.dumps(DEMO2_CONTENT)],
)
async def test_intent_detect(content: str, context):
action = IntentDetect(context=context)
@@ -63,7 +69,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(DEMO1_CONTENT), json.dumps(DEMO_CONTENT), json.dumps(DEMO2_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 2ff886d3d..2aca45867 100644
--- a/tests/metagpt/roles/di/test_mgx.py
+++ b/tests/metagpt/roles/di/test_mgx.py
@@ -7,7 +7,11 @@ 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, DEMO_CONTENT
+from tests.metagpt.actions.test_intent_detect import (
+ DEMO1_CONTENT,
+ DEMO2_CONTENT,
+ DEMO_CONTENT,
+)
@pytest.mark.asyncio
@@ -16,10 +20,7 @@ from tests.metagpt.actions.test_intent_detect import DEMO1_CONTENT, DEMO_CONTENT
[
[Message.model_validate(i) for i in DEMO_CONTENT if i["role"] == "user"],
[Message.model_validate(i) for i in DEMO1_CONTENT if i["role"] == "user"],
- [
- Message(role="user", content='Create a "2048 game"'),
- Message(role="user", content='"IndentationError: expected an indented block"'),
- ],
+ [Message.model_validate(i) for i in DEMO2_CONTENT if i["role"] == "user"],
],
)
async def test_mgx(user_messages: List[Message]):