mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-27 09:46:24 +02:00
bugfix: return last 500 outputs for !pip execution
This commit is contained in:
parent
780c68e43f
commit
4fc24ac98d
1 changed files with 3 additions and 0 deletions
|
|
@ -27,6 +27,8 @@ from metagpt.actions import Action
|
|||
from metagpt.const import DEFAULT_WORKSPACE_ROOT
|
||||
from metagpt.logs import ToolLogItem, log_tool_output, logger
|
||||
|
||||
INSTALL_KEEPLEN = 500
|
||||
|
||||
|
||||
class ExecuteNbCode(Action):
|
||||
"""execute notebook code block, return result to llm, and display it."""
|
||||
|
|
@ -207,6 +209,7 @@ class ExecuteNbCode(Action):
|
|||
|
||||
if "!pip" in code:
|
||||
success = False
|
||||
outputs = outputs[-INSTALL_KEEPLEN:]
|
||||
|
||||
file_path = DEFAULT_WORKSPACE_ROOT / "code.ipynb"
|
||||
nbformat.write(self.nb, file_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue