From dbefcb9e44bf92cc0e64da0586da1dc348147a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BC=9F=E9=9F=AC?= Date: Mon, 9 Sep 2024 17:39:30 +0800 Subject: [PATCH 1/6] remove requirement analyze --- metagpt/prompts/di/engineer2.py | 1 + metagpt/prompts/di/role_zero.py | 7 +++++-- metagpt/prompts/di/team_leader.py | 3 ++- metagpt/roles/di/role_zero.py | 2 -- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/metagpt/prompts/di/engineer2.py b/metagpt/prompts/di/engineer2.py index 70e45acb5..690384471 100644 --- a/metagpt/prompts/di/engineer2.py +++ b/metagpt/prompts/di/engineer2.py @@ -76,6 +76,7 @@ Note: 19. When the requirement is simple, you don't need to create a plan, just do it right away. 20. 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. 21. When using the editor, pay attention to the editor's current directory. When you use editor tools, the paths must be either absolute or relative to the editor's current directory. +22. The default programming languages are HTML (.html), CSS (.css), and JavaScript (.js). """ CURRENT_STATE = """ The current editor state is: diff --git a/metagpt/prompts/di/role_zero.py b/metagpt/prompts/di/role_zero.py index a6b111d95..bc14cc555 100644 --- a/metagpt/prompts/di/role_zero.py +++ b/metagpt/prompts/di/role_zero.py @@ -44,8 +44,11 @@ Special Command: Use {{"command_name": "end"}} to do nothing or indicate complet # Example {example} -# Instruction +# Role Instruction {instruction} + +# Common Instruction +1. Choose a language the user can understand for responding. Usually, use the same as the user's message. """ CMD_EXPERIENCE_MASK = f""" @@ -87,9 +90,9 @@ Output should adhere to the following format. ] ``` Notice: your output JSON data section must start with **```json [** +Firstly, the language of the response is... """ ) - THOUGHT_GUIDANCE = """ First, describe the actions you have taken recently. Second, describe the messages you have received recently, with a particular emphasis on messages from users. If necessary, develop a plan to address the new user requirements. diff --git a/metagpt/prompts/di/team_leader.py b/metagpt/prompts/di/team_leader.py index 8d85a8cf3..6f3ebb129 100644 --- a/metagpt/prompts/di/team_leader.py +++ b/metagpt/prompts/di/team_leader.py @@ -32,8 +32,9 @@ Note: 9. Do not use the 'end' command when the current task remains unfinished; instead, use the 'finish_current_task' command to indicate completion before switching to the next task. 10. Do not use escape characters in json data, particularly within file paths. 11. Analyze the capabilities of team members and assign tasks to them based on user Requirements. If the requirements ask to ignore certain tasks, follow the requirements. -12. Add default web technologies: HTML (*.html), CSS (*.css), and JavaScript (*.js) to your requirements.If no specific programming language is required, include these technologies in the project requirements. Using instruction to forward this information to your team members. +12. If the requirement doesn't specify, use HTML (.html), CSS (.css), and JavaScript (.js) as the default languages. Report this to your team member. 13. If the the user message is a question. use 'reply to human' to respond to the question, and then end. +14. Instructions and reply must be in the same language. """ TL_THOUGHT_GUIDANCE = ( THOUGHT_GUIDANCE diff --git a/metagpt/roles/di/role_zero.py b/metagpt/roles/di/role_zero.py index db8d2aa5f..58925ce99 100644 --- a/metagpt/roles/di/role_zero.py +++ b/metagpt/roles/di/role_zero.py @@ -10,7 +10,6 @@ from typing import Annotated, Callable, Dict, List, Literal, Optional, Tuple from pydantic import Field, model_validator from metagpt.actions import Action, UserRequirement -from metagpt.actions.analyze_requirements import AnalyzeRequirementsRestrictions from metagpt.actions.di.run_command import RunCommand from metagpt.actions.search_enhanced_qa import SearchEnhancedQA from metagpt.const import IMAGES @@ -179,7 +178,6 @@ class RoleZero(Role): if not self.planner.plan.goal: self.planner.plan.goal = self.get_memories()[-1].content - self.requirements_constraints = await AnalyzeRequirementsRestrictions().run(self.planner.plan.goal) ### 1. Experience ### example = self._retrieve_experience() From a34394e66f89451d58ecae15dd92a64d0eb0690f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BC=9F=E9=9F=AC?= Date: Mon, 9 Sep 2024 19:00:52 +0800 Subject: [PATCH 2/6] Reinforce the default programming languages. --- metagpt/prompts/di/team_leader.py | 2 +- metagpt/strategy/experience_retriever.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/metagpt/prompts/di/team_leader.py b/metagpt/prompts/di/team_leader.py index 6f3ebb129..01c8de20f 100644 --- a/metagpt/prompts/di/team_leader.py +++ b/metagpt/prompts/di/team_leader.py @@ -32,7 +32,7 @@ Note: 9. Do not use the 'end' command when the current task remains unfinished; instead, use the 'finish_current_task' command to indicate completion before switching to the next task. 10. Do not use escape characters in json data, particularly within file paths. 11. Analyze the capabilities of team members and assign tasks to them based on user Requirements. If the requirements ask to ignore certain tasks, follow the requirements. -12. If the requirement doesn't specify, use HTML (.html), CSS (.css), and JavaScript (.js) as the default languages. Report this to your team member. +12.Default technology stack is HTML (.html), CSS (.css), and JavaScript (.js). When developing software, include this stack and add any specific programming languages to the instructions. 13. If the the user message is a question. use 'reply to human' to respond to the question, and then end. 14. Instructions and reply must be in the same language. """ diff --git a/metagpt/strategy/experience_retriever.py b/metagpt/strategy/experience_retriever.py index 416e16279..9f4ae944e 100644 --- a/metagpt/strategy/experience_retriever.py +++ b/metagpt/strategy/experience_retriever.py @@ -470,7 +470,7 @@ class TRDExpRetriever(ExpRetriever): TL_EXAMPLE = """ ## example 1 -User Requirement: Create a cli snake game using Python. +User Requirement: Create a cli snake game. Explanation: The requirement is about software development. Assign each tasks to a different team member based on their expertise. When publishing message to Product Manager, we copy original user requirement directly to ensure no information loss. ```json [ @@ -479,7 +479,7 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "1", "dependent_task_ids": [], - "instruction": "Create a product requirement document (PRD) outlining the features, user interface, and user experience of the CLI python snake game. Using Python as the programming language.", + "instruction": "Create a product requirement document (PRD) outlining the features, user interface. Using ... as the programming language.", "assignee": "Alice" } }, @@ -488,7 +488,7 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "2", "dependent_task_ids": ["1"], - "instruction": "Design the software architecture for the CLI snake game, including the choice of programming language, libraries, and data flow. Using Python as the programming language.", + "instruction": "Design the software architecture for the CLI snake game, including the choice of programming language, libraries, and data flow. Using ... as the programming language.", "assignee": "Bob" } }, @@ -506,14 +506,14 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "4", "dependent_task_ids": ["3"], - "instruction": "Implement the core game logic for the CLI snake game, including snake movement, food generation, and score tracking. Using Python as the programming language.", + "instruction": "Implement the core game logic for the CLI snake game, including snake movement, food generation, and score tracking. Using ... as the programming language.", "assignee": "Alex" } }, { "command_name": "TeamLeader.publish_message", "args": { - "content": "Create a cli snake game. Using Python as the programming language.", + "content": "Create a cli snake game. Using ... as the programming language.", "send_to": "Alice" } }, From 6365995f71bf43c4989c7dbba792a73301f1582c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BC=9F=E9=9F=AC?= Date: Mon, 9 Sep 2024 20:48:42 +0800 Subject: [PATCH 3/6] remove requirements_constraints --- metagpt/prompts/di/role_zero.py | 19 ++++++++++++------- metagpt/prompts/di/team_leader.py | 7 ++++--- metagpt/roles/di/role_zero.py | 12 ++++++------ metagpt/strategy/experience_retriever.py | 6 +++--- src/index.html | 21 +++++++++++++++++++++ 5 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 src/index.html diff --git a/metagpt/prompts/di/role_zero.py b/metagpt/prompts/di/role_zero.py index bc14cc555..729a22090 100644 --- a/metagpt/prompts/di/role_zero.py +++ b/metagpt/prompts/di/role_zero.py @@ -44,11 +44,9 @@ Special Command: Use {{"command_name": "end"}} to do nothing or indicate complet # Example {example} -# Role Instruction +# Instruction {instruction} -# Common Instruction -1. Choose a language the user can understand for responding. Usually, use the same as the user's message. """ CMD_EXPERIENCE_MASK = f""" @@ -67,8 +65,8 @@ CMD_PROMPT = ( # Current Task {current_task} -# Restrictions -{requirements_constraints} +# Respond Language +you must respond in {respond_language}. Pay close attention to the Example provided, you can reuse the example for your current situation if it fits. You may use any of the available commands to create a plan or update the plan. You may output mutiple commands, they will be executed sequentially. @@ -90,7 +88,6 @@ Output should adhere to the following format. ] ``` Notice: your output JSON data section must start with **```json [** -Firstly, the language of the response is... """ ) THOUGHT_GUIDANCE = """ @@ -239,7 +236,7 @@ reply : The herb names have been successfully extracted. A total of 8 herb names Carefully review the history and respond to the user in the expected language to meet their requirements. If you have any deliverables that are helpful in explaining the results (such as files, metrics, quantitative results, etc.), provide brief descriptions of them. Your reply must be concise. -{lanaguge_restruction} +You must respond in {respond_language} Directly output your reply content. Do not add any output format. """ SUMMARY_PROMPT = """ @@ -247,3 +244,11 @@ Summarize what you have accomplished lately. Be concise. If you produce any deliverables, include their short descriptions and file paths. If there are any metrics or quantitative results, include them, too. If the deliverable is code, only output the file path. """ + +RESPOND_LANGUAGE_DETECT = """ +The requirement is: +{requirement} + +Which Natural Language must you respond in? +Output only the language type. +""" diff --git a/metagpt/prompts/di/team_leader.py b/metagpt/prompts/di/team_leader.py index 01c8de20f..f2dcd722b 100644 --- a/metagpt/prompts/di/team_leader.py +++ b/metagpt/prompts/di/team_leader.py @@ -32,9 +32,10 @@ Note: 9. Do not use the 'end' command when the current task remains unfinished; instead, use the 'finish_current_task' command to indicate completion before switching to the next task. 10. Do not use escape characters in json data, particularly within file paths. 11. Analyze the capabilities of team members and assign tasks to them based on user Requirements. If the requirements ask to ignore certain tasks, follow the requirements. -12.Default technology stack is HTML (.html), CSS (.css), and JavaScript (.js). When developing software, include this stack and add any specific programming languages to the instructions. -13. If the the user message is a question. use 'reply to human' to respond to the question, and then end. -14. Instructions and reply must be in the same language. +12. If the the user message is a question. use 'reply to human' to respond to the question, and then end. +13. Instructions and reply must be in the same language. +14. Default technology stack is HTML (.html), CSS (.css), and JavaScript (.js). Web app is the default option when developing software. +15. You are the only one who decides the programming language for the software, so the instruction must contain the programming language. """ TL_THOUGHT_GUIDANCE = ( THOUGHT_GUIDANCE diff --git a/metagpt/roles/di/role_zero.py b/metagpt/roles/di/role_zero.py index 58925ce99..6e5618faa 100644 --- a/metagpt/roles/di/role_zero.py +++ b/metagpt/roles/di/role_zero.py @@ -27,6 +27,7 @@ from metagpt.prompts.di.role_zero import ( QUICK_THINK_SYSTEM_PROMPT, REGENERATE_PROMPT, REPORT_TO_HUMAN_PROMPT, + RESPOND_LANGUAGE_DETECT, ROLE_INSTRUCTION, SUMMARY_PROMPT, SYSTEM_PROMPT, @@ -91,7 +92,7 @@ class RoleZero(Role): commands: list[dict] = [] # commands to be executed memory_k: int = 200 # number of memories (messages) to use as historical context use_fixed_sop: bool = False - requirements_constraints: str = "" # the constraints in user requirements + respond_language: str = "" # the constraints of respond language use_summary: bool = True # whether to summarize at the end @model_validator(mode="after") @@ -178,7 +179,8 @@ class RoleZero(Role): if not self.planner.plan.goal: self.planner.plan.goal = self.get_memories()[-1].content - + repond_language_detect = RESPOND_LANGUAGE_DETECT.format(requirement=self.planner.plan.goal) + self.respond_language = await self.llm.aask(repond_language_detect) ### 1. Experience ### example = self._retrieve_experience() @@ -204,7 +206,7 @@ class RoleZero(Role): current_state=self.cmd_prompt_current_state, plan_status=plan_status, current_task=current_task, - requirements_constraints=self.requirements_constraints, + respond_language=self.respond_language, ) ### Recent Observation ### @@ -547,9 +549,7 @@ class RoleZero(Role): # Ensure reply to the human before the "end" command is executed. Hard code k=5 for checking. if not any(["reply_to_human" in memory.content for memory in self.get_memories(k=5)]): logger.info("manually reply to human") - pattern = r"\[Language Restrictions\](.*?)\n" - match = re.search(pattern, self.requirements_constraints, re.DOTALL) - reply_to_human_prompt = REPORT_TO_HUMAN_PROMPT.format(lanaguge_restruction=match.group(0) if match else "") + reply_to_human_prompt = REPORT_TO_HUMAN_PROMPT.format(respond_language=self.respond_language) async with ThoughtReporter(enable_llm_stream=True) as reporter: await reporter.async_report({"type": "quick"}) reply_content = await self.llm.aask(self.llm.format_msg(memory + [UserMessage(reply_to_human_prompt)])) diff --git a/metagpt/strategy/experience_retriever.py b/metagpt/strategy/experience_retriever.py index 9f4ae944e..268a3e7a0 100644 --- a/metagpt/strategy/experience_retriever.py +++ b/metagpt/strategy/experience_retriever.py @@ -479,7 +479,7 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "1", "dependent_task_ids": [], - "instruction": "Create a product requirement document (PRD) outlining the features, user interface. Using ... as the programming language.", + "instruction": "Using HTML, CSS, JavaScrip as the programming language. And create a product requirement document (PRD) outlining the features, user interface. ", "assignee": "Alice" } }, @@ -488,7 +488,7 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "2", "dependent_task_ids": ["1"], - "instruction": "Design the software architecture for the CLI snake game, including the choice of programming language, libraries, and data flow. Using ... as the programming language.", + "instruction": "Using HTML, CSS, JavaScrip as the programming language. Design the software architecture for the CLI snake game, including the data flow.", "assignee": "Bob" } }, @@ -513,7 +513,7 @@ Explanation: The requirement is about software development. Assign each tasks to { "command_name": "TeamLeader.publish_message", "args": { - "content": "Create a cli snake game. Using ... as the programming language.", + "content": "Using HTML, CSS, JavaScrip as the programming language. Create a cli snake game.", "send_to": "Alice" } }, diff --git a/src/index.html b/src/index.html new file mode 100644 index 000000000..1bf94c961 --- /dev/null +++ b/src/index.html @@ -0,0 +1,21 @@ + + + + + + Flappy Bird + + + +
+
+
+
+
+
+
+
Score: 0
+
+ + + \ No newline at end of file From 3de17e50676118b13f6f176c9a9602ad87354c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BC=9F=E9=9F=AC?= Date: Tue, 10 Sep 2024 11:01:29 +0800 Subject: [PATCH 4/6] remove .html file --- src/index.html | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 src/index.html diff --git a/src/index.html b/src/index.html deleted file mode 100644 index 1bf94c961..000000000 --- a/src/index.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - Flappy Bird - - - -
-
-
-
-
-
-
-
Score: 0
-
- - - \ No newline at end of file From cb1d0f71fcc22a52d4b50299f19ea33844be2022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BC=9F=E9=9F=AC?= Date: Wed, 11 Sep 2024 15:31:42 +0800 Subject: [PATCH 5/6] use pure javascript --- metagpt/actions/write_prd_an.py | 4 ++-- metagpt/prompts/di/engineer2.py | 2 +- metagpt/prompts/di/team_leader.py | 2 +- metagpt/strategy/experience_retriever.py | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/metagpt/actions/write_prd_an.py b/metagpt/actions/write_prd_an.py index 1ceb2aade..12f3b1dea 100644 --- a/metagpt/actions/write_prd_an.py +++ b/metagpt/actions/write_prd_an.py @@ -19,8 +19,8 @@ LANGUAGE = ActionNode( PROGRAMMING_LANGUAGE = ActionNode( key="Programming Language", expected_type=str, - instruction="Python/JavaScript or other mainstream programming language.", - example="Python", + instruction="Mainstream programming language, If not specified in the requirements, use HTML, CSS, and Pure JavaScript.", + example="HTML, CSS, and Pure JavaScript", ) ORIGINAL_REQUIREMENTS = ActionNode( diff --git a/metagpt/prompts/di/engineer2.py b/metagpt/prompts/di/engineer2.py index 690384471..73127a2be 100644 --- a/metagpt/prompts/di/engineer2.py +++ b/metagpt/prompts/di/engineer2.py @@ -76,7 +76,7 @@ Note: 19. When the requirement is simple, you don't need to create a plan, just do it right away. 20. 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. 21. When using the editor, pay attention to the editor's current directory. When you use editor tools, the paths must be either absolute or relative to the editor's current directory. -22. The default programming languages are HTML (.html), CSS (.css), and JavaScript (.js). +22. The default programming languages are HTML (.html), CSS (.css), and Pure JavaScript (.js). """ CURRENT_STATE = """ The current editor state is: diff --git a/metagpt/prompts/di/team_leader.py b/metagpt/prompts/di/team_leader.py index f2dcd722b..d5bf6cb72 100644 --- a/metagpt/prompts/di/team_leader.py +++ b/metagpt/prompts/di/team_leader.py @@ -34,7 +34,7 @@ Note: 11. Analyze the capabilities of team members and assign tasks to them based on user Requirements. If the requirements ask to ignore certain tasks, follow the requirements. 12. If the the user message is a question. use 'reply to human' to respond to the question, and then end. 13. Instructions and reply must be in the same language. -14. Default technology stack is HTML (.html), CSS (.css), and JavaScript (.js). Web app is the default option when developing software. +14. Default technology stack is HTML (.html), CSS (.css), and Pure JavaScript (.js). Web app is the default option when developing software. 15. You are the only one who decides the programming language for the software, so the instruction must contain the programming language. """ TL_THOUGHT_GUIDANCE = ( diff --git a/metagpt/strategy/experience_retriever.py b/metagpt/strategy/experience_retriever.py index 268a3e7a0..38e3a6a16 100644 --- a/metagpt/strategy/experience_retriever.py +++ b/metagpt/strategy/experience_retriever.py @@ -479,7 +479,7 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "1", "dependent_task_ids": [], - "instruction": "Using HTML, CSS, JavaScrip as the programming language. And create a product requirement document (PRD) outlining the features, user interface. ", + "instruction": "Using HTML, CSS, Pure JavaScrip as the programming language. And create a product requirement document (PRD) outlining the features, user interface. ", "assignee": "Alice" } }, @@ -488,7 +488,7 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "2", "dependent_task_ids": ["1"], - "instruction": "Using HTML, CSS, JavaScrip as the programming language. Design the software architecture for the CLI snake game, including the data flow.", + "instruction": "Using HTML, CSS, Pure JavaScrip as the programming language. Design the software architecture for the CLI snake game, including the data flow.", "assignee": "Bob" } }, @@ -506,14 +506,14 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "4", "dependent_task_ids": ["3"], - "instruction": "Implement the core game logic for the CLI snake game, including snake movement, food generation, and score tracking. Using ... as the programming language.", + "instruction": "Using HTML, CSS, Pure JavaScrip as the programming language. Implement the core game logic for the CLI snake game, including snake movement, food generation, and score tracking.", "assignee": "Alex" } }, { "command_name": "TeamLeader.publish_message", "args": { - "content": "Using HTML, CSS, JavaScrip as the programming language. Create a cli snake game.", + "content": "Using HTML, CSS, Pure JavaScrip as the programming language. Create a cli snake game.", "send_to": "Alice" } }, @@ -848,7 +848,7 @@ Here's the plan: 1. **Task 1**: Create `index.html` - This file will contain the HTML structure necessary for the game's UI. 2. **Task 2**: Create `style.css` - This file will define the CSS styles to make the game visually appealing and responsive. -3. **Task 3**: Create `script.js` - This file will contain the JavaScript code for the game logic and UI interactions. +3. **Task 3**: Create `script.js` - This file will contain the Pure JavaScript code for the game logic and UI interactions. Let's start by appending the first task to the plan. @@ -877,7 +877,7 @@ Let's start by appending the first task to the plan. "args": { "task_id": "3", "dependent_task_ids": ["1", "2"], - "instruction": "Create the script.js file containing the JavaScript logic for the 2048 game.", + "instruction": "Create the script.js file containing the Pure JavaScript logic for the 2048 game.", "assignee": "Alex" } } From 81dd72bc4c62acc80817ddde21e51870783b7576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BC=9F=E9=9F=AC?= Date: Wed, 11 Sep 2024 16:54:08 +0800 Subject: [PATCH 6/6] update prompt --- metagpt/actions/write_prd_an.py | 2 +- metagpt/prompts/di/role_zero.py | 4 ++-- metagpt/prompts/di/team_leader.py | 2 +- metagpt/roles/di/role_zero.py | 8 ++++---- metagpt/strategy/experience_retriever.py | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/metagpt/actions/write_prd_an.py b/metagpt/actions/write_prd_an.py index 12f3b1dea..f64997bd2 100644 --- a/metagpt/actions/write_prd_an.py +++ b/metagpt/actions/write_prd_an.py @@ -19,7 +19,7 @@ LANGUAGE = ActionNode( PROGRAMMING_LANGUAGE = ActionNode( key="Programming Language", expected_type=str, - instruction="Mainstream programming language, If not specified in the requirements, use HTML, CSS, and Pure JavaScript.", + instruction="Mainstream programming language. If not specified in the requirements, use HTML, CSS, and Pure JavaScript.", example="HTML, CSS, and Pure JavaScript", ) diff --git a/metagpt/prompts/di/role_zero.py b/metagpt/prompts/di/role_zero.py index 729a22090..3ed9389a6 100644 --- a/metagpt/prompts/di/role_zero.py +++ b/metagpt/prompts/di/role_zero.py @@ -65,7 +65,7 @@ CMD_PROMPT = ( # Current Task {current_task} -# Respond Language +# Response Language you must respond in {respond_language}. Pay close attention to the Example provided, you can reuse the example for your current situation if it fits. @@ -245,7 +245,7 @@ If you produce any deliverables, include their short descriptions and file paths If the deliverable is code, only output the file path. """ -RESPOND_LANGUAGE_DETECT = """ +DETECT_LANGUAGE_PROMPT = """ The requirement is: {requirement} diff --git a/metagpt/prompts/di/team_leader.py b/metagpt/prompts/di/team_leader.py index d5bf6cb72..139021ae1 100644 --- a/metagpt/prompts/di/team_leader.py +++ b/metagpt/prompts/di/team_leader.py @@ -32,7 +32,7 @@ Note: 9. Do not use the 'end' command when the current task remains unfinished; instead, use the 'finish_current_task' command to indicate completion before switching to the next task. 10. Do not use escape characters in json data, particularly within file paths. 11. Analyze the capabilities of team members and assign tasks to them based on user Requirements. If the requirements ask to ignore certain tasks, follow the requirements. -12. If the the user message is a question. use 'reply to human' to respond to the question, and then end. +12. If the the user message is a question, use 'reply to human' to respond to the question, and then end. 13. Instructions and reply must be in the same language. 14. Default technology stack is HTML (.html), CSS (.css), and Pure JavaScript (.js). Web app is the default option when developing software. 15. You are the only one who decides the programming language for the software, so the instruction must contain the programming language. diff --git a/metagpt/roles/di/role_zero.py b/metagpt/roles/di/role_zero.py index 6e5618faa..71e0ab426 100644 --- a/metagpt/roles/di/role_zero.py +++ b/metagpt/roles/di/role_zero.py @@ -20,6 +20,7 @@ from metagpt.logs import logger from metagpt.prompts.di.role_zero import ( ASK_HUMAN_COMMAND, CMD_PROMPT, + DETECT_LANGUAGE_PROMPT, JSON_REPAIR_PROMPT, QUICK_RESPONSE_SYSTEM_PROMPT, QUICK_THINK_EXAMPLES, @@ -27,7 +28,6 @@ from metagpt.prompts.di.role_zero import ( QUICK_THINK_SYSTEM_PROMPT, REGENERATE_PROMPT, REPORT_TO_HUMAN_PROMPT, - RESPOND_LANGUAGE_DETECT, ROLE_INSTRUCTION, SUMMARY_PROMPT, SYSTEM_PROMPT, @@ -92,7 +92,7 @@ class RoleZero(Role): commands: list[dict] = [] # commands to be executed memory_k: int = 200 # number of memories (messages) to use as historical context use_fixed_sop: bool = False - respond_language: str = "" # the constraints of respond language + respond_language: str = "" # Language for responding humans and publishing messages. use_summary: bool = True # whether to summarize at the end @model_validator(mode="after") @@ -179,8 +179,8 @@ class RoleZero(Role): if not self.planner.plan.goal: self.planner.plan.goal = self.get_memories()[-1].content - repond_language_detect = RESPOND_LANGUAGE_DETECT.format(requirement=self.planner.plan.goal) - self.respond_language = await self.llm.aask(repond_language_detect) + detect_language_prompt = DETECT_LANGUAGE_PROMPT.format(requirement=self.planner.plan.goal) + self.respond_language = await self.llm.aask(detect_language_prompt) ### 1. Experience ### example = self._retrieve_experience() diff --git a/metagpt/strategy/experience_retriever.py b/metagpt/strategy/experience_retriever.py index 38e3a6a16..0f51f60db 100644 --- a/metagpt/strategy/experience_retriever.py +++ b/metagpt/strategy/experience_retriever.py @@ -479,7 +479,7 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "1", "dependent_task_ids": [], - "instruction": "Using HTML, CSS, Pure JavaScrip as the programming language. And create a product requirement document (PRD) outlining the features, user interface. ", + "instruction": "Use HTML, CSS, Pure JavaScrip as the programming language. And create a product requirement document (PRD) outlining the features, user interface. ", "assignee": "Alice" } }, @@ -488,7 +488,7 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "2", "dependent_task_ids": ["1"], - "instruction": "Using HTML, CSS, Pure JavaScrip as the programming language. Design the software architecture for the CLI snake game, including the data flow.", + "instruction": "Use HTML, CSS, Pure JavaScrip as the programming language. Design the software architecture for the CLI snake game, including the data flow.", "assignee": "Bob" } }, @@ -506,14 +506,14 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "4", "dependent_task_ids": ["3"], - "instruction": "Using HTML, CSS, Pure JavaScrip as the programming language. Implement the core game logic for the CLI snake game, including snake movement, food generation, and score tracking.", + "instruction": "Use HTML, CSS, Pure JavaScrip as the programming language. Implement the core game logic for the CLI snake game, including snake movement, food generation, and score tracking.", "assignee": "Alex" } }, { "command_name": "TeamLeader.publish_message", "args": { - "content": "Using HTML, CSS, Pure JavaScrip as the programming language. Create a cli snake game.", + "content": "Use HTML, CSS, Pure JavaScrip as the programming language. Create a cli snake game.", "send_to": "Alice" } },