diff --git a/metagpt/roles/product_manager.py b/metagpt/roles/product_manager.py index bc6771829..966115c0f 100644 --- a/metagpt/roles/product_manager.py +++ b/metagpt/roles/product_manager.py @@ -50,3 +50,6 @@ class ProductManager(Role): else: self._set_state(0) return self._rc.todo + + async def _observe(self, ignore_memory=False) -> int: + return await super(ProductManager, self)._observe(ignore_memory=True) diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index 1c9da7e6c..fe121ed1a 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -218,12 +218,12 @@ class Role: return msg - async def _observe(self) -> int: + async def _observe(self, ignore_memory=False) -> int: """Prepare new messages for processing from the message buffer and other sources.""" # 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() + old_messages = [] if ignore_memory else self._rc.memory.get() self._rc.memory.add_batch(news) # Filter out messages of interest. self._rc.news = [n for n in news if n.cause_by in self._rc.watch and n not in old_messages]