Documentation
¶
Overview ¶
Package memory persists AI conversations and assembles context windows.
Index ¶
- Constants
- func TitleFrom(msg string) string
- type MessagePage
- type Store
- func (s *Store) AppendAssistant(ctx context.Context, convID, content, reasoning string, ...) error
- func (s *Store) AppendUser(ctx context.Context, convID, content string) error
- func (s *Store) Create(ctx context.Context, ownerID, connID, providerID, model string) (models.AIConversation, error)
- func (s *Store) Delete(ctx context.Context, ownerID, id string) error
- func (s *Store) Get(ctx context.Context, ownerID, id string) (models.AIConversation, error)
- func (s *Store) History(ctx context.Context, convID string, tokenBudget int) (summary string, msgs []engine.Message, err error)
- func (s *Store) List(ctx context.Context, ownerID, connID string) ([]models.AIConversation, error)
- func (s *Store) MessageCount(ctx context.Context, convID string) int
- func (s *Store) Messages(ctx context.Context, ownerID, id string) ([]models.AIMessage, error)
- func (s *Store) MessagesPage(ctx context.Context, ownerID, convID string, limit, loadedCount int) (MessagePage, error)
- func (s *Store) Rename(ctx context.Context, ownerID, id, title string) (models.AIConversation, error)
- func (s *Store) SetAutoTitle(ctx context.Context, convID, title string)
Constants ¶
const DefaultTitle = "New conversation"
DefaultTitle marks an untitled conversation; auto-titling only replaces it.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MessagePage ¶
type MessagePage struct {
Messages []models.AIMessage `json:"messages"`
LoadedCount int `json:"loadedCount"`
TotalCount int `json:"totalCount"`
HasMore bool `json:"hasMore"`
}
MessagePage is one UI window of conversation messages.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the conversation persistence and context-assembly surface.
func New ¶
func New(conv store.AIConversationStore, msg store.AIMessageStore) *Store
New wires the conversation and message repos.
func (*Store) AppendAssistant ¶
func (s *Store) AppendAssistant(ctx context.Context, convID, content, reasoning string, calls []models.AIToolCallRecord, truncated bool) error
AppendAssistant stores a finalized assistant message.
func (*Store) AppendUser ¶
AppendUser stores a user message.
func (*Store) Create ¶
func (s *Store) Create(ctx context.Context, ownerID, connID, providerID, model string) (models.AIConversation, error)
Create starts a new conversation owned by the user on a connection.
func (*Store) History ¶
func (s *Store) History(ctx context.Context, convID string, tokenBudget int) (summary string, msgs []engine.Message, err error)
History returns compacted older turns plus recent messages within tokenBudget.
func (*Store) MessageCount ¶
MessageCount returns how many messages a conversation has.
func (*Store) MessagesPage ¶
func (s *Store) MessagesPage(ctx context.Context, ownerID, convID string, limit, loadedCount int) (MessagePage, error)
MessagesPage returns one page of an owned conversation's history.