refactor: Update according to Chapter 2.1.3.2 of RFC 116

This commit is contained in:
莘权 马 2023-11-08 22:57:53 +08:00
parent 1ff99b95ac
commit c9f9c5c73e

View file

@ -40,10 +40,11 @@ class LongTermMemory(Memory):
def add(self, message: Message):
super(LongTermMemory, self).add(message)
if message.contain_any(self.rc.watch) and not self.msg_from_recover:
# currently, only add role's watching messages to its memory_storage
# and ignore adding messages from recover repeatedly
self.memory_storage.add(message)
for action in self.rc.watch:
if message.cause_by == action and not self.msg_from_recover:
# currently, only add role's watching messages to its memory_storage
# and ignore adding messages from recover repeatedly
self.memory_storage.add(message)
def find_news(self, observed: list[Message], k=0) -> list[Message]:
"""