修改格式问题,删除冗余提示词

This commit is contained in:
黄伟韬 2024-07-24 09:59:31 +08:00
parent f4204b4beb
commit 0ec3ac8136
5 changed files with 10 additions and 11 deletions

View file

@ -279,4 +279,4 @@ class WriteDesign(Action):
md_output_filename = output_pathname.with_suffix(".md")
await save_json_to_markdown(content=design.content, output_filename=md_output_filename)
await reporter.async_report(md_output_filename, "path")
return f'System Design filename: "{str(output_pathname)}". \n The "System Design" task has been completed and is now marked as finished.'
return f'System Design filename: "{str(output_pathname)}". \n The System Design has been completed and is now marked as finished.'

View file

@ -12,8 +12,8 @@ Note:
"""
# To ensure compatibility with hard-coded experience, do not add any other content between "# Example" and "# Available Commands".
CMD_PROMPT = """
# observation
{observation}
# latest observation
{latest_observation}
# Data Structure
class Task(BaseModel):
@ -50,9 +50,9 @@ In your response, include at least one command.
# Your commands in a json array, in the following output format with correct command_name and args. If there is nothing to do, use the pass or end command:
Some text indicating your thoughts before JSON is required, such as what tasks have been completed, what tasks are next, how you should update the plan status, respond to inquiry, or seek for help. Then a json array of commands. You must output ONE and ONLY ONE json array. DON'T output multiple json arrays with thoughts between them.
Firstly, describe in natural language the actions you have taken recently.
Secondly, describe in natural language the messages you have received recently, with a particular emphasis on messages from users.
Thirdly, describe your current task in natural language. Review the histroy, if you find that the current task is identical to a previously completed one, it indicates that the current task has already been accomplished.
Firstly, describe the actions you have taken recently.
Secondly, describe the messages you have received recently, with a particular emphasis on messages from users.
Thirdly, describe your current task . Review the histroy, if you find that the current task is identical to a previously completed one, it indicates that the current task has already been accomplished.
Then, articulate your thoughts and list the commands, adhering closely to the instructions provided.
```json
[
@ -75,7 +75,7 @@ JSON_REPAIR_PROMPT = """
```json
```
Do not use escape characters in json_data, particularly within file paths.
Do not use escape characters in json data, particularly within file paths.
Help check if there are any formatting issues with the JSON data? If so, please help format it.
If no issues are detected, the original json data should be returned unchanged.
Output the JSON data in a format that can be loaded by the json.loads() function.

View file

@ -22,7 +22,7 @@ Note:
5. If you think the requirement is not clear or ambiguous, you should ask the user for clarification immediately. Assign tasks only after all info is clear.
6. It is helpful for Engineer to have both the system design and the project schedule for writing the code, so include paths of both files (if available) and remind Engineer to definitely read them when publishing message to Engineer.
7. If the requirement is writing a TRD and software framework, you should assign it to Architect. When publishing message to Architect, you should directly copy the full original user requirement.
8. If the receiver message reads 'from {{team member}} to {{\'<all>\'}}, it indicates that someone has completed the current task. For exmaple,'from Alice(Product Manager) to {{\'<all>\'}} means PDR is created,'from Bob(Architecture) to {{\'<all>\'}} means software architecture is created. Note this in your thoughts.
8. If the receiver message reads 'from {{team member}} to {{\'<all>\'}}, it indicates that someone has completed the current task. Note this in your thoughts.
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. If you have made a plan, simply follow it without creating a new one.
11. Do not use escape characters in json data, particularly within file paths.

View file

@ -31,7 +31,7 @@ class Architect(RoleZero):
"libraries. Use same language as user requirement"
)
instruction: str = """Do not output the document directly. Use WriteDesign tool to write a system design document if a system design is required; Use `write_trd_and_framework` tool to write a software framework if a software framework is required;"""
instruction: str = """Use WriteDesign tool to write a system design document if a system design is required; Use `write_trd_and_framework` tool to write a software framework if a software framework is required;"""
max_react_loop: int = 1 # FIXME: Read and edit files requires more steps, consider later
tools: list[str] = [
"Editor:write,read,write_content",

View file

@ -146,7 +146,6 @@ class RoleZero(Role):
tool_info = json.dumps({tool.name: tool.schemas for tool in tools})
### Make Decision Dynamically ###
memory = self.rc.memory.get(self.memory_k)
instruction = self.instruction.strip()
prompt = self.cmd_prompt.format(
@ -156,7 +155,7 @@ class RoleZero(Role):
plan_status=plan_status,
current_task=current_task,
instruction=instruction,
observation=memory[-1].content,
latest_observation=memory[-1].content,
)
memory = await self.parse_browser_actions(memory)
req = self.llm.format_msg(memory + [UserMessage(content=prompt)])