diff --git a/metagpt/prompts/di/role_zero.py b/metagpt/prompts/di/role_zero.py index 54f325be1..3356ab1c0 100644 --- a/metagpt/prompts/di/role_zero.py +++ b/metagpt/prompts/di/role_zero.py @@ -220,15 +220,25 @@ However, you MUST respond to the user message by yourself directly, DON'T ask yo """ REPORT_TO_HUMAN_PROMPT = """ -# Restrictions -{requirements_constraints} +## Examlpe +example 1: +User requirement: create a 2048 game +reply: The development of the 2048 game has been completed. All files (index.html, style.css, and script.js) have been created and reviewed. -You have just finished all tasks. -Reply to the human requirements. -Do not output any other format. -Your reply is: +example 2: +User requirement: Crawl and extract all the herb names from the website, Tell me the number of herbs. +reply : The herb names have been successfully extracted. A total of 8 herb names were extracted. + +------------ + +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} +Directly output your reply content. Do not add any output format. """ SUMMARY_PROMPT = """ 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. """ diff --git a/metagpt/roles/di/role_zero.py b/metagpt/roles/di/role_zero.py index 4edb2e37d..4064088f7 100644 --- a/metagpt/roles/di/role_zero.py +++ b/metagpt/roles/di/role_zero.py @@ -495,9 +495,9 @@ 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") - reply_to_human_prompt = REPORT_TO_HUMAN_PROMPT.format( - requirements_constraints=self.requirements_constraints, - ) + 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 "") 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)]))