Documentation
¶
Overview ¶
Package store provides session persistence using SQLite.
Index ¶
- type ProviderConfig
- type Session
- type Store
- func (s *Store) Close() error
- func (s *Store) Create(config ProviderConfig) (*Session, error)
- func (s *Store) Delete(id string) error
- func (s *Store) Get(id string) (*Session, error)
- func (s *Store) GetStats() (totalSessions int, totalInputTokens int, totalOutputTokens int, err error)
- func (s *Store) List(limit int) ([]*Session, error)
- func (s *Store) SetTitle(id, title string) error
- func (s *Store) Update(session *Session) error
- func (s *Store) UpdateTokens(id string, inputTokens, outputTokens int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProviderConfig ¶
type ProviderConfig struct {
Provider string `json:"provider"`
Model string `json:"model"`
APIKey string `json:"api_key,omitempty"`
BaseURL string `json:"base_url,omitempty"`
}
ProviderConfig holds configuration for the LLM provider
type Session ¶
type Session struct {
ID string `json:"id"`
Title string `json:"title"`
Messages []provider.Message `json:"messages"`
Config ProviderConfig `json:"config"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// Token tracking
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
}
Session represents a chat session with message history
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides session persistence using SQLite
func New ¶
New creates a new Store with SQLite backend. If dbPath is empty, uses ~/.palm/sessions.db
func NewInMemory ¶
NewInMemory creates an in-memory store (useful for testing)
func (*Store) Create ¶
func (s *Store) Create(config ProviderConfig) (*Session, error)
Create creates a new session
func (*Store) GetStats ¶
func (s *Store) GetStats() (totalSessions int, totalInputTokens int, totalOutputTokens int, err error)
GetStats returns aggregate statistics
Click to show internal directories.
Click to hide internal directories.