️ perf(ai-chat): 优化会话持久化序列化方式

- 序列化方式:AISaveSession 从 MarshalIndent 改为 Marshal
- 存储优化:移除不必要的缩进格式化,减少磁盘占用
- 性能提升:紧凑 JSON 序列化速度更快,减少内存分配
This commit is contained in:
Syngnat
2026-04-08 10:30:51 +08:00
parent 5746796bc2
commit 7c6391af3d

View File

@@ -1122,7 +1122,7 @@ func (s *Service) AISaveSession(sessionID string, title string, updatedAt float6
Messages: json.RawMessage(messagesJSON),
}
data, err := json.MarshalIndent(sfd, "", " ")
data, err := json.Marshal(sfd)
if err != nil {
return fmt.Errorf("序列化会话数据失败: %w", err)
}