-
Notifications
You must be signed in to change notification settings - Fork 79
Fix package command #514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix package command #514
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e0cd3fd
fix(package): update packageModel function signature to include conte…
ilopezluna a5c40aa
test(integration): add integration tests for packaging GGUF models
ilopezluna c7d4b1d
Do not normalize model name in the client
ilopezluna bdb7826
Move model name normalization to distribution
ilopezluna 7138336
Merge branch 'main' into fix-package-model
ilopezluna 70d0e03
Move model name normalization into client to be able to resolve short…
ilopezluna 8e807a7
Add test to ensure short IDs are properly resolved
ilopezluna 8090ce8
remove unneeded tests
ilopezluna 2560aef
update tagging to be a no op when using same tag as reference
ilopezluna be5c0fc
update model filtering logic to match docker cli
ilopezluna d418fb5
No need to normalize in cli anymore
ilopezluna abe997e
fix lint
ilopezluna ced7c79
remove unneeded tests
ilopezluna 7ee735f
fix(distribution): normalize tags in WriteLightweightModel
doringeman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,27 +72,39 @@ func listModels(openai bool, desktopClient *desktop.Client, quiet bool, jsonForm | |
| } | ||
|
|
||
| if modelFilter != "" { | ||
| // Normalize the filter to match stored model names (backend normalizes when storing) | ||
| normalizedFilter := dmrm.NormalizeModelName(modelFilter) | ||
| // If filter doesn't contain '/', prepend default namespace 'ai/' | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the model filter logic to match the same logic as docker cli you can filter by repo + tag but not only by tag |
||
| if !strings.Contains(modelFilter, "/") { | ||
| modelFilter = "ai/" + modelFilter | ||
| } | ||
|
|
||
| var filteredModels []dmrm.Model | ||
|
|
||
| // Check if filter has a colon (i.e., includes a tag) | ||
| hasColon := strings.Contains(modelFilter, ":") | ||
|
|
||
| for _, m := range models { | ||
| hasMatchingTag := false | ||
| var matchingTags []string | ||
| for _, tag := range m.Tags { | ||
| // Tags are stored in normalized format by the backend | ||
| if tag == normalizedFilter { | ||
| hasMatchingTag = true | ||
| break | ||
| } | ||
| // Also check without the tag part | ||
| modelName, _, _ := strings.Cut(tag, ":") | ||
| filterName, _, _ := strings.Cut(normalizedFilter, ":") | ||
| if modelName == filterName { | ||
| hasMatchingTag = true | ||
| break | ||
| if hasColon { | ||
| // Filter includes a tag part - do exact match | ||
| // Tags are stored in normalized format by the backend | ||
| if tag == modelFilter { | ||
| matchingTags = append(matchingTags, tag) | ||
| } | ||
| } else { | ||
| // Filter has no colon - match repository name only (part before ':') | ||
| repository, _, _ := strings.Cut(tag, ":") | ||
| if repository == modelFilter { | ||
| matchingTags = append(matchingTags, tag) | ||
| } | ||
| } | ||
| } | ||
| if hasMatchingTag { | ||
| filteredModels = append(filteredModels, m) | ||
| // Only include the model if at least one tag matched, and only include matching tags | ||
| if len(matchingTags) > 0 { | ||
| // Create a copy of the model with only the matching tags | ||
| filteredModel := m | ||
| filteredModel.Tags = matchingTags | ||
| filteredModels = append(filteredModels, filteredModel) | ||
| } | ||
| } | ||
| models = filteredModels | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this verification because it's redundant. If a tag fails the individual test will fail, so this test is not adding any additional coverage and it becomes a false positive in some cases (for example when tagging a model using same reference as tag, its a no op, but this test will fail because the expected number of tagged models will not match with the actual)