initial commit

This commit is contained in:
2025-12-31 15:33:16 -05:00
commit 4641e7d0ef
51 changed files with 4779 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
package api
import (
"reichard.io/aethera/internal/store"
"reichard.io/aethera/pkg/slices"
)
func toChat(c *store.Chat) *Chat {
chat := &Chat{
ID: c.ID,
CreatedAt: c.CreatedAt,
Title: c.Title,
MessageCount: len(c.Messages),
Messages: c.Messages,
}
if firstMessage, found := slices.First(c.Messages); found {
chat.InitialMessage = firstMessage.Content
}
return chat
}
func toChatNoMessages(c *store.Chat) *Chat {
chat := toChat(c)
chat.Messages = []*store.Message{}
return chat
}