From 3ec4ebc5624157f02f784c2173b9077ee6c2ffdf Mon Sep 17 00:00:00 2001 From: Bruce MacDonald Date: Thu, 20 Jul 2023 20:18:00 +0200 Subject: [PATCH] remove unused code --- server/images.go | 12 ++---------- server/routes.go | 9 --------- 2 files changed, 2 insertions(+), 19 deletions(-) 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()