🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
update comment
seehi4e1955eba819
diff --git a/metagpt/exp_pool/context_builders/role_zero.py b/metagpt/exp_pool/context_builders/role_zero.pyindex aa5524ab4..924bd56aa 100644--- a/metagpt/exp_pool/context_builders/role_zero.py+++ b/metagpt/exp_pool/context_builders/role_zero.py@@ -12,12 +12,12 @@ class RoleZeroContextBuilder(BaseContextBuilder):"""Builds the role zero context string.Note:- 1. The expected format for `req`, e.g., [{...}, {"role": "user", "content": "context"}, {"role": "user", "content": "context exp part"}].- 2. Returns the original `req` if it is empty, incorrectly formatted or there are no experiences.+ 1. The expected format for `req`, e.g., [{...}, {"role": "user", "content": "context"}].+ 2. Returns the original `req` if it is empty.3. Creates a copy of req and replaces the example content in the copied req with actual experiences."""- if not req or len(req) < 2:+ if not req:return reqexps = self.format_exps()@@ -26,12 +26,12 @@ class RoleZeroContextBuilder(BaseContextBuilder):req_copy = copy.deepcopy(req)- req_copy[-2]["content"] = self.replace_example_content(req_copy[-2].get("content", ""), exps)+ req_copy[-1]["content"] = self.replace_example_content(req_copy[-1].get("content", ""), exps)return req_copydef replace_example_content(self, text: str, new_example_content: str) -> str:- return self.replace_content_between_markers(text, "# Example", "# Available Commands", new_example_content)+ return self.replace_content_between_markers(text, "# Example", "# Instruction", new_example_content)@staticmethoddef replace_content_between_markers(text: str, start_marker: str, end_marker: str, new_content: str) -> str:diff --git a/metagpt/prompts/di/role_zero.py b/metagpt/prompts/di/role_zero.pyindex 41b9e023e..b2e931e23 100644--- a/metagpt/prompts/di/role_zero.py+++ b/metagpt/prompts/di/role_zero.py@@ -18,9 +18,6 @@ class Task(BaseModel):task_type: str = ""assignee: str = ""-# Example-{example}-# Available Commands{available_commands}Special Command: Use {{"command_name": "end"}} to do nothing or indicate completion of all requirements and the end of actions.@@ -34,6 +31,9 @@ Special Command: Use {{"command_name": "end"}} to do nothing or indicate complet# Current Task{current_task}+# Example+{example}+# Instruction{instruction}