Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

refactor: Update according to Chapter 2.1.3.2 of RFC 116

莘权 马c9f9c5c73e43
diff --git a/metagpt/memory/longterm_memory.py b/metagpt/memory/longterm_memory.py
index 2a4b604e0..6e23a79ae 100644
--- a/metagpt/memory/longterm_memory.py
+++ b/metagpt/memory/longterm_memory.py
@@ -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]:
"""