优化了teamleader直接结束的问题,优化了智能体不响应新任务的问题。

This commit is contained in:
黄伟韬 2024-08-06 17:44:31 +08:00
parent 3c0f39c586
commit f7b236601c
7 changed files with 11 additions and 11 deletions

View file

@ -83,7 +83,7 @@ class WriteDesign(Action):
prd_filename (str, optional): The filename of the Product Requirement Document (PRD).
legacy_design_filename (str, optional): The filename of the legacy design document.
extra_info (str, optional): Additional information to be included in the system design.
output_pathname (str, optional): The output path name of file that the system design should be saved to. The path name must must end with '.json'.
output_pathname (str, optional): The output file path of the document.
Returns:
str: The file path of the generated system design.

View file

@ -62,7 +62,7 @@ class WriteTasks(Action):
Args:
user_requirement (str, optional): A string specifying the user's requirements. Defaults to an empty string.
design_filename (str): The filename of the project system design file. The path name must must end with '.json'. Defaults to an empty string.
design_filename (str): The output file path of the document. Defaults to an empty string.
output_pathname (str, optional): The output path name of file that the project schedule should be saved to.
**kwargs: Additional keyword arguments.

View file

@ -98,7 +98,7 @@ class WritePRD(Action):
Args:
user_requirement (str): A string detailing the user's requirements.
output_pathname (str, optional): The path name of file that the output document should be saved to. The path name must must end with '.json'. Defaults to "".
output_pathname (str, optional): The output file path of the document. Defaults to "".
legacy_prd_filename (str, optional): The file path of the legacy Product Requirement Document to use as a reference. Defaults to "".
extra_info (str, optional): Additional information to include in the document. Defaults to "".
**kwargs: Additional keyword arguments.

View file

@ -118,7 +118,9 @@ class MGXEnv(Environment):
if converted_msg.role not in ["system", "user", "assistant"]:
converted_msg.role = "assistant"
sent_from = converted_msg.metadata[AGENT] if AGENT in converted_msg.metadata else converted_msg.sent_from
converted_msg.content = f"from {sent_from} to {converted_msg.send_to}: {converted_msg.content}"
converted_msg.content = (
f"[Message] from {sent_from if sent_from else 'User'} to {converted_msg.send_to}: {converted_msg.content}"
)
return converted_msg
def __repr__(self):

View file

@ -70,7 +70,7 @@ Notice: your output JSON data section must start with **```json [**
"""
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.
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.
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.
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.
Fifth, describe if you should terminate, you should use **end** command to terminate if any of the following is met:

View file

@ -30,13 +30,14 @@ Note:
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.
13. If you find there are no specific tasks or user requirements, you must ask a human for advice on what to do next.
13. If the the user message is a question. use 'reply to human' to respond to the question, and then end end.
"""
TL_THOUGHT_GUIDANCE = (
THOUGHT_GUIDANCE
+ """
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.
Seventh, describe the technologies you must use.
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.
Seventh, describe the technologies you must use.
Eight, if the current task is None and no messages have been received so far, use 'reply to human' to respond to the human's requirements. and then use command 'end' in one respond.
"""
)
QUICK_THINK_SYSTEM_PROMPT = """

View file

@ -368,9 +368,6 @@ class RoleZero(Role):
elif cmd["command_name"] == "end":
self._set_state(-1)
# When all the plans have been completed, clear the plan's goal and wait for the next requirements.
if self.planner.current_task is None:
self.planner.plan.goal = ""
command_output = ""
# output from bash.run may be empty, add decorations to the output to ensure visibility.