fixbug: write software framework, rfc243

This commit is contained in:
莘权 马 2024-06-17 15:25:40 +08:00
parent 5911d3ce70
commit cf8efc9f67
8 changed files with 211 additions and 74 deletions

View file

@ -70,5 +70,5 @@ class EvaluateAction(Action):
val = evaluations.get(vote, [])
val.append(evaluation)
if len(val) > 1:
return EvaluationData(is_pass=vote, evaluations="\n".join(val))
return EvaluationData(is_pass=vote, conclusion="\n".join(val))
evaluations[vote] = val

View file

@ -8,6 +8,7 @@
"""
import json
import uuid
from datetime import datetime
from pathlib import Path
from typing import Optional, Union, List
@ -22,7 +23,11 @@ from metagpt.utils.common import awrite
@register_tool(tags=["software framework"])
async def save_framework(dir_data: str, output_dir: Optional[Union[str, Path]] = None) -> List[str]:
output_dir = Path(output_dir) if output_dir else DEFAULT_WORKSPACE_ROOT / uuid.uuid4().hex
output_dir = (
Path(output_dir)
if output_dir
else DEFAULT_WORKSPACE_ROOT / (datetime.now().strftime("%Y%m%d%H%M%S") + uuid.uuid4().hex[0:8])
)
output_dir.mkdir(parents=True, exist_ok=True)
json_data = dir_data.removeprefix("```json").removesuffix("```")

View file

@ -91,7 +91,8 @@ PROMPT = """
You are a tool that evaluates the quality of framework code based on the TRD content;
You need to refer to the content of the "Legacy TRD" section to check for any errors or omissions in the framework code found in "Legacy Outputs";
The content of "Actor, System, External System" provides an explanation of actors and systems that appear in UML Use Case diagram;
Information missing from the "Legacy TRD" can be found in the "Acknowledge" section;
Information about the external system missing from the "Legacy TRD" can be found in the "Acknowledge" section;
Which interfaces defined in "Acknowledge" are used in the "Legacy TRD"? Do not implement the interface in "Acknowledge" section until it is used in "Legacy TRD";
Parts not mentioned in the "Legacy TRD" will be handled by other TRDs, therefore, processes not present in the "Legacy TRD" are considered ready;
"Additional Technical Requirements" specifies the additional technical requirements that the generated software framework code must meet;
Return a markdown JSON object with:

View file

@ -116,18 +116,20 @@ PROMPT = """
---
You are a tool that generates software framework code based on TRD.
The content of "Actor, System, External System" provides an explanation of actors and systems that appear in UML Use Case diagram;
The descriptions of the interfaces used in the "TRD" can be found in the "Acknowledge" section;
The descriptions of the interfaces of the external system used in the "TRD" can be found in the "Acknowledge" section; Do not implement the interface of the external system in "Acknowledge" section until it is used in "TRD";
"Legacy Outputs" contains the software framework code generated by you last time, which you can improve by addressing the issues raised in "Evaluation Conclusion";
"Additional Technical Requirements" specifies the additional technical requirements that the generated software framework code must meet;
Develop source code based on the content of the "TRD";
- The `README.md` file should include:
- The folder structure diagram of the entire project;
- Class diagram and sequence diagram in PlantUML format;
- Correspondence between classes, interfaces, and functions with the content in the "TRD" section
- Prerequisites if necessary;
- Installation if necessary;
- Configuration if necessary;
- Usage if necessary;
- The `CLASS.md` file should include the class diagram in PlantUML format;
- The `SEQUENCE.md` file should include the sequence diagram in PlantUML format;
- Code comments using Google style;
Return a markdown JSON object list, each object containing:
- a "path" key with a value specifying its path;