refactor: get_by_action(s)

This commit is contained in:
莘权 马 2023-11-10 16:15:07 +08:00
parent 83a5e03b72
commit a61f3f80e9
4 changed files with 16 additions and 20 deletions

View file

@ -15,7 +15,6 @@ from metagpt.logs import logger
from metagpt.roles import Role
from metagpt.schema import Message
from metagpt.software_company import SoftwareCompany
from metagpt.utils.common import any_to_str_set
class ShoutOut(Action):
@ -66,7 +65,7 @@ class Trump(Role):
async def _act(self) -> Message:
logger.info(f"{self._setting}: ready to {self._rc.todo}")
msg_history = self._rc.memory.get_by_actions(any_to_str_set([ShoutOut]))
msg_history = self._rc.memory.get_by_actions([ShoutOut])
context = []
for m in msg_history:
context.append(str(m))
@ -108,7 +107,7 @@ class Biden(Role):
async def _act(self) -> Message:
logger.info(f"{self._setting}: ready to {self._rc.todo}")
msg_history = self._rc.memory.get_by_actions(any_to_str_set([BossRequirement, ShoutOut]))
msg_history = self._rc.memory.get_by_actions([BossRequirement, ShoutOut])
context = []
for m in msg_history:
context.append(str(m))