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

@ -1,12 +1,10 @@
package config_test
package config
import (
"io"
"net/http"
"os"
. "github.com/go-skynet/LocalAI/core/config"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
@ -22,7 +20,7 @@ var _ = Describe("Test cases for config related functions", func() {
parameters:
model: "foo-bar"`)
Expect(err).ToNot(HaveOccurred())
config, err := ReadBackendConfig(tmp.Name())
config, err := readBackendConfigFromFile(tmp.Name())
Expect(err).To(BeNil())
Expect(config).ToNot(BeNil())
Expect(config.Validate()).To(BeFalse())
@ -37,7 +35,7 @@ backend: "foo-bar"
parameters:
model: "foo-bar"`)
Expect(err).ToNot(HaveOccurred())
config, err := ReadBackendConfig(tmp.Name())
config, err := readBackendConfigFromFile(tmp.Name())
Expect(err).To(BeNil())
Expect(config).ToNot(BeNil())
// two configs in config.yaml
@ -54,7 +52,7 @@ parameters:
defer os.Remove(tmp.Name())
_, err = io.Copy(tmp, resp.Body)
Expect(err).To(BeNil())
config, err = ReadBackendConfig(tmp.Name())
config, err = readBackendConfigFromFile(tmp.Name())
Expect(err).To(BeNil())
Expect(config).ToNot(BeNil())
// two configs in config.yaml