mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
fixbug: creation of separate indices for each label
This commit is contained in:
parent
532099a7c6
commit
8137e1af50
2 changed files with 9 additions and 2 deletions
|
|
@ -26,8 +26,10 @@ class Memory:
|
|||
if message in self.storage:
|
||||
return
|
||||
self.storage.append(message)
|
||||
if message.cause_by:
|
||||
self.index[message.cause_by].append(message)
|
||||
# According to the design of RFC 116, it allows message filtering based on different labels, thus
|
||||
# necessitating the creation of separate indices for each label.
|
||||
for k in message.tx_to:
|
||||
self.index[k].append(message)
|
||||
|
||||
def add_batch(self, messages: Iterable[Message]):
|
||||
for message in messages:
|
||||
|
|
|
|||
|
|
@ -64,6 +64,11 @@ async def test_react():
|
|||
assert role.is_idle
|
||||
env = Environment()
|
||||
env.add_role(role)
|
||||
env.publish_message(Message(content="test", tx_to=seed.subscription))
|
||||
assert not role.is_idle
|
||||
while not env.is_idle:
|
||||
await env.run()
|
||||
assert role.is_idle
|
||||
env.publish_message(Message(content="test", cause_by=seed.subscription))
|
||||
assert not role.is_idle
|
||||
while not env.is_idle:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue