store

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package store persists user-selected LLM providers and credentials.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeDefault

func ChangeDefault(Model types.LLMProvider) error

ChangeDefault updates the default LLM provider selection in the config.

Types

type Config

type Config struct {
	Default      types.LLMProvider   `json:"default"`
	LLMProviders []types.LLMProvider `json:"models"`
}

Config describes the on-disk structure for all saved LLM providers.

func ListSavedModels

func ListSavedModels() (*Config, error)

ListSavedModels loads all persisted LLM provider configurations.

type LLMProvider

type LLMProvider struct {
	LLM    types.LLMProvider `json:"model"`
	APIKey string            `json:"api_key"`
}

LLMProvider represents a single stored LLM provider and its credential.

type StoreMethods added in v1.3.35

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

func KeyringInit added in v1.3.35

func KeyringInit() (*StoreMethods, error)

KeyringInit initializes a StoreMethods instance with both keyring and cache support. This function is kept for backward compatibility with main.go.

func NewStoreMethods added in v1.6.0

func NewStoreMethods() (*StoreMethods, error)

NewStoreMethods creates a new StoreMethods instance with cache support.

func (*StoreMethods) CleanupCache added in v1.6.0

func (s *StoreMethods) CleanupCache() error

CleanupCache removes old entries from the cache.

func (*StoreMethods) ClearCache added in v1.6.0

func (s *StoreMethods) ClearCache() error

ClearCache removes all entries from the cache.

func (*StoreMethods) DefaultLLMKey added in v1.3.35

func (s *StoreMethods) DefaultLLMKey() (*LLMProvider, error)

DefaultLLMKey returns the currently selected default LLM provider, if any.

func (*StoreMethods) DeleteModel added in v1.3.35

func (s *StoreMethods) DeleteModel(Model types.LLMProvider) error

DeleteModel removes the specified provider from the saved configuration.

func (*StoreMethods) GetCacheManager added in v1.6.0

func (s *StoreMethods) GetCacheManager() *cache.CacheManager

GetCacheManager returns the cache manager instance.

func (*StoreMethods) GetCacheStats added in v1.6.0

func (s *StoreMethods) GetCacheStats() *types.CacheStats

GetCacheStats returns cache statistics.

func (*StoreMethods) GetCachedMessage added in v1.6.0

func (s *StoreMethods) GetCachedMessage(provider types.LLMProvider, diff string, opts *types.GenerationOptions) (*types.CacheEntry, bool)

GetCachedMessage retrieves a cached commit message if it exists.

func (*StoreMethods) Save added in v1.3.35

func (s *StoreMethods) Save(LLMConfig LLMProvider) error

Save persists or updates an LLM provider entry, marking it as the default.

func (*StoreMethods) SetCachedMessage added in v1.6.0

func (s *StoreMethods) SetCachedMessage(provider types.LLMProvider, diff string, opts *types.GenerationOptions, message string, cost float64, tokens *types.UsageInfo) error

SetCachedMessage stores a commit message in the cache.

func (*StoreMethods) UpdateAPIKey added in v1.3.35

func (s *StoreMethods) UpdateAPIKey(Model types.LLMProvider, APIKey string) error

UpdateAPIKey rotates the credential for an existing provider entry.

Jump to

Keyboard shortcuts

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