mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-24 14:15:17 +02:00
fixbug: The assumption that messages in 'memory' have been processed has been revoked.
This commit is contained in:
parent
6f3d1d6f5e
commit
269eee4643
2 changed files with 5 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue