From 0251e7ad20202011d77de8a443762bf91d108cef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Mon, 8 Apr 2024 14:58:50 +0800 Subject: [PATCH] feat: +tool log --- metagpt/tools/libs/software_development.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/metagpt/tools/libs/software_development.py b/metagpt/tools/libs/software_development.py index 04da431b7..c5b38e00a 100644 --- a/metagpt/tools/libs/software_development.py +++ b/metagpt/tools/libs/software_development.py @@ -51,13 +51,21 @@ async def write_prd(idea: str, project_path: Optional[str | Path] = None) -> Pat await role.run(with_message=msg) outputs = [ - ToolLogItem(name="PRD File", value=str(ctx.repo.docs.prd.workdir / i)) + ToolLogItem(name="Intermedia PRD File", value=str(ctx.repo.docs.prd.workdir / i)) for i in ctx.repo.docs.prd.changed_files.keys() ] - for i in ctx.repo.resources.competitive_analysis.changed_files.keys(): - outputs.append( + outputs.extend( + [ + ToolLogItem(name="PRD File", value=str(ctx.repo.resources.prd.workdir / i)) + for i in ctx.repo.resources.prd.changed_files.keys() + ] + ) + outputs.extend( + [ ToolLogItem(name="Competitive Analysis", value=str(ctx.repo.resources.competitive_analysis.workdir / i)) - ) + for i in ctx.repo.resources.competitive_analysis.changed_files.keys() + ] + ) log_tool_output(output=outputs, tool_name=write_prd.__name__) return ctx.repo.docs.prd.workdir @@ -327,9 +335,12 @@ async def git_archive(project_path: str | Path) -> str: ctx = Context() ctx.set_repo_dir(project_path) + files = " ".join(ctx.git_repo.changed_files.keys()) + outputs = [ToolLogItem(name="cmd", value=f"git add {files}")] + log_tool_output(output=outputs, tool_name=git_archive.__name__) ctx.git_repo.archive() - outputs = [ToolLogItem(name="Git Commit", value=str(ctx.repo.workdir))] + outputs = [ToolLogItem(name="cmd", value="git commit -m 'Archive'")] log_tool_output(output=outputs, tool_name=git_archive.__name__) return ctx.git_repo.log()