Skip to content

Commit fa06a67

Browse files
committed
Merge branch 'fixbug_reply_on_corresponding_lanaguge' into 'mgx_ops'
解决了文档目标路径为文件夹的问题,解决了teamleader 不进行任何操作直接结束的问题,优化了智能体不响应新任务的问题。 See merge request pub/MetaGPT!279
2 parents 1c345d8 + cc06719 commit fa06a67

File tree

8 files changed

+15
-11
lines changed

8 files changed

+15
-11
lines changed

metagpt/actions/design_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async def run(
8383
prd_filename (str, optional): The filename of the Product Requirement Document (PRD).
8484
legacy_design_filename (str, optional): The filename of the legacy design document.
8585
extra_info (str, optional): Additional information to be included in the system design.
86-
output_pathname (str, optional): The output path name of file that the system design should be saved to.
86+
output_pathname (str, optional): The output file path of the document.
8787
8888
Returns:
8989
str: The file path of the generated system design.

metagpt/actions/project_management.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async def run(
6262
6363
Args:
6464
user_requirement (str, optional): A string specifying the user's requirements. Defaults to an empty string.
65-
design_filename (str): The filename of the project system design file. Defaults to an empty string.
65+
design_filename (str): The output file path of the document. Defaults to an empty string.
6666
output_pathname (str, optional): The output path name of file that the project schedule should be saved to.
6767
**kwargs: Additional keyword arguments.
6868
@@ -73,8 +73,9 @@ async def run(
7373
# Write a project schedule with a given system design.
7474
>>> design_filename = "/absolute/path/to/snake_game/docs/system_design.json"
7575
>>> output_pathname = "/absolute/path/to/snake_game/docs/project_schedule.json"
76+
>>> user_requirement = "Write project schedule for a snake game following these requirements:..."
7677
>>> action = WriteTasks()
77-
>>> result = await action.run(design_filename=design_filename, output_pathname=output_pathname)
78+
>>> result = await action.run(user_requirement=user_requirement, design_filename=design_filename, output_pathname=output_pathname)
7879
>>> print(result)
7980
The project schedule is at /absolute/path/to/snake_game/docs/project_schedule.json
8081

metagpt/actions/project_management_an.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
REQUIRED_PYTHON_PACKAGES = ActionNode(
1313
key="Required Python packages",
1414
expected_type=List[str],
15-
instruction="Provide required Python packages in requirements.txt format.",
15+
instruction="Provide required Python packages in requirements.txt format. The response language should correspond to the context and requirements.",
1616
example=["flask==1.1.2", "bcrypt==3.2.0"],
1717
)
1818

metagpt/actions/write_prd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ async def run(
9898
9999
Args:
100100
user_requirement (str): A string detailing the user's requirements.
101-
output_pathname (str, optional): The path name of file that the output document should be saved to. Defaults to "".
101+
output_pathname (str, optional): The output file path of the document. Defaults to "".
102102
legacy_prd_filename (str, optional): The file path of the legacy Product Requirement Document to use as a reference. Defaults to "".
103103
extra_info (str, optional): Additional information to include in the document. Defaults to "".
104104
**kwargs: Additional keyword arguments.

metagpt/environment/mgx/mgx_env.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ def move_message_info_to_content(self, message: Message) -> Message:
118118
if converted_msg.role not in ["system", "user", "assistant"]:
119119
converted_msg.role = "assistant"
120120
sent_from = converted_msg.metadata[AGENT] if AGENT in converted_msg.metadata else converted_msg.sent_from
121-
converted_msg.content = f"from {sent_from} to {converted_msg.send_to}: {converted_msg.content}"
121+
converted_msg.content = (
122+
f"[Message] from {sent_from if sent_from else 'User'} to {converted_msg.send_to}: {converted_msg.content}"
123+
)
122124
return converted_msg
123125

124126
def __repr__(self):

metagpt/prompts/di/role_zero.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Task(BaseModel):
7070
"""
7171
THOUGHT_GUIDANCE = """
7272
First, describe the actions you have taken recently.
73-
Second, describe the messages you have received recently, with a particular emphasis on messages from users.
73+
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.
7474
Third, describe the plan status and the current task. Review the histroy, if `Current Task` has been undertaken and completed by you or anyone, you MUST use the **Plan.finish_current_task** command to finish it first before taking any action, the command will automatically move you to the next task.
7575
Fourth, describe any necessary human interaction. Use **RoleZero.reply_to_human** to report your progress if you complete a task or the overall requirement, pay attention to the history, DON'T repeat reporting. Use **RoleZero.ask_human** if you failed the current task, unsure of the situation encountered, need any help from human, or executing repetitive commands but receiving repetitive feedbacks without making progress.
7676
Fifth, describe if you should terminate, you should use **end** command to terminate if any of the following is met:

metagpt/prompts/di/team_leader.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
10. Do not use escape characters in json data, particularly within file paths.
3131
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.
3232
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.
33+
13. If the the user message is a question. use 'reply to human' to respond to the question, and then end.
3334
"""
3435
TL_THOUGHT_GUIDANCE = (
3536
THOUGHT_GUIDANCE
3637
+ """
37-
Sixth, when planning, describe the requirements as they pertain to software development, data analysis, or other areas. If the requirements is a software development and no specific restrictions are mentioned, you must create a Product Requirements Document (PRD), write a System Design document, develop a project schedule, and then begin coding. List the steps you will undertake. Plan these steps in a single response.
38-
Seventh, describe the technologies you must use.
38+
Sixth, describe the requirements as they pertain to software development, data analysis, or other areas. If the requirements is a software development and no specific restrictions are mentioned, you must create a Product Requirements Document (PRD), write a System Design document, develop a project schedule, and then begin coding. List the steps you will undertake. Plan these steps in a single response.
39+
Seventh, describe the technologies you must use.
3940
"""
4041
)
4142
QUICK_THINK_SYSTEM_PROMPT = """

metagpt/roles/di/role_zero.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,10 @@ async def _run_special_command(self, cmd) -> str:
382382
tool_output = await tool_obj(**cmd["args"])
383383
if len(tool_output) <= 10:
384384
command_output += (
385-
f"\n[command]: {cmd['args']['cmd']} \n [command output] : {tool_output} (pay attention to this.)"
385+
f"\n[command]: {cmd['args']['cmd']} \n[command output] : {tool_output} (pay attention to this.)"
386386
)
387387
else:
388-
command_output += f"\n[command]: {cmd['args']['cmd']} \n [command output] : {tool_output}"
388+
command_output += f"\n[command]: {cmd['args']['cmd']} \n[command output] : {tool_output}"
389389
return command_output
390390

391391
def _get_plan_status(self) -> Tuple[str, str]:

0 commit comments

Comments
 (0)