From ee77d4b0fb2ce865b59de2a6095d01c9ab695f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Sun, 27 Aug 2023 10:41:34 +0800 Subject: [PATCH] feat: +exported function --- metagpt/roles/role.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index 47f494c69..286c87eb1 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -328,9 +328,16 @@ class Role: self._rc.todo = act async def think(self) -> bool: - return await self._think() + """The exported `think` function""" + has_action = await self._think() + if not has_action: + return False + if not self._rc.todo: + return False + return True async def act(self) -> ActionOutput: + """The exported `act` function""" msg = await self._act() return ActionOutput(content=msg.content, instruct_content=msg.instruct_content)