"vscode:/vscode.git/clone" did not exist on "23ebbb4bc81a17ebea17cb7cb94f301199e49a7f"
Commit c3168935 authored by Bruce MacDonald's avatar Bruce MacDonald
Browse files

fix resume download

parent 3d73ad0c
...@@ -43,16 +43,16 @@ func RunRun(cmd *cobra.Command, args []string) error { ...@@ -43,16 +43,16 @@ func RunRun(cmd *cobra.Command, args []string) error {
} }
func pull(model string) error { func pull(model string) error {
// TODO: check if the local model is up to date with remote
_, err := os.Stat(cacheDir() + "/models/" + model + ".bin")
switch {
case errors.Is(err, os.ErrNotExist):
client := api.NewClient() client := api.NewClient()
var bar *progressbar.ProgressBar var bar *progressbar.ProgressBar
return client.Pull( return client.Pull(
context.Background(), context.Background(),
&api.PullRequest{Model: model}, &api.PullRequest{Model: model},
func(progress api.PullProgress) error { func(progress api.PullProgress) error {
if bar == nil && progress.Percent == 100 {
// already downloaded
return nil
}
if bar == nil { if bar == nil {
bar = progressbar.DefaultBytes(progress.Total) bar = progressbar.DefaultBytes(progress.Total)
} }
...@@ -60,10 +60,6 @@ func pull(model string) error { ...@@ -60,10 +60,6 @@ func pull(model string) error {
return bar.Set64(progress.Completed) return bar.Set64(progress.Completed)
}, },
) )
case err != nil:
return err
}
return nil
} }
func RunGenerate(_ *cobra.Command, args []string) error { func RunGenerate(_ *cobra.Command, args []string) error {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment