Skip to content

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

role zero的quick think system prompt增加role info

Yizhou Chif8c690804c4d
diff --git a/metagpt/prompts/di/role_zero.py b/metagpt/prompts/di/role_zero.py
index 1bd2984a5..71625c780 100644
--- a/metagpt/prompts/di/role_zero.py
+++ b/metagpt/prompts/di/role_zero.py
@@ -151,6 +151,8 @@ For requests that are unclear, lack sufficient detail, or are outside the system
2. If the request is a "how-to" question that asks for a general study plan, approach or strategy, it should be categorized as QUICK.
{examples}
+
+{role_info}
"""
QUICK_THINK_PROMPT = """
diff --git a/metagpt/roles/di/role_zero.py b/metagpt/roles/di/role_zero.py
index 7cdd9bdea..f5278bda7 100644
--- a/metagpt/roles/di/role_zero.py
+++ b/metagpt/roles/di/role_zero.py
@@ -254,7 +254,7 @@ class RoleZero(Role):
def format_quick_system_prompt(self) -> str:
"""Format the system prompt for quick thinking."""
- return QUICK_THINK_SYSTEM_PROMPT.format(examples=QUICK_THINK_EXAMPLES)
+ return QUICK_THINK_SYSTEM_PROMPT.format(examples=QUICK_THINK_EXAMPLES, role_info=super()._get_prefix())
async def _quick_think(self) -> Tuple[Message, str]:
answer = ""
diff --git a/metagpt/roles/di/team_leader.py b/metagpt/roles/di/team_leader.py
index 8a2584905..a10b61843 100644
--- a/metagpt/roles/di/team_leader.py
+++ b/metagpt/roles/di/team_leader.py
@@ -49,13 +49,17 @@ class TeamLeader(RoleZero):
return team_info
def format_quick_system_prompt(self) -> str:
- qt_system_prompt = super().format_quick_system_prompt()
- return qt_system_prompt + QUICK_THINK_SYSTEM_PROMPT.format(
- role_info=super()._get_prefix(),
+ quick_system_prompt = super().format_quick_system_prompt()
+ return quick_system_prompt + QUICK_THINK_SYSTEM_PROMPT.format(
+ role_info="", # rolezero's quick think system prompt will include role_info
team_info=self._get_team_info(),
)
async def _quick_think(self) -> Message:
+ self.llm.system_prompt = QUICK_THINK_SYSTEM_PROMPT.format(
+ role_info=self._get_role_info(),
+ team_info=self._get_team_info(),
+ )
return await super()._quick_think()
async def _think(self) -> bool: