X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/522d7fd117285e4e4ce3ea5ec9b5a1722521b681..9301f77a5709fe7daea3a71f8dd072c6cd7df4fe:/config.go?ds=inline diff --git a/config.go b/config.go index 3b5172d..d96a1a3 100644 --- a/config.go +++ b/config.go @@ -19,6 +19,19 @@ const ( configEndpointAPI = "api" ) +// Config holds the settings of config.json in the data directory. +type Config struct { + Endpoint string `json:"endpoint"` + Voice VoiceConfig `json:"voice"` + Compactor ModelConfig `json:"compactor"` +} + +// ModelConfig names a model and its reasoning effort. +type ModelConfig struct { + Model string `json:"model"` + Effort string `json:"effort"` +} + // loadConfig reads config.json in dir over the defaults. A missing file gives // the defaults. An unknown field is an error, so a typo does not become a // silent default. @@ -52,12 +65,6 @@ func loadConfig(dir string) (Config, error) { return config, nil } -// Config holds the settings of config.json in the data directory. -type Config struct { - Endpoint string `json:"endpoint"` - Compactor ModelConfig `json:"compactor"` -} - // validate makes sure that each setting has a valid value. func (c Config) validate() error { if c.Endpoint != configEndpointChatGPT && c.Endpoint != configEndpointAPI { @@ -71,14 +78,8 @@ func (c Config) validate() error { return nil } -// ModelConfig names a model and its reasoning effort. -type ModelConfig struct { - Model string `json:"model"` - Effort string `json:"effort"` -} - -// defaultConfig returns the settings that apply when config.json does not -// set them. +// defaultConfig returns the settings that apply when config.json does not set +// them. func defaultConfig() Config { return Config{ Endpoint: configEndpointChatGPT,