diff --git a/metagpt/actions/di/execute_nb_code.py b/metagpt/actions/di/execute_nb_code.py index 91480d3a7..f3dfd1601 100644 --- a/metagpt/actions/di/execute_nb_code.py +++ b/metagpt/actions/di/execute_nb_code.py @@ -85,12 +85,12 @@ class ExecuteNbCode(Action): ) self.reporter = NotebookReporter() self.set_nb_client() - self._init_called = False + self.init_called = False - async def _init_code(self): - if not self._init_called: + async def init_code(self): + if not self.init_called: await self.run(INI_CODE) - self._init_called = True + self.init_called = True def set_nb_client(self): self.nb_client = RealtimeOutputNotebookClient( diff --git a/metagpt/roles/di/data_analyst.py b/metagpt/roles/di/data_analyst.py index 5040385ea..2b1bb10b1 100644 --- a/metagpt/roles/di/data_analyst.py +++ b/metagpt/roles/di/data_analyst.py @@ -64,7 +64,7 @@ class DataAnalyst(RoleZero): """Write a code block for current task and execute it in an interactive notebook environment.""" counter = 0 success = False - await self.execute_code._init_code() + await self.execute_code.init_code() # plan info plan_status = self.planner.get_plan_status()