Documentation
¶
Index ¶
- Constants
- Variables
- func CreateConfigDir() (string, error)
- func DefaultProfileDir() string
- type ConfigRepository
- type ConversationRepository
- func (r *ConversationRepository) ExportToFile(conversation *conversation.Conversation, filepath string) error
- func (r *ConversationRepository) LoadActive() (*conversation.Conversation, error)
- func (r *ConversationRepository) LoadFromFile(filepath string) (*conversation.Conversation, error)
- func (r *ConversationRepository) SaveAsActive(conversation *conversation.Conversation) error
- type ProfileRepository
Constants ¶
const ActiveConversationFileName = "active.json"
Variables ¶
var ErrConversationNotFound = errors.New("conversation not found")
var ErrNoActiveConversation = errors.New("no active conversation")
var ErrNoProfilesDir = fmt.Errorf("no profiles found. Please add profiles to the profiles folder.")
Functions ¶
func CreateConfigDir ¶
Uses two strategies to define the config directory: 1. If the system has a user config directory, it uses it and creates a gennie directory inside it 2. If the system does not have a user config directory, it uses the executable directory
func DefaultProfileDir ¶
func DefaultProfileDir() string
Uses the os.UserConfigDir to setup the default profiles directory
Types ¶
type ConfigRepository ¶
type ConfigRepository struct {
// contains filtered or unexported fields
}
func NewConfigRepository ¶
func NewConfigRepository(configDir string) *ConfigRepository
func (*ConfigRepository) ConfigFile ¶
func (cr *ConfigRepository) ConfigFile() string
Returns the full path to the config file
type ConversationRepository ¶
type ConversationRepository struct {
// contains filtered or unexported fields
}
func NewConversationRepository ¶
func NewConversationRepository(cacheDir string) *ConversationRepository
func (*ConversationRepository) ExportToFile ¶
func (r *ConversationRepository) ExportToFile(conversation *conversation.Conversation, filepath string) error
func (*ConversationRepository) LoadActive ¶
func (r *ConversationRepository) LoadActive() (*conversation.Conversation, error)
Loads the last conversation that has been active If there is no active conversation, creates a new one with the default profile and model
func (*ConversationRepository) LoadFromFile ¶
func (r *ConversationRepository) LoadFromFile(filepath string) (*conversation.Conversation, error)
func (*ConversationRepository) SaveAsActive ¶
func (r *ConversationRepository) SaveAsActive(conversation *conversation.Conversation) error
type ProfileRepository ¶
type ProfileRepository struct {
// contains filtered or unexported fields
}
func NewProfileRepository ¶
func NewProfileRepository(profilesDir string) *ProfileRepository
func (*ProfileRepository) FindBySlug ¶
func (pr *ProfileRepository) FindBySlug(slug string) (*profile.Profile, error)
Loads a profile from a toml file named as the slug. Ie: "test.profile.toml" for slug "test"
func (*ProfileRepository) ListAll ¶
func (pr *ProfileRepository) ListAll() (map[string]*profile.Profile, error)
Lists all profiles found in the profiles directory, plus a default profile created in the application If dir does not exist, returns the default profile only and the error ErrNoProfilesDir