mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-05-22 11:15:42 +00:00
Merge c80a565124 into e911e5e03a
This commit is contained in:
commit
1663da16b9
1 changed files with 8 additions and 1 deletions
|
|
@ -115,11 +115,18 @@ class Message(Record):
|
|||
return output_text(self.output(), ai_label, human_label)
|
||||
|
||||
def to_dict(self):
|
||||
# Strip binary RawMessage content (e.g. base64 images) before disk serialization.
|
||||
# raw_content blobs are for single-session LLM use only — persist only the preview text.
|
||||
# Without this, chat.json bloats to MBs and reloaded chats re-send images on every LLM call.
|
||||
content = self.content
|
||||
if _is_raw_message(content):
|
||||
preview = content.get("preview", "") # type: ignore
|
||||
content = preview if preview else "<Image content — not persisted>"
|
||||
return {
|
||||
"_cls": "Message",
|
||||
"id": self.id,
|
||||
"ai": self.ai,
|
||||
"content": self.content,
|
||||
"content": content,
|
||||
"summary": self.summary,
|
||||
"tokens": self.tokens,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue