memory

package
v1.0.0-alpha.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compactor

type Compactor struct {
	// contains filtered or unexported fields
}

func NewCompactor

func NewCompactor(cfg Config, logger *zap.Logger) *Compactor

func (*Compactor) Compact

func (c *Compactor) Compact(
	ctx context.Context, model fantasy.LanguageModel,
	store *Store, sessionID string,
) error

type Config

type Config struct {
	Strategy    string
	MaxMessages int
	MaxTokens   int
}

type SessionInfo

type SessionInfo struct {
	ID           string
	MessageCount int
	LastActive   int64
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(ctx context.Context, db *sql.DB) (*Store, error)

func (*Store) CountMessages

func (s *Store) CountMessages(ctx context.Context, sessionID string) (int, error)

func (*Store) DeleteSession

func (s *Store) DeleteSession(ctx context.Context, sessionID string) error

func (*Store) GetMessages

func (s *Store) GetMessages(ctx context.Context, sessionID string) ([]fantasy.Message, error)

func (*Store) ListSessions

func (s *Store) ListSessions(ctx context.Context) ([]SessionInfo, error)

func (*Store) ReplaceMessages

func (s *Store) ReplaceMessages(ctx context.Context, sessionID string, messages []fantasy.Message) error

func (*Store) SaveMessage

func (s *Store) SaveMessage(ctx context.Context, sessionID, role, content string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL