remove unused code

This commit is contained in:
Bruce MacDonald 2023-07-20 20:18:00 +02:00
parent 6a19724d5f
commit 3ec4ebc562
2 changed files with 2 additions and 19 deletions

View file

@ -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

View file

@ -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()