refactor: rename is_recipient

This commit is contained in:
莘权 马 2023-11-08 13:42:08 +08:00
parent 93ebe8c103
commit af4c87e123
8 changed files with 19 additions and 19 deletions

View file

@ -233,7 +233,7 @@ class Engineer(Role):
# Parse task lists
message_filter = {WriteTasks}
for message in self._rc.news:
if not message.is_recipient(message_filter):
if not message.contain_any(message_filter):
continue
self.todos = self.parse_tasks(message)

View file

@ -154,7 +154,7 @@ class QaEngineer(Role):
async def _observe(self) -> int:
await super()._observe()
self._rc.news = [
msg for msg in self._rc.news if msg.is_recipient({self.profile})
msg for msg in self._rc.news if msg.contain_any({self.profile})
] # only relevant msgs count as observed news
return len(self._rc.news)
@ -174,13 +174,13 @@ class QaEngineer(Role):
for msg in self._rc.news:
# Decide what to do based on observed msg type, currently defined by human,
# might potentially be moved to _think, that is, let the agent decides for itself
if msg.is_recipient(code_filters):
if msg.contain_any(code_filters):
# engineer wrote a code, time to write a test for it
await self._write_test(msg)
elif msg.is_recipient(test_filters):
elif msg.contain_any(test_filters):
# I wrote or debugged my test code, time to run it
await self._run_code(msg)
elif msg.is_recipient(run_filters):
elif msg.contain_any(run_filters):
# I ran my test code, time to fix bugs, if any
await self._debug_error(msg)
self.test_round += 1