if directory cannot be resolved, do not fail

This commit is contained in:
Bruce MacDonald
2023-07-07 15:27:43 -04:00
parent b24be8c6b3
commit 61dd87bd90
3 changed files with 43 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import (
"fmt"
"log"
"net"
"net/http"
"os"
"path"
"strings"
@@ -50,6 +51,10 @@ func pull(model string) error {
context.Background(),
&api.PullRequest{Model: model},
func(progress api.PullProgress) error {
if progress.Error.Code == http.StatusBadGateway {
// couldn't pull the model from the directory, proceed in offline mode
return nil
}
if bar == nil && progress.Percent == 100 {
// already downloaded
return nil