diff --git a/server/images.go b/server/images.go index 4258b201..9742a8bd 100644 --- a/server/images.go +++ b/server/images.go @@ -605,22 +605,14 @@ func PullModel(name, username, password string, fn func(api.ProgressResponse)) e } var layers []*Layer - var total int - var completed int - for _, layer := range manifest.Layers { - layers = append(layers, layer) - total += layer.Size - } + layers = append(layers, manifest.Layers...) layers = append(layers, &manifest.Config) - total += manifest.Config.Size for _, layer := range layers { if err := downloadBlob(mp, layer.Digest, username, password, fn); err != nil { fn(api.ProgressResponse{Status: fmt.Sprintf("error downloading: %v", err), Digest: layer.Digest}) return err } - - completed += layer.Size } fn(api.ProgressResponse{Status: "writing manifest"}) @@ -635,7 +627,7 @@ func PullModel(name, username, password string, fn func(api.ProgressResponse)) e return err } - err = os.WriteFile(fp, manifestJSON, 0644) + err = os.WriteFile(fp, manifestJSON, 0o644) if err != nil { log.Printf("couldn't write to %s", fp) return err diff --git a/server/routes.go b/server/routes.go index f97ab120..eeb93e32 100644 --- a/server/routes.go +++ b/server/routes.go @@ -18,15 +18,6 @@ import ( "github.com/jmorganca/ollama/llama" ) -func cacheDir() string { - home, err := os.UserHomeDir() - if err != nil { - panic(err) - } - - return filepath.Join(home, ".ollama") -} - func generate(c *gin.Context) { start := time.Now()