diff --git a/metagpt/actions/di/detect_intent.py b/metagpt/actions/di/detect_intent.py index bfefcacff..db8ba332e 100644 --- a/metagpt/actions/di/detect_intent.py +++ b/metagpt/actions/di/detect_intent.py @@ -31,12 +31,11 @@ class SOPItem(Enum): name="software development", description="Intentions related to or including software development, such as developing or building software, games, app, websites, etc. Excluding bug fixes, report any issues, environment setup, operations and pip install.", sop=[ - "Writes a PRD based on software requirements.", - "Writes a design to the project repository, based on the PRD of the project.", - "Writes a project plan to the project repository, based on the design of the project.", - "Writes code to implement designed features according to the project plan and adds them to the project repository.", - # "Run QA test on the project repository.", - "Stage and commit changes for the project repository using Git.", + "Using `write_prd` to write a PRD based on software requirements.", + "Using `write_design` to write a design to the project repository, based on the PRD of the project.", + "Using `write_project_plan` to write a project plan to the project repository, based on the design of the project.", + "Using `write_codes` to write code to implement designed features according to the project plan and adds them to the project repository.", + "Using `git_archive` to stage and commit changes for the project repository using Git.", ], ) FIX_BUGS = SOPItemDef( @@ -94,11 +93,13 @@ Intention index: REQ_WITH_SOP = """ {user_requirement} -## Knowledge -To meet user requirements, the following standard operating procedure(SOP) must be used. -SOP descriptions cannot be modified; user requirements can only be appended to the end of corresponding steps. +### Knowledge +To meet user requirements, the following standard operating procedure(SOP) must be used: {sop} + +### SOP Type +{sop_type} """ @@ -119,7 +120,9 @@ class DetectIntent(Action): req_with_sop = ( REQ_WITH_SOP.format( - user_requirement=user_requirement, sop="\n".join([f"{i + 1}. {v}" for i, v in enumerate(sop)]) + user_requirement=user_requirement, + sop="\n".join([f"{i + 1}. {v}" for i, v in enumerate(sop)]), + sop_type=sop_type, ) if sop else user_requirement diff --git a/metagpt/actions/di/write_plan.py b/metagpt/actions/di/write_plan.py index 2dbe3f0e7..83709bc1a 100644 --- a/metagpt/actions/di/write_plan.py +++ b/metagpt/actions/di/write_plan.py @@ -19,26 +19,26 @@ from metagpt.utils.common import CodeParser class WritePlan(Action): PROMPT_TEMPLATE: str = """ - # Context: - {context} - # Available Task Types: - {task_type_desc} - # Task: - Based on the context, write a plan or modify an existing plan of what you should do to achieve the goal. A plan consists of one to {max_tasks} tasks. - If you are modifying an existing plan, carefully follow the instruction, don't make unnecessary changes. Give the whole plan unless instructed to modify only one task of the plan. - If you encounter errors on the current task, revise and output the current single task only. - Output a list of jsons following the format: - ```json - [ - {{ - "task_id": str = "unique identifier for a task in plan, can be an ordinal", - "dependent_task_ids": list[str] = "ids of tasks prerequisite to this task", - "instruction": "what you should do in this task, one short phrase or sentence", - "task_type": "type of this task, should be one of Available Task Types", - }}, - ... - ] - ``` +# Context: +{context} +# Available Task Types: +{task_type_desc} +# Task: +Based on the context, write a plan or modify an existing plan of what you should do to achieve the goal. A plan consists of one to {max_tasks} tasks. +If you are modifying an existing plan, carefully follow the instruction, don't make unnecessary changes. Give the whole plan unless instructed to modify only one task of the plan. +If you encounter errors on the current task, revise and output the current single task only. +Output a list of jsons following the format: +```json +[ + {{ + "task_id": str = "unique identifier for a task in plan, can be an ordinal", + "dependent_task_ids": list[str] = "ids of tasks prerequisite to this task", + "instruction": "what you should do in this task, one short phrase or sentence. If the SOP description is provided in the `Knowledge` section, the reference to the SOP description should be included intact in the instruction.", + "task_type": "type of this task, should be one of Available Task Types. You can refer to the hints in the `SOP Type` section to make a selection if `SOP Type` section is provided.", + }}, + ... +] +``` """ async def run(self, context: list[Message], max_tasks: int = 5) -> str: