ollama: Add button for refreshing available models #38181
Merged
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.
Closes #17524
This PR adds a button to the bottom right corner of the ollama settings ui. It resets the available ollama models, also resets the "Connected" state in the process. This means it can be used to check if the connection is still valid as well. It's a question whether we should clear the available models on ALL
fetch_modelscalls, since these only happen during auth anyway.Ollama is a local model provider which means clicking the refresh button often only flashes the "not connected" state because the latency of the request is so low. This accentuates changes in the UI, however I don't think there's a way around this without adding some rather cumbersome deferred ui updates.
I've attached the refresh button to the "Connected"
ButtonLike, since I don't think automatic UI spacing should separate these elements. I think this is okay because the "Connected" isn't actually something that the user can interact with.Before:

After:

Alternative approach: There was also a suggestion to simply add a entry to the command palette, however none of the other providers have this ability currently either so I went with this approach. The current approach also makes it more discoverable to the user.
Release Notes: