Skip to content

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

update engineer2 cmd prompt

黄伟韬68c10d05b0e8
diff --git a/metagpt/prompts/di/engineer2.py b/metagpt/prompts/di/engineer2.py
index 9b8af137e..559bb89e4 100644
--- a/metagpt/prompts/di/engineer2.py
+++ b/metagpt/prompts/di/engineer2.py
@@ -1,4 +1,4 @@
-from metagpt.prompts.di.role_zero import ROLE_INSTRUCTION
+from metagpt.prompts.di.role_zero import CMD_PROMPT, ROLE_INSTRUCTION
EXTRA_INSTRUCTION = """
You are an autonomous programmer
@@ -76,6 +76,10 @@ Note:
21. If the code exists, use the Editor tool's open and edit commands to modify it. Since it is not a new code, do not use write_new_code.
22. Aways user absolute path as parameter. if no specific root path given, use "workspace/'project_name'" as default work space.
"""
+ENGINEER2_CMD_PROMPT = (
+ CMD_PROMPT
+ + "\nWhen using the Editor tool, the command list must contain a single command. Because the command is mutually exclusive."
+)
CURRENT_EDITOR_STATE = """
The current editor state is:
diff --git a/metagpt/roles/di/engineer2.py b/metagpt/roles/di/engineer2.py
index f63868100..56d520b36 100644
--- a/metagpt/roles/di/engineer2.py
+++ b/metagpt/roles/di/engineer2.py
@@ -12,11 +12,11 @@ from metagpt.logs import logger
from metagpt.prompts.di.engineer2 import (
CURRENT_EDITOR_STATE,
CURRENT_TERMINAL_STATE,
+ ENGINEER2_CMD_PROMPT,
ENGINEER2_INSTRUCTION,
WRITE_CODE_PROMPT,
WRITE_CODE_SYSTEM_PROMPT,
)
-from metagpt.prompts.di.role_zero import CMD_PROMPT
from metagpt.roles.di.role_zero import RoleZero
from metagpt.schema import Message, UserMessage
from metagpt.strategy.experience_retriever import ENGINEER_EXAMPLE
@@ -33,10 +33,7 @@ class Engineer2(RoleZero):
profile: str = "Engineer"
goal: str = "Take on game, app, and web development."
instruction: str = ENGINEER2_INSTRUCTION
- cmd_prompt: str = (
- CMD_PROMPT
- + "\nWhen using the Editor tool, the command list must contain a single command. Because the command is mutually exclusive."
- )
+ cmd_prompt: str = ENGINEER2_CMD_PROMPT
terminal: Terminal = Field(default_factory=Terminal, exclude=True)
tools: list[str] = [