mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-10 07:46:59 +00:00
pull models
This commit is contained in:
committed by
Jeffrey Morgan
parent
0833f5af3a
commit
a6494f8211
18
cmd/cmd.go
18
cmd/cmd.go
@@ -2,6 +2,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
@@ -23,6 +24,21 @@ func cacheDir() string {
|
||||
return path.Join(home, ".ollama")
|
||||
}
|
||||
|
||||
func run(model string) error {
|
||||
client, err := NewAPIClient()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pr := api.PullRequest{
|
||||
Model: model,
|
||||
}
|
||||
callback := func(progress string) {
|
||||
fmt.Println(progress)
|
||||
}
|
||||
_, err = client.Pull(context.Background(), &pr, callback)
|
||||
return err
|
||||
}
|
||||
|
||||
func serve() error {
|
||||
sp := path.Join(cacheDir(), "ollama.sock")
|
||||
|
||||
@@ -94,7 +110,7 @@ func NewCLI() *cobra.Command {
|
||||
Short: "Run a model",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
return run(args[0])
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user