Documentation
¶
Index ¶
- func GetKey(profile string) (string, error)
- func GetOrReadKey(profile string) (string, error)
- func GetVersion(ctx context.Context) string
- func IsDebug(ctx context.Context) bool
- func LoadConfigFile(path string, config *ConfigFile, isGlobal bool) error
- func NewContext(config *Config) context.Context
- func ReadKey(profile string, force bool) (string, error)
- func ReadKeyAndUpdate(profile string, force bool) (string, error)
- type App
- type ClientRef
- type Config
- type ConfigFile
- type ConfigFileProfile
- type ConfigFileProfileContext
- type ConfigFilePrompt
- type ConfigService
- type ConfigSource
- type ConfigValue
- type ContextKey
- type RequestCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOrReadKey ¶
func GetVersion ¶
func LoadConfigFile ¶
func LoadConfigFile(path string, config *ConfigFile, isGlobal bool) error
LoadConfigFile reads a YAML configuration file and updates combined config.
func NewContext ¶
Types ¶
type ClientRef ¶
type ClientRef struct {
Config *ConfigService
Client *openai.Client
}
func NewClientRef ¶
func NewClientRef(config *ConfigService) *ClientRef
type Config ¶
type Config struct {
Dir string
Debug bool
Version bool
Services []*ConfigService
}
func LoadConfig ¶
LoadConfig reads configuration from flags, environment variables, and config files.
type ConfigFile ¶
type ConfigFile struct {
Default *string `yaml:"default"`
Profiles map[string]*ConfigFileProfile `yaml:"profiles"`
}
type ConfigFileProfile ¶
type ConfigFileProfile struct {
Context ConfigFileProfileContext `yaml:"-"`
Preset *string `yaml:"preset"`
BaseURL string `yaml:"baseurl"`
Key string `yaml:"key"`
Model string `yaml:"model"`
Prompt *ConfigFilePrompt `yaml:"prompt"`
Retries int `yaml:"retries"`
Concurrency int `yaml:"concurrency"`
CompactionToks int `yaml:"compactionToks"`
}
type ConfigFilePrompt ¶
type ConfigService ¶
type ConfigSource ¶
type ConfigSource int
const ( CfNone ConfigSource = iota CfConfigFile CfKeyChain CfEnvironment )
type ConfigValue ¶
type ConfigValue[V any] struct { Value V Source ConfigSource }
type ContextKey ¶
type ContextKey string
const ( CtxApp ContextKey = "app" CtxVersion ContextKey = "version" )
type RequestCallback ¶
Click to show internal directories.
Click to hide internal directories.