mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 10:35:01 +00:00
feat(oci): support OCI images and Ollama models (#2628)
* Support specifying oci:// and ollama:// for model URLs Fixes: https://github.com/mudler/LocalAI/issues/2527 Fixes: https://github.com/mudler/LocalAI/issues/1028 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Lower watcher warnings Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Allow to install ollama models from CLI Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fixup tests Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Do not keep file ownership Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Skip test on darwin Signed-off-by: Ettore Di Giacinto <mudler@localai.io> --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
e265a618d9
commit
f569237a50
19 changed files with 638 additions and 97 deletions
37
pkg/oci/image_test.go
Normal file
37
pkg/oci/image_test.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package oci_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
. "github.com/go-skynet/LocalAI/pkg/oci" // Update with your module path
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("OCI", func() {
|
||||
|
||||
Context("when template is loaded successfully", func() {
|
||||
It("should evaluate the template correctly", func() {
|
||||
if runtime.GOOS == "darwin" {
|
||||
Skip("Skipping test on darwin")
|
||||
}
|
||||
imageName := "alpine"
|
||||
img, err := GetImage(imageName, "", nil, nil)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
size, err := GetOCIImageSize(imageName, "", nil, nil)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(size).ToNot(Equal(int64(0)))
|
||||
|
||||
// Create tempdir
|
||||
dir, err := os.MkdirTemp("", "example")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
err = ExtractOCIImage(img, dir)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue