fix: no attachment broadcast fix

This commit is contained in:
Krispire Admin
2026-08-29 18:56:33 +05:30
parent f65f552c87
commit 9c458ba19f
+8
View File
@@ -1118,6 +1118,14 @@ func (s *ChatService) systemMessage(ctx context.Context, conversationID, body st
return
}
if created {
// Publish the hydrated message. Append leaves Attachments nil, which
// serialises to null and breaks clients that trust the "always an
// array" contract this field's own doc comment promises.
if full, hErr := s.withAttachments(ctx, "", msg); hErr == nil {
msg = full
} else if msg.Attachments == nil {
msg.Attachments = []model.Attachment{}
}
s.publish(ctx, conversationID, "", msg)
}
}