zed icon indicating copy to clipboard operation
zed copied to clipboard

language_models: Sort Ollama models by name

Open little-dude opened this issue 6 months ago • 7 comments

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_name is taken into account by the model picker

little-dude avatar May 28 '25 18:05 little-dude

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:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

cla-bot[bot] avatar May 28 '25 18:05 cla-bot[bot]

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.

maxdeviant avatar May 28 '25 18:05 maxdeviant

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'.

cla-bot[bot] avatar May 28 '25 18:05 cla-bot[bot]

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.

little-dude avatar May 28 '25 18:05 little-dude

@cla-bot check

little-dude avatar May 28 '25 18:05 little-dude

The cla-bot has been summoned, and re-checked this pull request!

cla-bot[bot] avatar May 28 '25 18:05 cla-bot[bot]

@maxdeviant I updated the code to only sort the ollama models

little-dude avatar May 28 '25 20:05 little-dude