Skip to content

Commit 954751e

Browse files
authored
Merge pull request #372 from ericcurtin/rm-full-matches-only
When removing models, only remove exact matches
2 parents 8d76ee6 + ec05f95 commit 954751e

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

cmd/cli/desktop/desktop.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -355,22 +355,10 @@ func (c *Client) fullModelID(id string) (string, error) {
355355
return m.ID, nil
356356
}
357357
}
358-
// If not found with exact match, try partial name matching
359-
for _, tag := range m.Tags {
360-
// Extract the model name without tag part (e.g., from "ai/smollm2:latest" get "ai/smollm2")
361-
tagWithoutVersion := tag
362-
if idx := strings.LastIndex(tag, ":"); idx != -1 {
363-
tagWithoutVersion = tag[:idx]
364-
}
365358

366-
// Get just the name part without organization (e.g., from "ai/smollm2" get "smollm2")
367-
namePart := tagWithoutVersion
368-
if idx := strings.LastIndex(tagWithoutVersion, "/"); idx != -1 {
369-
namePart = tagWithoutVersion[idx+1:]
370-
}
371-
372-
// Check if the ID matches the name part
373-
if namePart == id {
359+
// Normalize everything and try to find exact matches
360+
for _, tag := range m.Tags {
361+
if dmrm.NormalizeModelName(tag) == dmrm.NormalizeModelName(id) {
374362
return m.ID, nil
375363
}
376364
}

0 commit comments

Comments
 (0)