refactor: Minor improvements to BackendConfigLoader (#2353)

some minor renames and refactorings within BackendConfigLoader - make things more consistent, remove underused code, rename things for clarity

Signed-off-by: Dave Lee <dave@gray101.com>
This commit is contained in:
Dave 2024-05-23 16:48:12 -04:00 committed by GitHub
parent 114f549f5e
commit 0b637465d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 117 additions and 116 deletions

View file

@ -360,8 +360,14 @@ func (cfg *BackendConfig) SetDefaults(opts ...ConfigLoaderOption) {
}
func (c *BackendConfig) Validate() bool {
downloadedFileNames := []string{}
for _, f := range c.DownloadFiles {
downloadedFileNames = append(downloadedFileNames, f.Filename)
}
validationTargets := []string{c.Backend, c.Model, c.MMProj}
validationTargets = append(validationTargets, downloadedFileNames...)
// Simple validation to make sure the model can be correctly loaded
for _, n := range []string{c.Backend, c.Model, c.MMProj} {
for _, n := range validationTargets {
if n == "" {
continue
}