mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-29 19:06:23 +02:00
Fallback to a version that only uses "Refine" and update the prompt for ActionNode
This commit is contained in:
parent
6743a4f3b1
commit
6d9dfa73aa
5 changed files with 47 additions and 13 deletions
|
|
@ -9,7 +9,7 @@ from typing import List
|
|||
|
||||
from metagpt.actions.action_node import ActionNode
|
||||
from metagpt.logs import logger
|
||||
from metagpt.utils.mermaid import MMC1, MMC1_INC_AND_REFINE, MMC2
|
||||
from metagpt.utils.mermaid import MMC1, MMC1_INC_AND_REFINE, MMC2, MMC2_INC
|
||||
|
||||
IMPLEMENTATION_APPROACH = ActionNode(
|
||||
key="Implementation approach",
|
||||
|
|
@ -35,7 +35,6 @@ REFINE_IMPLEMENTATION_APPROACH = ActionNode(
|
|||
example="We will refine ...",
|
||||
)
|
||||
|
||||
|
||||
PROJECT_NAME = ActionNode(
|
||||
key="Project name", expected_type=str, instruction="The project name with underline", example="game_2048"
|
||||
)
|
||||
|
|
@ -51,7 +50,8 @@ REFINE_FILE_LIST = ActionNode(
|
|||
key="File List",
|
||||
expected_type=List[str],
|
||||
instruction="Update and expand the original file list, including only relative paths. "
|
||||
"Ensure that the refined file list reflects the evolving structure of the project due to incremental development.",
|
||||
"Ensure that the refined file list reflects the evolving structure of the project due to incremental development."
|
||||
"Only output filename!Do not include comments in the list.",
|
||||
example=["main.py", "game.py", "utils.py", "new_feature.py"],
|
||||
)
|
||||
|
||||
|
|
@ -93,6 +93,15 @@ PROGRAM_CALL_FLOW = ActionNode(
|
|||
example=MMC2,
|
||||
)
|
||||
|
||||
REFINE_PROGRAM_CALL_FLOW = ActionNode(
|
||||
key="Program call flow",
|
||||
expected_type=str,
|
||||
instruction="Extend the existing sequenceDiagram code syntax with detailed information, accurately covering the"
|
||||
"CRUD and initialization of each object. Ensure correct syntax usage and reflect the incremental changes introduced"
|
||||
"in the classes and API defined above.Retain content unrelated to incremental development for coherence and clarity",
|
||||
example=MMC2_INC,
|
||||
)
|
||||
|
||||
ANYTHING_UNCLEAR = ActionNode(
|
||||
key="Anything UNCLEAR",
|
||||
expected_type=str,
|
||||
|
|
@ -134,14 +143,14 @@ NODES = [
|
|||
ANYTHING_UNCLEAR,
|
||||
]
|
||||
|
||||
INC_NODES = [INC_IMPLEMENTATION_APPROACH, INC_DATA_STRUCTURES_AND_INTERFACES]
|
||||
INC_NODES = [INC_IMPLEMENTATION_APPROACH, INC_DATA_STRUCTURES_AND_INTERFACES, REFINE_PROGRAM_CALL_FLOW]
|
||||
|
||||
REFINE_NODES = [
|
||||
REFINE_IMPLEMENTATION_APPROACH,
|
||||
# PROJECT_NAME,
|
||||
REFINE_FILE_LIST,
|
||||
REFINE_DATA_STRUCTURES_AND_INTERFACES,
|
||||
PROGRAM_CALL_FLOW,
|
||||
REFINE_PROGRAM_CALL_FLOW,
|
||||
ANYTHING_UNCLEAR,
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -70,8 +70,9 @@ TASK_LIST = ActionNode(
|
|||
INC_TASK_LIST = ActionNode(
|
||||
key="Incremental Task list",
|
||||
expected_type=List[str],
|
||||
instruction="Break down the incremental development tasks into a prioritized list of filenames. "
|
||||
"Organize the tasks based on dependency order, ensuring a systematic and efficient implementation.",
|
||||
instruction="Break down the incremental development tasks into a prioritized list of filenames."
|
||||
"Organize the tasks based on dependency order, ensuring a systematic and efficient implementation."
|
||||
"Only output filename! Do not include comments in the list ",
|
||||
example=["new_feature.py", "utils.py", "main.py"],
|
||||
)
|
||||
|
||||
|
|
@ -80,7 +81,7 @@ REFINE_TASK_LIST = ActionNode(
|
|||
expected_type=List[str],
|
||||
instruction="Review and refine the combined task list after the merger of Legacy Content and Incremental Content. "
|
||||
"Ensure that tasks are organized in a logical and prioritized order, considering dependencies for a streamlined and"
|
||||
" efficient development process.",
|
||||
" efficient development process. Only output filename! Do not include comments in the list",
|
||||
example=["game.py", "utils.py", "new_feature.py", "main.py"],
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,6 @@ Role: You are a professional engineer; The main goal is to complete incremental
|
|||
|
||||
# Instruction: Based on the context, follow "Format example", write or rewrite code.
|
||||
## Write/Rewrite Code: Only write one file {filename}, write or rewrite complete code using triple quotes based on the following attentions and context.
|
||||
### Important Attention: If Legacy Code files contain "{filename} to be rewritten", you are required to merge the Incremental Change into the {filename} file and retain any content unrelated to incremental development to maintain clarity and coherence, when rewriting "{filename} to be rewritten".
|
||||
1. Only One file: do your best to implement THIS ONLY ONE FILE.
|
||||
2. COMPLETE CODE: Your code will be part of the entire project, so please implement complete, reliable, reusable code snippets.
|
||||
3. Set default value: If there is any setting, ALWAYS SET A DEFAULT VALUE, ALWAYS USE STRONG TYPE AND EXPLICIT VARIABLE. AVOID circular import.
|
||||
|
|
@ -158,6 +157,7 @@ Role: You are a professional engineer; The main goal is to complete incremental
|
|||
6. CAREFULLY CHECK THAT YOU DONT MISS ANY NECESSARY CLASS/FUNCTION IN THIS FILE.
|
||||
7. Before using a external variable/module, make sure you import it first.
|
||||
8. Write out EVERY CODE DETAIL, DON'T LEAVE TODO.
|
||||
9. Attention: If Legacy Code files contain "{filename} to be rewritten", you are required to merge the Incremental Change into the {filename} file when rewriting "{filename} to be rewritten".
|
||||
"""
|
||||
|
||||
CODE_GUIDE_CONTEXT_EXAMPLE = """
|
||||
|
|
|
|||
|
|
@ -172,10 +172,8 @@ ANYTHING_UNCLEAR = ActionNode(
|
|||
ISSUE_TYPE = ActionNode(
|
||||
key="issue_type",
|
||||
expected_type=str,
|
||||
instruction="Answer BUG/REFINE/OVERHAUL. If it is a bugfix, answer BUG;"
|
||||
"if it is a minor improvement, answer REFINE;"
|
||||
"if it is a major overhaul, answer OVERHAUL that most likely not answer in most cases.",
|
||||
example="REFINE",
|
||||
instruction="Answer BUG/REQUIREMENT. If it is a bugfix, answer BUG, otherwise answer Requirement",
|
||||
example="BUG",
|
||||
)
|
||||
|
||||
IS_RELATIVE = ActionNode(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue