This commit is contained in:
yzlin 2024-03-30 21:35:15 +08:00
parent 61dd80d12f
commit 95dc1eebf2
2 changed files with 7 additions and 2 deletions

View file

@ -38,7 +38,7 @@ def log_llm_stream(msg):
def log_tool_output(output: dict, tool_name: str = ""):
"""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)
_tool_output_log(output, tool_name)
def set_llm_stream_logfunc(func):

View file

@ -45,7 +45,7 @@ from metagpt.const import (
SYSTEM_DESIGN_FILE_REPO,
TASK_FILE_REPO,
)
from metagpt.logs import logger
from metagpt.logs import log_tool_output, logger
from metagpt.repo_parser import DotClassInfo
from metagpt.utils.common import any_to_str, any_to_str_set, import_class
from metagpt.utils.exceptions import handle_exception
@ -433,6 +433,11 @@ class Plan(BaseModel):
final_tasks = self.tasks[:prefix_length] + new_tasks[prefix_length:]
self.tasks = final_tasks
log_tool_output(
{"output": "\n\n".join([f"Task {task.task_id}: {task.instruction}" for task in self.tasks])},
tool_name="Plan",
)
# Update current_task_id to the first unfinished task in the merged list
self._update_current_task()