2023-06-24 06:18:17 +00:00
|
|
|
package gallery_test
|
2023-05-20 07:06:30 +00:00
|
|
|
|
|
|
|
import (
|
2023-06-24 06:18:17 +00:00
|
|
|
. "github.com/go-skynet/LocalAI/pkg/gallery"
|
2023-05-20 07:06:30 +00:00
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
)
|
|
|
|
|
2023-06-24 06:18:17 +00:00
|
|
|
type example struct {
|
|
|
|
Name string `yaml:"name"`
|
|
|
|
}
|
|
|
|
|
2023-05-20 07:06:30 +00:00
|
|
|
var _ = Describe("Gallery API tests", func() {
|
2023-06-24 06:18:17 +00:00
|
|
|
|
2023-05-20 07:06:30 +00:00
|
|
|
Context("requests", func() {
|
|
|
|
It("parses github with a branch", func() {
|
2023-06-24 06:18:17 +00:00
|
|
|
req := GalleryModel{URL: "github:go-skynet/model-gallery/gpt4all-j.yaml@main"}
|
|
|
|
var e example
|
|
|
|
err := req.Get(&e)
|
|
|
|
Expect(err).ToNot(HaveOccurred())
|
|
|
|
Expect(e.Name).To(Equal("gpt4all-j"))
|
|
|
|
})
|
|
|
|
It("parses github without a branch", func() {
|
|
|
|
req := GalleryModel{URL: "github:go-skynet/model-gallery/gpt4all-j.yaml@main"}
|
2023-05-20 07:06:30 +00:00
|
|
|
str, err := req.DecodeURL()
|
|
|
|
Expect(err).ToNot(HaveOccurred())
|
|
|
|
Expect(str).To(Equal("https://raw.githubusercontent.com/go-skynet/model-gallery/main/gpt4all-j.yaml"))
|
|
|
|
})
|
|
|
|
It("parses github without a branch", func() {
|
2023-06-24 06:18:17 +00:00
|
|
|
req := GalleryModel{URL: "github:go-skynet/model-gallery/gpt4all-j.yaml"}
|
2023-05-20 07:06:30 +00:00
|
|
|
str, err := req.DecodeURL()
|
|
|
|
Expect(err).ToNot(HaveOccurred())
|
|
|
|
Expect(str).To(Equal("https://raw.githubusercontent.com/go-skynet/model-gallery/main/gpt4all-j.yaml"))
|
|
|
|
})
|
|
|
|
It("parses URLS", func() {
|
2023-06-24 06:18:17 +00:00
|
|
|
req := GalleryModel{URL: "https://raw.githubusercontent.com/go-skynet/model-gallery/main/gpt4all-j.yaml"}
|
2023-05-20 07:06:30 +00:00
|
|
|
str, err := req.DecodeURL()
|
|
|
|
Expect(err).ToNot(HaveOccurred())
|
|
|
|
Expect(str).To(Equal("https://raw.githubusercontent.com/go-skynet/model-gallery/main/gpt4all-j.yaml"))
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|