Documentation
¶
Overview ¶
Package memory persists AI conversations and assembles context windows.
Index ¶
- Constants
- func CanAutoTitle(c models.AIConversation) bool
- 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) 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) RefreshSummary(ctx context.Context, convID string) 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)
- func (s *Store) SetProvider(ctx context.Context, convID, providerID, model string)
Constants ¶
const DefaultTitle = "New conversation"
DefaultTitle is shown until the first successful automatic or manual title.
Variables ¶
This section is empty.
Functions ¶
func CanAutoTitle ¶ added in v0.1.1
func CanAutoTitle(c models.AIConversation) bool
CanAutoTitle reports whether the conversation still owns the initial title slot.
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
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 ¶
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) 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.
func (*Store) RefreshSummary ¶ added in v0.1.1
RefreshSummary folds newly aged-out messages into the persisted Summary, advancing the watermark so each message is compacted exactly once.
func (*Store) Rename ¶
func (s *Store) Rename(ctx context.Context, ownerID, id, title string) (models.AIConversation, error)
Rename sets a user-provided title.
func (*Store) SetAutoTitle ¶
SetAutoTitle sets a system-generated title, leaving a user-set title untouched.