Ensure the AiCompletionEndpoint field is always initialized

This commit is contained in:
David Dworken 2024-03-26 20:47:21 -07:00
parent b4e86f3010
commit 751a2f49ec
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View File

@ -232,9 +232,6 @@ func handleUpgradedFeatures() error {
// AI completion is not yet configured, disable it for upgrades since this is a new feature // AI completion is not yet configured, disable it for upgrades since this is a new feature
config.AiCompletion = false config.AiCompletion = false
} }
if config.AiCompletionEndpoint == "" {
config.AiCompletionEndpoint = "https://api.openai.com/v1/chat/completions"
}
return hctx.SetConfig(&config) return hctx.SetConfig(&config)
} }

View File

@ -274,6 +274,9 @@ func GetConfig() (ClientConfig, error) {
if config.ColorScheme.BorderColor == "" { if config.ColorScheme.BorderColor == "" {
config.ColorScheme.BorderColor = GetDefaultColorScheme().BorderColor config.ColorScheme.BorderColor = GetDefaultColorScheme().BorderColor
} }
if config.AiCompletionEndpoint == "" {
config.AiCompletionEndpoint = "https://api.openai.com/v1/chat/completions"
}
return config, nil return config, nil
} }