Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commands/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func newRemoveCmd() *cobra.Command {
}
response, err := desktopClient.Remove(args, force)
if response != "" {
cmd.Println(response)
cmd.Print(response)
}
if err != nil {
err = handleClientError(err, "Failed to remove model")
Expand Down
34 changes: 24 additions & 10 deletions desktop/desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"time"

"github.com/docker/go-units"

"github.com/docker/model-distribution/distribution"
"github.com/docker/model-runner/pkg/inference"
dmrm "github.com/docker/model-runner/pkg/inference/models"
"github.com/docker/model-runner/pkg/inference/scheduling"
Expand Down Expand Up @@ -443,20 +443,34 @@ func (c *Client) Remove(models []string, force bool) (string, error) {
}
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
var bodyStr string
body, err := io.ReadAll(resp.Body)
if err != nil {
bodyStr = fmt.Sprintf("(failed to read response body: %v)", err)
} else {
bodyStr = string(body)
}

if resp.StatusCode == http.StatusOK {
var deleteResponse distribution.DeleteModelResponse
if err := json.Unmarshal(body, &deleteResponse); err != nil {
modelRemoved += fmt.Sprintf("Model %s removed successfully, but failed to parse response: %v\n", model, err)
} else {
for _, msg := range deleteResponse {
if msg.Untagged != nil {
modelRemoved += fmt.Sprintf("Untagged: %s\n", *msg.Untagged)
}
if msg.Deleted != nil {
modelRemoved += fmt.Sprintf("Deleted: %s\n", *msg.Deleted)
}
}
}
} else {
if resp.StatusCode == http.StatusNotFound {
return modelRemoved, fmt.Errorf("no such model: %s", model)
}
var bodyStr string
body, err := io.ReadAll(resp.Body)
if err != nil {
bodyStr = fmt.Sprintf("(failed to read response body: %v)", err)
} else {
bodyStr = string(body)
}
return modelRemoved, fmt.Errorf("removing %s failed with status %s: %s", model, resp.Status, bodyStr)
}
modelRemoved += fmt.Sprintf("Model %s removed successfully\n", model)
}
return modelRemoved, nil
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ require (
github.com/docker/docker v28.2.2+incompatible
github.com/docker/go-connections v0.5.0
github.com/docker/go-units v0.5.0
github.com/docker/model-distribution v0.0.0-20250627163720-aff34abcf3e0
github.com/docker/model-runner v0.0.0-20250627142917-26a0a73fbbc0
github.com/docker/model-distribution v0.0.0-20250710123110-a633223e127e
github.com/docker/model-runner v0.0.0-20250711130825-8907b3ddf82e
github.com/google/go-containerregistry v0.20.6
github.com/mattn/go-isatty v0.0.17
github.com/nxadm/tail v1.4.8
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHz
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE=
github.com/docker/model-distribution v0.0.0-20250627163720-aff34abcf3e0 h1:bve4JZI06Admw+NewtPfrpJXsvRnGKTQvBOEICNC1C0=
github.com/docker/model-distribution v0.0.0-20250627163720-aff34abcf3e0/go.mod h1:dThpO9JoG5Px3i+rTluAeZcqLGw8C0qepuEL4gL2o/c=
github.com/docker/model-runner v0.0.0-20250627142917-26a0a73fbbc0 h1:yajuhlGe1xhpWW3eMehQi2RrqiBQiGoi6c6OWiPxMaQ=
github.com/docker/model-runner v0.0.0-20250627142917-26a0a73fbbc0/go.mod h1:vZJiUZH/7O1CyNsEGi1o4khUT4DVRjcwluuamU9fhuM=
github.com/docker/model-distribution v0.0.0-20250710123110-a633223e127e h1:qBkjP4A20f3RXvtstitIPiStQ4p+bK8xcjosrXLBQZ0=
github.com/docker/model-distribution v0.0.0-20250710123110-a633223e127e/go.mod h1:dThpO9JoG5Px3i+rTluAeZcqLGw8C0qepuEL4gL2o/c=
github.com/docker/model-runner v0.0.0-20250711130825-8907b3ddf82e h1:oafd84kAFBgv/DAYgtXGLkC1KmRpDN+7G3be5+2+hA0=
github.com/docker/model-runner v0.0.0-20250711130825-8907b3ddf82e/go.mod h1:QmSoUNAbqolMY1Aq9DaC+sR/M/OPga0oCT/DBA1z9ow=
github.com/dvsekhvalnov/jose2go v0.0.0-20170216131308-f21a8cedbbae/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
Expand Down
11 changes: 11 additions & 0 deletions vendor/github.com/docker/model-distribution/builder/builder.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 35 additions & 18 deletions vendor/github.com/docker/model-distribution/distribution/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading