diff --git a/metagpt/actions/di/execute_nb_code.py b/metagpt/actions/di/execute_nb_code.py index 873c11106..e78c5acf3 100644 --- a/metagpt/actions/di/execute_nb_code.py +++ b/metagpt/actions/di/execute_nb_code.py @@ -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) diff --git a/metagpt/roles/di/mgx.py b/metagpt/roles/di/mgx.py index 9d2f182e3..8e9a0dfae 100644 --- a/metagpt/roles/di/mgx.py +++ b/metagpt/roles/di/mgx.py @@ -33,6 +33,7 @@ class MGX(DataInterpreter): if self.use_intent: # add mode user_message = Message(content=goal, role="user") goal = await self._detect_intent(user_message) + logger.info(f"Goal is {goal}") await self.planner.update_plan(goal=goal) diff --git a/metagpt/tools/libs/software_development.py b/metagpt/tools/libs/software_development.py index d06469b9a..291fc78d9 100644 --- a/metagpt/tools/libs/software_development.py +++ b/metagpt/tools/libs/software_development.py @@ -49,6 +49,7 @@ async def write_prd(idea: str, project_path: Optional[str | Path] = None) -> Pat if project_path and Path(project_path).exists(): ctx.config.project_path = Path(project_path) ctx.config.inc = True + role = ProductManager(context=ctx) msg = await role.run(with_message=Message(content=idea, cause_by=UserRequirement)) await role.run(with_message=msg)