🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
add try_except for _plan_and_act in data_interpreter.
刘棒棒5255be144ec6
diff --git a/metagpt/roles/di/data_interpreter.py b/metagpt/roles/di/data_interpreter.pyindex a8534b710..44a85fe06 100644--- a/metagpt/roles/di/data_interpreter.py+++ b/metagpt/roles/di/data_interpreter.py@@ -86,9 +86,13 @@ class DataInterpreter(Role):return Message(content=code, role="assistant", cause_by=WriteAnalysisCode)async def _plan_and_act(self) -> Message:- rsp = await super()._plan_and_act()- await self.execute_code.terminate()- return rsp+ try:+ rsp = await super()._plan_and_act()+ await self.execute_code.terminate()+ return rsp+ except Exception as e:+ await self.execute_code.terminate()+ raise easync def _act_on_task(self, current_task: Task) -> TaskResult:"""Useful in 'plan_and_act' mode. Wrap the output in a TaskResult for review and confirmation."""