mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-27 17:56:23 +02:00
fixbug: fixbug intent
This commit is contained in:
parent
f75382b918
commit
de53a1ae35
3 changed files with 22 additions and 8 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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]):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue