fix model loading

This commit is contained in:
ParthSareen 2025-10-24 15:03:39 -07:00
parent b883c895d5
commit cea61b0434
1 changed files with 8 additions and 10 deletions

View File

@ -446,19 +446,17 @@ func RunHandler(cmd *cobra.Command, args []string) error {
opts.ParentModel = info.Details.ParentModel opts.ParentModel = info.Details.ParentModel
if interactive { if interactive {
if len(info.Messages) > 0 { if err := loadOrUnloadModel(cmd, &opts); err != nil {
if err := loadOrUnloadModel(cmd, &opts); err != nil { var sErr api.AuthorizationError
var sErr api.AuthorizationError if errors.As(err, &sErr) && sErr.StatusCode == http.StatusUnauthorized {
if errors.As(err, &sErr) && sErr.StatusCode == http.StatusUnauthorized { fmt.Printf("You need to be signed in to Ollama to run Cloud models.\n\n")
fmt.Printf("You need to be signed in to Ollama to run Cloud models.\n\n")
if sErr.SigninURL != "" { if sErr.SigninURL != "" {
fmt.Printf(ConnectInstructions, sErr.SigninURL) fmt.Printf(ConnectInstructions, sErr.SigninURL)
}
return nil
} }
return err return nil
} }
return err
} }
for _, msg := range info.Messages { for _, msg := range info.Messages {