mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-05 14:55:18 +02:00
Merge branch 'feat-action-reporter' into 'mgx_ops'
action reporter See merge request pub/MetaGPT!198
This commit is contained in:
commit
d5f0a82e11
3 changed files with 60 additions and 48 deletions
|
|
@ -254,25 +254,29 @@ class WriteDesign(Action):
|
|||
extra_info=to_markdown_code_block(extra_info),
|
||||
prd=to_markdown_code_block(prd_content),
|
||||
)
|
||||
if not legacy_design_filename:
|
||||
node = await self._new_system_design(context=context)
|
||||
design = Document(content=node.instruct_content.model_dump_json())
|
||||
else:
|
||||
old_design_content = await aread(filename=legacy_design_filename)
|
||||
design = await self._merge(
|
||||
prd_doc=Document(content=context), system_design_doc=Document(content=old_design_content)
|
||||
)
|
||||
async with DocsReporter(enable_llm_stream=True) as reporter:
|
||||
await reporter.async_report({"type": "design"}, "meta")
|
||||
if not legacy_design_filename:
|
||||
node = await self._new_system_design(context=context)
|
||||
design = Document(content=node.instruct_content.model_dump_json())
|
||||
else:
|
||||
old_design_content = await aread(filename=legacy_design_filename)
|
||||
design = await self._merge(
|
||||
prd_doc=Document(content=context), system_design_doc=Document(content=old_design_content)
|
||||
)
|
||||
|
||||
if not output_pathname:
|
||||
output_pathname = Path(output_pathname) / "docs" / "sytem_design.json"
|
||||
output_pathname.mkdir(parents=True, exist_ok=True)
|
||||
elif not Path(output_pathname).is_absolute():
|
||||
output_pathname = DEFAULT_WORKSPACE_ROOT / output_pathname
|
||||
output_pathname = Path(output_pathname)
|
||||
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)
|
||||
output_filename = output_pathname.parent / f"{output_pathname.stem}-sequence-diagram"
|
||||
await self._save_seq_flow(design_doc=design, output_filename=output_filename)
|
||||
await save_json_to_markdown(content=design.content, output_filename=output_pathname.with_suffix(".md"))
|
||||
if not output_pathname:
|
||||
output_pathname = Path(output_pathname) / "docs" / "sytem_design.json"
|
||||
output_pathname.mkdir(parents=True, exist_ok=True)
|
||||
elif not Path(output_pathname).is_absolute():
|
||||
output_pathname = DEFAULT_WORKSPACE_ROOT / output_pathname
|
||||
output_pathname = Path(output_pathname)
|
||||
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)
|
||||
output_filename = output_pathname.parent / f"{output_pathname.stem}-sequence-diagram"
|
||||
await self._save_seq_flow(design_doc=design, output_filename=output_filename)
|
||||
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)}"'
|
||||
|
|
|
|||
|
|
@ -180,16 +180,20 @@ class WriteTasks(Action):
|
|||
if design_filename:
|
||||
content = await aread(filename=design_filename)
|
||||
context += to_markdown_code_block(content)
|
||||
node = await self._run_new_tasks(context)
|
||||
file_content = node.instruct_content.model_dump_json()
|
||||
|
||||
if not output_pathname:
|
||||
output_pathname = Path(output_pathname) / "docs" / "project_schedule.json"
|
||||
output_pathname.mkdir(parents=True, exist_ok=True)
|
||||
elif not Path(output_pathname).is_absolute():
|
||||
output_pathname = DEFAULT_WORKSPACE_ROOT / output_pathname
|
||||
output_pathname = Path(output_pathname)
|
||||
await awrite(filename=output_pathname, data=file_content)
|
||||
await save_json_to_markdown(content=file_content, output_filename=output_pathname.with_suffix(".md"))
|
||||
async with DocsReporter(enable_llm_stream=True) as reporter:
|
||||
await reporter.async_report({"type": "task"}, "meta")
|
||||
node = await self._run_new_tasks(context)
|
||||
file_content = node.instruct_content.model_dump_json()
|
||||
|
||||
if not output_pathname:
|
||||
output_pathname = Path(output_pathname) / "docs" / "project_schedule.json"
|
||||
output_pathname.mkdir(parents=True, exist_ok=True)
|
||||
elif not Path(output_pathname).is_absolute():
|
||||
output_pathname = DEFAULT_WORKSPACE_ROOT / output_pathname
|
||||
output_pathname = Path(output_pathname)
|
||||
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)
|
||||
await reporter.async_report(md_output_filename, "path")
|
||||
return f'Project Schedule filename: "{str(output_pathname)}"'
|
||||
|
|
|
|||
|
|
@ -300,23 +300,27 @@ class WritePRD(Action):
|
|||
user_requirement=to_markdown_code_block(val=user_requirement),
|
||||
extra_info=to_markdown_code_block(val=extra_info),
|
||||
)
|
||||
req = Document(content=content)
|
||||
if not legacy_prd_filename:
|
||||
node = await self._new_prd(requirement=req.content)
|
||||
new_prd = Document(content=node.instruct_content.model_dump_json())
|
||||
else:
|
||||
content = await aread(filename=legacy_prd_filename)
|
||||
old_prd = Document(content=content)
|
||||
new_prd = await self._merge(req=req, related_doc=old_prd)
|
||||
async with DocsReporter(enable_llm_stream=True) as reporter:
|
||||
await reporter.async_report({"type": "prd"}, "meta")
|
||||
req = Document(content=content)
|
||||
if not legacy_prd_filename:
|
||||
node = await self._new_prd(requirement=req.content)
|
||||
new_prd = Document(content=node.instruct_content.model_dump_json())
|
||||
else:
|
||||
content = await aread(filename=legacy_prd_filename)
|
||||
old_prd = Document(content=content)
|
||||
new_prd = await self._merge(req=req, related_doc=old_prd)
|
||||
|
||||
if not output_pathname:
|
||||
output_pathname = DEFAULT_WORKSPACE_ROOT / "docs" / "prd.json"
|
||||
output_pathname.mkdir(parents=True, exist_ok=True)
|
||||
elif not Path(output_pathname).is_absolute():
|
||||
output_pathname = DEFAULT_WORKSPACE_ROOT / output_pathname
|
||||
output_pathname = Path(output_pathname)
|
||||
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))
|
||||
await save_json_to_markdown(content=new_prd.content, output_filename=output_pathname.with_suffix(".md"))
|
||||
if not output_pathname:
|
||||
output_pathname = DEFAULT_WORKSPACE_ROOT / "docs" / "prd.json"
|
||||
output_pathname.mkdir(parents=True, exist_ok=True)
|
||||
elif not Path(output_pathname).is_absolute():
|
||||
output_pathname = DEFAULT_WORKSPACE_ROOT / output_pathname
|
||||
output_pathname = Path(output_pathname)
|
||||
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))
|
||||
md_output_filename = output_pathname.with_suffix(".md")
|
||||
await save_json_to_markdown(content=new_prd.content, output_filename=md_output_filename)
|
||||
await reporter.async_report(md_output_filename, "path")
|
||||
return f'PRD filename: "{str(output_pathname)}"'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue