language_models: Sort Ollama models by name
Hello,
This is my first contribution so apologies if I'm not following the proper process (I haven't seen anything special in https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md). Also, I have tested my changes manually, but I could not figure out an easy we to instantiate a LanguageModelSelector in the unit tests, so I didn't write a test. If you can provide some guidance I'd be happy to write a test.
Fix: https://github.com/zed-industries/zed/issues/30854
If the user configured the models with custom names via display_name, we want the ollama models to be sorted based on the name that is actually displayed.
~~The original issue is only about ollama but this change will also affect the other providers.~~
Closes #30854
Release Notes:
- Improved: custom
display_nameis taken into account by the model picker
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: little-dude. This is most likely caused by a git client misconfiguration; please make sure to:
- check if your git client is configured with an email to sign commits
git config --list | grep email - If not, set it up using
git config --global user.email [email protected] - Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails
Thank you for the PR!
I think we'll want to do the sorting at the provider level, as some providers may want models to be returned in a particular order.
We require contributors to sign our Contributor License Agreement, and we don't have @little-dude on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.
Thank you for the PR!
I think we'll want to do the sorting at the provider level, as some providers may want models to be returned in a particular order.
Ah that's what I had done initially! I'll update the PR in a couple hours.
@cla-bot check
The cla-bot has been summoned, and re-checked this pull request!
@maxdeviant I updated the code to only sort the ollama models