fix bug of ExecuteNbCode._init_code was never awaited

This commit is contained in:
lidanyang 2024-06-27 16:22:00 +08:00
parent a5b94af82f
commit f2cf8dd74b
2 changed files with 5 additions and 2 deletions

View file

@ -85,10 +85,12 @@ class ExecuteNbCode(Action):
)
self.reporter = NotebookReporter()
self.set_nb_client()
asyncio.run(self._init_code())
self._init_called = False
async def _init_code(self):
await self.run(INI_CODE)
if not self._init_called:
await self.run(INI_CODE)
self._init_called = True
def set_nb_client(self):
self.nb_client = RealtimeOutputNotebookClient(

View file

@ -40,6 +40,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()
# plan info
plan_status = self.planner.get_plan_status()