From dfa33fcdaade1e4f8019835bf065d372d76724ae Mon Sep 17 00:00:00 2001 From: lixiangtiandashen <39831228+lixiangtiandashen@users.noreply.github.com> Date: Thu, 22 Feb 2024 04:31:24 +0800 Subject: [PATCH] Update role.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由于提示词里要求llm选择的状态码是 0 到 状态数-1,所以我认为这里往states里添加动作对应状态时,也应当从0开始。 --- metagpt/roles/role.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index 3938664ba..893c5cafd 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -281,7 +281,7 @@ class Role(SerializationMixin, ContextMixin, BaseModel): i = action self._init_action(i) self.actions.append(i) - self.states.append(f"{len(self.actions)}. {action}") + self.states.append(f"{len(self.actions) - 1}. {action}") def _set_react_mode(self, react_mode: str, max_react_loop: int = 1, auto_run: bool = True, use_tools: bool = False): """Set strategy of the Role reacting to observed Message. Variation lies in how