🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
equip engineer2 with terminal
garylin2099dbdfd29cea5b
diff --git a/metagpt/prompts/di/role_zero.py b/metagpt/prompts/di/role_zero.pyindex 721fe7e60..9b467bafd 100644--- a/metagpt/prompts/di/role_zero.py+++ b/metagpt/prompts/di/role_zero.py@@ -115,7 +115,7 @@ Decide if the latest user message previously is a quick question.Quick questions include common-sense, legal, logical, math, multiple-choice questions, greetings, or casual chat that you can answer directly.Questions about you or your team info are also quick questions.Time- or location-sensitive questions such as wheather or news inquiry are NOT quick questions. Moreover, you should output a keyword SEARCH to indicate the need for a google search.-Software development tasks are NOT quick questions.+Software development tasks are NOT quick questions. Code execution, however trivial, is NOT a quick question.However, these programming-related tasks are quick questions: writing trivial code snippets (fewer than 30 lines), filling a single function or class, explaining concepts, writing tutorials and documentation.Respond with a concise thought then a YES if the question is a quick question, otherwise, a NO or a SEARCH. Your response:"""diff --git a/metagpt/roles/di/engineer2.py b/metagpt/roles/di/engineer2.pyindex fbade0421..f6c3a6658 100644--- a/metagpt/roles/di/engineer2.py+++ b/metagpt/roles/di/engineer2.py@@ -1,9 +1,12 @@from __future__ import annotations+from pydantic import Field+from metagpt.actions.write_code_review import ReviewAndRewriteCodefrom metagpt.prompts.di.engineer2 import ENGINEER2_INSTRUCTIONfrom metagpt.roles.di.role_zero import RoleZerofrom metagpt.strategy.experience_retriever import ENGINEER_EXAMPLE+from metagpt.tools.libs.terminal import Terminalclass Engineer2(RoleZero):@@ -12,13 +15,16 @@ class Engineer2(RoleZero):goal: str = "Take on game, app, and web development."instruction: str = ENGINEER2_INSTRUCTION- tools: list[str] = ["Plan", "Editor:write,read", "RoleZero", "ReviewAndRewriteCode"]+ terminal: Terminal = Field(default_factory=Terminal, exclude=True)++ tools: list[str] = ["Plan", "Editor:write,read", "RoleZero", "Terminal:run_command", "ReviewAndRewriteCode"]def _update_tool_execution(self):review = ReviewAndRewriteCode()self.tool_execution_map.update({+ "Terminal.run_command": self.terminal.run_command,"ReviewAndRewriteCode.run": review.run,"ReviewAndRewriteCode": review.run,}diff --git a/metagpt/roles/di/role_zero.py b/metagpt/roles/di/role_zero.pyindex 3228f4ab2..4e932649c 100644--- a/metagpt/roles/di/role_zero.py+++ b/metagpt/roles/di/role_zero.py@@ -64,7 +64,6 @@ class RoleZero(Role):# Equipped with three basic tools by default for optional useeditor: Editor = Editor()browser: Browser = Browser()- # terminal: Terminal = Terminal() # FIXME: TypeError: cannot pickle '_thread.lock' object# Experienceexperience_retriever: ExpRetriever = DummyExpRetriever()