mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-26 01:06:27 +02:00
Merge pull request #1141 from orange-crow/add_try_except_for_plan_and_act
add try_except for _plan_and_act in data_interpreter.
This commit is contained in:
commit
ed53e1c8a0
1 changed files with 7 additions and 3 deletions
|
|
@ -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 e
|
||||
|
||||
async 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."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue