mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
feat: fix memory.add
This commit is contained in:
parent
3e8bba70bc
commit
b794e5d73d
3 changed files with 5 additions and 4 deletions
|
|
@ -168,7 +168,7 @@ class Engineer(Role):
|
|||
content=MSG_SEP.join(code_msg_all),
|
||||
role=self.profile,
|
||||
cause_by=self._rc.todo,
|
||||
send_to="Edward",
|
||||
send_to="Edward", # name of QaEngineer
|
||||
)
|
||||
return msg
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ class Engineer(Role):
|
|||
content=MSG_SEP.join(code_msg_all),
|
||||
role=self.profile,
|
||||
cause_by=self._rc.todo,
|
||||
send_to="Edward",
|
||||
send_to="Edward", # name of QaEngineer
|
||||
)
|
||||
return msg
|
||||
|
||||
|
|
|
|||
|
|
@ -217,6 +217,7 @@ class Role:
|
|||
)
|
||||
else:
|
||||
msg = Message(content=response, role=self.profile, cause_by=self._rc.todo)
|
||||
self._rc.memory.add(msg)
|
||||
|
||||
return msg
|
||||
|
||||
|
|
@ -227,7 +228,8 @@ class Role:
|
|||
# Store the read messages in your own memory to prevent duplicate processing.
|
||||
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]
|
||||
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:
|
||||
# If you need to further categorize Message objects, you can do so using the Message.set_meta function.
|
||||
|
|
|
|||
|
|
@ -74,5 +74,4 @@ class SkAgent(Role):
|
|||
|
||||
msg = Message(content=result, role=self.profile, cause_by=self._rc.todo)
|
||||
self._rc.memory.add(msg)
|
||||
self.publish_message(msg)
|
||||
return msg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue