config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigPaths

func ConfigPaths() []string

ConfigPaths returns the paths to the configuration files.

func Dir

func Dir() string

CfgDir returns the configuration directory for gencmd.

func InitConfig

func InitConfig() ([]string, error)

InitConfig initializes the configuration for gencmd on a new system.

func SaveProviderEnv

func SaveProviderEnv(name string, env map[string]string) error

SaveProviderEnv saves the environment variables for the LLM provider to the .env file.

Types

type Config

type Config struct {
	LLM LLMConfig `yaml:"llm"`
	// contains filtered or unexported fields
}

Config represents the configuration structure for the application.

func Default

func Default() Config

Default returns a default configuration with sensible defaults.

func DefaultFromEnv

func DefaultFromEnv() Config

DefaultFromEnv returns a default configuration based on environment variables.

func Load

func Load() (Config, error)

Load reads the configuration from the default path "config.yaml" in the user's XDG data directory.

func LoadFrom

func LoadFrom(path string) (Config, error)

LoadFrom reads the configuration from the specified YAML file path.

func (Config) String added in v0.3.0

func (c Config) String() string

type LLMConfig

type LLMConfig struct {
	// Provider is the name of the LLM provider.
	Provider string `yaml:"provider,omitempty"`
	// ModelName is the name of the model to use, without prefixes (e.g. gemini-2.0-flash-lite).
	ModelName string `yaml:"modelName,omitempty"`
	// PromptTemplate is the template for the prompt to send to the LLM. The user input will be inserted into the {{.UserInput}} placeholder.
	PromptTemplate string `yaml:"promptTemplate,omitempty"`
	// OpenAI represents the configuration for OpenAI LLMs.
	OpenAI *OpenAIConfig `yaml:"openai,omitempty"`
}

LLMConfig represents the configuration for the Language Model.

type OpenAIConfig added in v0.3.0

type OpenAIConfig struct {
	BaseURL string `yaml:"baseUrl,omitempty"`
}

OpenAIConfig represents the configuration for OpenAI LLMs.

type ProviderDoc

type ProviderDoc struct {
	ID      string
	Name    string
	URL     string
	Options []ProviderOption
	// Fixed environment variables for the provider
	FixedEnv map[string]string
}

func ProvidersInitOptions

func ProvidersInitOptions() []ProviderDoc

ProvidersInitOptions returns the initialization options for each provider.

type ProviderOption

type ProviderOption struct {
	Name        string
	EnvVar      string
	Description string
}