Update prompt and fix up some bug

This commit is contained in:
mannaandpoem 2024-01-04 10:41:36 +08:00
parent 0168c99323
commit e3cd1a2cc1
9 changed files with 35 additions and 60 deletions

View file

@ -8,7 +8,7 @@
import pytest
from metagpt.actions.design_api_an import REFINED_DESIGN_NODES
from metagpt.provider import OpenAIGPTAPI
from metagpt.llm import LLM
CONTEXT = """
### Legacy Content
@ -94,11 +94,11 @@ CONTEXT = """
@pytest.fixture()
def llm():
return OpenAIGPTAPI()
return LLM()
@pytest.mark.asyncio
async def test_write_design_an():
node = await REFINED_DESIGN_NODES.fill(CONTEXT, llm)
assert node.instruct_content
assert "Refined Data Structures and Interfaces" in node.instruct_content.json(ensure_ascii=False)
assert "Refined Data Structures and Interfaces" in node.instruct_content.model_dump_json()

View file

@ -8,7 +8,7 @@
import pytest
from metagpt.actions.project_management_an import REFINED_PM_NODES
from metagpt.provider import OpenAIGPTAPI
from metagpt.llm import LLM
CONTEXT = """
### Legacy Content
@ -134,11 +134,11 @@ CONTEXT = """
@pytest.fixture()
def llm():
return OpenAIGPTAPI()
return LLM()
@pytest.mark.asyncio
async def test_project_management_an(llm):
node = await REFINED_PM_NODES.fill(CONTEXT, llm)
assert node.instruct_content
assert "Refined Logic Analysis" in node.instruct_content.json(ensure_ascii=False)
assert "Refined Logic Analysis" in node.instruct_content.model_dump_json()

View file

@ -200,7 +200,7 @@ async def test_write_code_guideline_an():
)
node = await write_code_guideline.run(context=context)
assert node.instruct_content
assert "Incremental Change" in node.instruct_content.json(ensure_ascii=False)
assert "Incremental Change" in node.instruct_content.model_dump_json()
@pytest.mark.asyncio

View file

@ -8,7 +8,7 @@
import pytest
from metagpt.actions.write_prd_an import REFINE_PRD_NODE
from metagpt.provider import OpenAIGPTAPI
from metagpt.llm import LLM
CONTEXT = """
### New Project Name
@ -78,11 +78,11 @@ Please change the game's score target from 2048 to 4096, and change the interfac
@pytest.fixture()
def llm():
return OpenAIGPTAPI()
return LLM()
@pytest.mark.asyncio
async def test_write_prd_an(llm):
node = await REFINE_PRD_NODE.fill(CONTEXT, llm)
assert node.instruct_content
assert "Refined Requirement Pool" in node.instruct_content.json(ensure_ascii=False)
assert "Refined Requirement Pool" in node.instruct_content.model_dump_json()

View file

@ -14,140 +14,120 @@ from metagpt.startup import app
runner = CliRunner()
def test_refine_simple_calculator():
def test_refined_simple_calculator():
args = [
"Add subtraction, multiplication and division operations to the calculator. The current calculator can only perform basic addition operations, and it is necessary to introduce subtraction, multiplication, division operation into the calculator",
"--inc",
"--project-path",
"data/simple_add_calculator",
"--project-name",
"simple_calculator",
]
result = runner.invoke(app, args)
logger.info(result)
logger.info(result.output)
def test_refine_number_guessing_game():
def test_refined_number_guessing_game():
args = [
"Adding graphical interface functionality to enhance the user experience in the number-guessing game. The existing number-guessing game currently relies on command-line input for numbers. The goal is to introduce a graphical interface to improve the game's usability and visual appeal"
"Adding graphical interface functionality to enhance the user experience in the number-guessing game. The existing number-guessing game currently relies on command-line input for numbers. The goal is to introduce a graphical interface to improve the game's usability and visual appeal",
"--inc",
"--project-path",
"data/number_guessing_game",
"--project-name",
"number_guessing_game",
]
result = runner.invoke(app, args)
logger.info(result)
logger.info(result.output)
def test_refine_dice_simulator_1():
def test_refined_dice_simulator_1():
args = [
"Add functionality to view the history of scores. The original dice rolling game could only display the current game result, but the new requirement allows players to view the history of scores"
"Add functionality to view the history of scores. The original dice rolling game could only display the current game result, but the new requirement allows players to view the history of scores",
"--inc",
"--project-path",
"data/dice_simulator_new",
"--project-name",
"dice_simulator_1",
]
result = runner.invoke(app, args)
logger.info(result)
logger.info(result.output)
def test_refine_dice_simulator_2():
def test_refined_dice_simulator_2():
args = [
"Add functionality to view the history of scores and perform statistical analysis on them. The original dice rolling game could only display the current game result, but the new requirement allows players to view the history of scores and display the statistical analysis results of the current score",
"--inc",
"--project-path",
"data/dice_simulator_new",
"--project-name",
"dice_simulator_2",
]
result = runner.invoke(app, args)
logger.info(result)
logger.info(result.output)
def test_refine_dice_simulator_3():
def test_refined_dice_simulator_3():
args = [
"Add functionality to set the number of sides on a die; Add functionality to view the history of scores; Add functionality to perform statistical analysis on all scores. The original dice rolling game could roll the dice multiple times and only display the current game result. But the new requirement add function that players to customize the number of sides of the dice and to view the history of scores and display the statistical analysis"
"Add functionality to set the number of sides on a die; Add functionality to view the history of scores; Add functionality to perform statistical analysis on all scores. The original dice rolling game could roll the dice multiple times and only display the current game result. But the new requirement add function that players to customize the number of sides of the dice and to view the history of scores and display the statistical analysis",
"--inc",
"--project-path",
"data/dice_simulator_new",
"--project-name",
"dice_simulator_3",
]
result = runner.invoke(app, args)
logger.info(result)
logger.info(result.output)
def test_refine_pygame_2048_1():
def test_refined_pygame_2048_1():
args = [
"Changed score target for 2048 game from 2048 to 4096. Please change the game's score target from 2048 to 4096, and change the interface size from 4*4 to 8*8"
"Changed score target for 2048 game from 2048 to 4096. Please change the game's score target from 2048 to 4096, and change the interface size from 4*4 to 8*8",
"--inc",
"--project-path",
"data/pygame_2048",
"--project-name",
"pygame_2048_1",
]
result = runner.invoke(app, args)
logger.info(result)
logger.info(result.output)
def test_refine_pygame_2048_2():
def test_refined_pygame_2048_2():
args = [
"Display the history score of the player in the 2048 game. Add a record board that can display players' historical score records so that players can trace their scores"
"Display the history score of the player in the 2048 game. Add a record board that can display players' historical score records so that players can trace their scores",
"--inc",
"--project-path",
"data/pygame_2048",
"--project-name",
"pygame_2048_2",
]
result = runner.invoke(app, args)
logger.info(result)
logger.info(result.output)
def test_refine_pygame_2048_3():
def test_refined_pygame_2048_3():
args = [
"Add limited time mode. The original game only had a default classic mode. The improved game should be able to support limited-time mode, allowing users to choose classic mode or limited-time mode from the available options before starting the game."
"Add limited time mode. The original game only had a default classic mode. The improved game should be able to support limited-time mode, allowing users to choose classic mode or limited-time mode from the available options before starting the game.",
"--inc",
"--project-path",
"data/pygame_2048",
"--project-name",
"pygame_2048_3",
]
result = runner.invoke(app, args)
logger.info(result)
logger.info(result.output)
def test_refine_word_cloud_1():
def test_refined_word_cloud_1():
args = [
"Add a feature to remove deprecated words from the word cloud. The current word cloud generator does not support removing deprecated words. Now, The word cloud generator should support removing deprecated words. Customize deactivated words to exclude them from word cloud. Let users see all the words in the text file, and allow users to select the words they want to remove."
"Add a feature to remove deprecated words from the word cloud. The current word cloud generator does not support removing deprecated words. Now, The word cloud generator should support removing deprecated words. Customize deactivated words to exclude them from word cloud. Let users see all the words in the text file, and allow users to select the words they want to remove.",
"--inc",
"--project-path",
"data/word_cloud",
"--project-name",
"word_cloud_1",
]
result = runner.invoke(app, args)
logger.info(result)
logger.info(result.output)
def test_refine_word_cloud_2():
def test_refined_word_cloud_2():
args = [
"Add a feature to customize the resolution of the word cloud.The new version allows users to customize the size and resolution of the generated word cloud after uploading a text file, and then generate the word cloud."
"Add a feature to customize the resolution of the word cloud.The new version allows users to customize the size and resolution of the generated word cloud after uploading a text file, and then generate the word cloud.",
"--inc",
"--project-path",
"data/word_cloud",
"--project-name",
"word_cloud_2",
]
result = runner.invoke(app, args)
logger.info(result)