rebase main
This commit is contained in:
parent
bf5ba6065b
commit
8d62a65ca7
@ -606,7 +606,7 @@ curl http://localhost:11434/api/chat -d '{
|
||||
|
||||
```json
|
||||
{
|
||||
"model": "registry.ollama.ai/library/llama3:latest",
|
||||
"model": "ollama.com/library/llama3:latest",
|
||||
"created_at": "2023-12-12T14:13:43.416799Z",
|
||||
"message": {
|
||||
"role": "assistant",
|
||||
|
@ -1046,14 +1046,6 @@ func Serve(ln net.Listener) error {
|
||||
|
||||
slog.SetDefault(slog.New(handler))
|
||||
|
||||
blobsDir, err := GetBlobsPath("")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := fixBlobs(blobsDir); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !envconfig.NoPrune {
|
||||
// clean up unused layers and manifests
|
||||
if err := PruneLayers(); err != nil {
|
||||
@ -1070,12 +1062,23 @@ func Serve(ln net.Listener) error {
|
||||
}
|
||||
}
|
||||
|
||||
// MIGRATION
|
||||
blobsDir, err := GetBlobsPath("")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := fixBlobs(blobsDir); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// migrate registry.ollama.ai to ollama.com
|
||||
if err := migrateRegistryDomain(); err != nil {
|
||||
if !errors.Is(err, os.ErrNotExist) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// END MIGRATION
|
||||
|
||||
ctx, done := context.WithCancel(context.Background())
|
||||
schedCtx, schedDone := context.WithCancel(ctx)
|
||||
|
@ -35,7 +35,7 @@ func Unqualified(n Name) error {
|
||||
const MissingPart = "!MISSING!"
|
||||
|
||||
const (
|
||||
defaultHost = "registry.ollama.ai"
|
||||
defaultHost = "ollama.com"
|
||||
defaultNamespace = "library"
|
||||
defaultTag = "latest"
|
||||
)
|
||||
@ -43,7 +43,7 @@ const (
|
||||
// DefaultName returns a name with the default values for the host, namespace,
|
||||
// and tag parts. The model and digest parts are empty.
|
||||
//
|
||||
// - The default host is ("registry.ollama.ai")
|
||||
// - The default host is ("ollama.com")
|
||||
// - The default namespace is ("library")
|
||||
// - The default tag is ("latest")
|
||||
func DefaultName() Name {
|
||||
|
@ -20,14 +20,14 @@ func TestParseNameParts(t *testing.T) {
|
||||
wantValidDigest bool
|
||||
}{
|
||||
{
|
||||
in: "registry.ollama.ai/library/dolphin-mistral:7b-v2.6-dpo-laser-q6_K",
|
||||
in: "ollama.com/library/dolphin-mistral:7b-v2.6-dpo-laser-q6_K",
|
||||
want: Name{
|
||||
Host: "registry.ollama.ai",
|
||||
Host: "ollama.com",
|
||||
Namespace: "library",
|
||||
Model: "dolphin-mistral",
|
||||
Tag: "7b-v2.6-dpo-laser-q6_K",
|
||||
},
|
||||
wantFilepath: filepath.Join("registry.ollama.ai", "library", "dolphin-mistral", "7b-v2.6-dpo-laser-q6_K"),
|
||||
wantFilepath: filepath.Join("ollama.com", "library", "dolphin-mistral", "7b-v2.6-dpo-laser-q6_K"),
|
||||
},
|
||||
{
|
||||
in: "scheme://host:port/namespace/model:tag",
|
||||
@ -83,14 +83,14 @@ func TestParseNameParts(t *testing.T) {
|
||||
Namespace: "namespace",
|
||||
Model: "model",
|
||||
},
|
||||
wantFilepath: filepath.Join("registry.ollama.ai", "namespace", "model", "latest"),
|
||||
wantFilepath: filepath.Join("ollama.com", "namespace", "model", "latest"),
|
||||
},
|
||||
{
|
||||
in: "model",
|
||||
want: Name{
|
||||
Model: "model",
|
||||
},
|
||||
wantFilepath: filepath.Join("registry.ollama.ai", "library", "model", "latest"),
|
||||
wantFilepath: filepath.Join("ollama.com", "library", "model", "latest"),
|
||||
},
|
||||
{
|
||||
in: "h/nn/mm:t",
|
||||
@ -193,7 +193,7 @@ func TestNameparseNameDefault(t *testing.T) {
|
||||
const name = "xx"
|
||||
n := ParseName(name)
|
||||
got := n.String()
|
||||
want := "registry.ollama.ai/library/xx:latest"
|
||||
want := "ollama.com/library/xx:latest"
|
||||
if got != want {
|
||||
t.Errorf("parseName(%q).String() = %q; want %q", name, got, want)
|
||||
}
|
||||
@ -290,11 +290,11 @@ func TestParseNameFromFilepath(t *testing.T) {
|
||||
|
||||
func TestDisplayShortest(t *testing.T) {
|
||||
cases := map[string]string{
|
||||
"registry.ollama.ai/library/model:latest": "model:latest",
|
||||
"registry.ollama.ai/library/model:tag": "model:tag",
|
||||
"registry.ollama.ai/namespace/model:tag": "namespace/model:tag",
|
||||
"host/namespace/model:tag": "host/namespace/model:tag",
|
||||
"host/library/model:tag": "host/library/model:tag",
|
||||
"ollama.com/library/model:latest": "model:latest",
|
||||
"ollama.com/library/model:tag": "model:tag",
|
||||
"ollama.com/namespace/model:tag": "namespace/model:tag",
|
||||
"host/namespace/model:tag": "host/namespace/model:tag",
|
||||
"host/library/model:tag": "host/library/model:tag",
|
||||
}
|
||||
|
||||
for in, want := range cases {
|
||||
|
Loading…
x
Reference in New Issue
Block a user