fixbug: output_pathname是目录

This commit is contained in:
莘权 马 2024-08-15 19:39:25 +08:00
parent bd63a7c665
commit 7f3befdf05
7 changed files with 37 additions and 11 deletions

View file

@ -32,6 +32,7 @@ from metagpt.tools.tool_registry import register_tool
from metagpt.utils.common import (
aread,
awrite,
rectify_pathname,
save_json_to_markdown,
to_markdown_code_block,
)
@ -262,10 +263,10 @@ class WriteDesign(Action):
)
if not output_pathname:
output_pathname = Path(output_pathname) / "docs" / "sytem_design.json"
output_pathname = Path(output_pathname) / "docs" / "system_design.json"
elif not Path(output_pathname).is_absolute():
output_pathname = self.config.workspace.path / output_pathname
output_pathname = Path(output_pathname)
output_pathname = rectify_pathname(path=output_pathname, default_filename="system_design.json")
await awrite(filename=output_pathname, data=design.content)
output_filename = output_pathname.parent / f"{output_pathname.stem}-class-diagram"
await self._save_data_api_design(design_doc=design, output_filename=output_filename)

View file

@ -26,6 +26,7 @@ from metagpt.tools.tool_registry import register_tool
from metagpt.utils.common import (
aread,
awrite,
rectify_pathname,
save_json_to_markdown,
to_markdown_code_block,
)
@ -191,7 +192,7 @@ class WriteTasks(Action):
output_pathname = Path(output_pathname) / "docs" / "project_schedule.json"
elif not Path(output_pathname).is_absolute():
output_pathname = self.config.workspace.path / output_pathname
output_pathname = Path(output_pathname)
output_pathname = rectify_pathname(path=output_pathname, default_filename="project_schedule.json")
await awrite(filename=output_pathname, data=file_content)
md_output_filename = output_pathname.with_suffix(".md")
await save_json_to_markdown(content=file_content, output_filename=md_output_filename)

View file

@ -43,6 +43,7 @@ from metagpt.utils.common import (
CodeParser,
aread,
awrite,
rectify_pathname,
save_json_to_markdown,
to_markdown_code_block,
)
@ -314,7 +315,7 @@ class WritePRD(Action):
output_pathname = self.config.workspace.path / "docs" / "prd.json"
elif not Path(output_pathname).is_absolute():
output_pathname = self.config.workspace.path / output_pathname
output_pathname = Path(output_pathname)
output_pathname = rectify_pathname(path=output_pathname, default_filename="prd.json")
await awrite(filename=output_pathname, data=new_prd.content)
competitive_analysis_filename = output_pathname.parent / f"{output_pathname.stem}-competitive-analysis"
await self._save_competitive_analysis(prd_doc=new_prd, output_filename=Path(competitive_analysis_filename))