mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-28 10:26:32 +02:00
fixbug: brain memory serialize
This commit is contained in:
parent
903e89cec3
commit
3e9151e52e
4 changed files with 90 additions and 16 deletions
|
|
@ -70,6 +70,22 @@ class Message:
|
|||
def is_contain(self, tag):
|
||||
return self.is_contain_tags([tag])
|
||||
|
||||
def dict(self):
|
||||
"""pydantic-like `dict` function"""
|
||||
full = {
|
||||
"instruct_content": self.instruct_content,
|
||||
"cause_by": self.cause_by,
|
||||
"sent_from": self.sent_from,
|
||||
"send_to": self.send_to,
|
||||
"tags": self.tags
|
||||
}
|
||||
|
||||
m = {"content": self.content}
|
||||
for k, v in full.items():
|
||||
if v:
|
||||
m[k] = v
|
||||
return m
|
||||
|
||||
|
||||
@dataclass
|
||||
class UserMessage(Message):
|
||||
|
|
@ -101,7 +117,6 @@ class AIMessage(Message):
|
|||
super().__init__(content, 'assistant')
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_content = 'test_message'
|
||||
msgs = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue