From dee1d6fe6066d2631af612a0e455e61f5bd60089 Mon Sep 17 00:00:00 2001 From: yzlin Date: Thu, 25 Apr 2024 16:06:27 +0800 Subject: [PATCH] modify Role._think --- metagpt/roles/role.py | 4 ++-- metagpt/strategy/thinking_command.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index e0f8a7ea6..b1773b739 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -455,8 +455,8 @@ class Role(SerializationMixin, ContextMixin, BaseModel): rsp = Message(content="No actions taken yet", cause_by=Action) # will be overwritten after Role _act while actions_taken < self.rc.max_react_loop: # think - await self._think() - if self.rc.todo is None: + has_todo = await self._think() + if not has_todo: break # act logger.debug(f"{self._setting}: {self.rc.state=}, will do {self.rc.todo}") diff --git a/metagpt/strategy/thinking_command.py b/metagpt/strategy/thinking_command.py index 19604ad39..7b48cae51 100644 --- a/metagpt/strategy/thinking_command.py +++ b/metagpt/strategy/thinking_command.py @@ -36,7 +36,7 @@ class Command(Enum): PUBLISH_MESSAGE = CommandDef( name="publish_message", signature="publish_message(content: str, send_to: str)", - desc="Publish a message to a team member, use member name to fill send_to args. You may copy the full original content or add additional information from upstream. This will make team members start their work. DONT omit any necessary info such as path, link, environment from original content to team members because you are their sole info source. However, if the original content is long or contains concrete info, you should forward the message using forward_message instead of publishing it.", + desc="Publish a message to a team member, use member name to fill send_to args. You may copy the full original content or add additional information from upstream. This will make team members start their work. DONT omit any necessary info such as path, link, environment from original content to team members because you are their sole info source.", ) REPLY_TO_HUMAN = CommandDef( name="reply_to_human",