...
This commit is contained in:
parent
844217bcf1
commit
889c5b1a75
@ -222,6 +222,7 @@ func (nopSeeker) Seek(int64, int) (int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseNameFill(name, fill string) model.Name {
|
func parseNameFill(name, fill string) model.Name {
|
||||||
|
fill = cmp.Or(fill, "bllamo.com/library/_:latest")
|
||||||
f := model.ParseNameBare(fill)
|
f := model.ParseNameBare(fill)
|
||||||
if !f.IsFullyQualified() {
|
if !f.IsFullyQualified() {
|
||||||
panic(fmt.Errorf("invalid fill: %q", fill))
|
panic(fmt.Errorf("invalid fill: %q", fill))
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cmp"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
@ -26,6 +27,7 @@ import (
|
|||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
|
|
||||||
"github.com/ollama/ollama/api"
|
"github.com/ollama/ollama/api"
|
||||||
|
"github.com/ollama/ollama/client/ollama"
|
||||||
"github.com/ollama/ollama/client/registry"
|
"github.com/ollama/ollama/client/registry"
|
||||||
"github.com/ollama/ollama/gpu"
|
"github.com/ollama/ollama/gpu"
|
||||||
"github.com/ollama/ollama/llm"
|
"github.com/ollama/ollama/llm"
|
||||||
@ -35,11 +37,20 @@ import (
|
|||||||
"github.com/ollama/ollama/version"
|
"github.com/ollama/ollama/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// envs
|
||||||
|
var (
|
||||||
|
envRegistryBaseURL = cmp.Or(os.Getenv("OLLAMA_REGISTRY_BASE_URL"), "https://bllamo.com")
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
ollama.I_Acknowledge_This_API_Is_Unstable = true
|
||||||
|
}
|
||||||
|
|
||||||
var experiments = sync.OnceValue(func() []string {
|
var experiments = sync.OnceValue(func() []string {
|
||||||
return strings.Split(os.Getenv("OLLAMA_EXPERIMENT"), ",")
|
return strings.Split(strings.ToLower(os.Getenv("OLLAMA_EXPERIMENT")), ",")
|
||||||
})
|
})
|
||||||
|
|
||||||
func useExperiemntal(flag string) bool {
|
func useExperiment(flag string) bool {
|
||||||
return slices.Contains(experiments(), flag)
|
return slices.Contains(experiments(), flag)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,9 +465,9 @@ func (s *Server) PullModelHandler(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if useExperiemntal("pull") {
|
if useExperiment("pull") {
|
||||||
rc := ®istry.Client{
|
rc := ®istry.Client{
|
||||||
BaseURL: os.Getenv("OLLAMA_REGISTRY_BASE_URL"),
|
BaseURL: envRegistryBaseURL,
|
||||||
}
|
}
|
||||||
modelsDir, err := modelsDir()
|
modelsDir, err := modelsDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -464,6 +475,7 @@ func (s *Server) PullModelHandler(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
cache := &cache{dir: modelsDir}
|
cache := &cache{dir: modelsDir}
|
||||||
|
println("DIR: ", modelsDir)
|
||||||
// TODO(bmizerany): progress updates
|
// TODO(bmizerany): progress updates
|
||||||
if err := rc.Pull(c.Request.Context(), cache, model); err != nil {
|
if err := rc.Pull(c.Request.Context(), cache, model); err != nil {
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user