🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
modify log interface
yzlinc6a791cd32d1
diff --git a/metagpt/logs.py b/metagpt/logs.pyindex 4e5e90e3b..eb373614a 100644--- a/metagpt/logs.py+++ b/metagpt/logs.py@@ -36,7 +36,7 @@ def log_llm_stream(msg):_llm_stream_log(msg)-def log_tool_output(output: str, tool_name: str = "", tags: list[str] = None):+def log_tool_output(output: dict, tool_name: str = "", tags: list[str] = None):"""interface for logging tool output, can be set to log tool output in different ways to different places with set_tool_output_logfunc"""_tool_output_log(output)diff --git a/metagpt/tools/libs/terminal.py b/metagpt/tools/libs/terminal.pyindex b277db8dc..2b1657bdd 100644--- a/metagpt/tools/libs/terminal.py+++ b/metagpt/tools/libs/terminal.py@@ -43,14 +43,14 @@ class Terminal:f'echo "{self.end_marker}"' + self.command_terminator) # Unique marker to signal command endself.process.stdin.flush()- log_tool_output(output=cmd + self.command_terminator, tool_name="Terminal") # log the command+ log_tool_output(output={"cmd": cmd + self.command_terminator}, tool_name="Terminal") # log the command# Read the output until the unique marker is foundwhile True:line = self.process.stdout.readline()if line.strip() == self.end_marker:break- log_tool_output(output=line, tool_name="Terminal") # log stdout in real-time+ log_tool_output(output={"output": line}, tool_name="Terminal") # log stdout in real-timecmd_output.append(line)return "".join(cmd_output)