Skip to content

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

feat: fix memory.add

莘权 马9745dd12f6bd
diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py
index dbf800c03..62c8b7708 100644
--- a/metagpt/roles/role.py
+++ b/metagpt/roles/role.py
@@ -226,9 +226,9 @@ class Role:
# Read unprocessed messages from the msg buffer.
news = self._rc.msg_buffer.pop_all()
# Store the read messages in your own memory to prevent duplicate processing.
+ old_messages = self._rc.memory.get()
self._rc.memory.add_batch(news)
# Filter out messages of interest.
- old_messages = self._rc.memory.get()
self._rc.news = [n for n in news if n.cause_by in self._rc.watch and n not in old_messages]
# Design Rules: