mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-11 15:15:18 +02:00
modify log interface
This commit is contained in:
parent
53240b91f2
commit
c6a791cd32
2 changed files with 3 additions and 3 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -43,14 +43,14 @@ class Terminal:
|
|||
f'echo "{self.end_marker}"' + self.command_terminator
|
||||
) # Unique marker to signal command end
|
||||
self.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 found
|
||||
while 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-time
|
||||
cmd_output.append(line)
|
||||
|
||||
return "".join(cmd_output)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue