---
name: Alphabetize LLM Dropdown List
---

# Story 23: Alphabetize LLM Dropdown List

## User Story
As a user, I want the LLM model dropdown to be alphabetically sorted so I can quickly find the model I'm looking for.

## Acceptance Criteria
- [x] The model dropdown list is sorted alphabetically (case-insensitive)
- [x] The currently selected model remains selected after sorting
- [x] The sorting works for all models returned from Ollama
- [x] The sorted list updates correctly when models are added/removed

## Out of Scope
- Grouping models by type or provider
- Custom sort orders (e.g., by popularity, recency)
- Search/filter functionality in the dropdown
- Favoriting or pinning specific models to the top

## Technical Notes
- Models are fetched from `get_ollama_models` Tauri command
- Currently displayed in the order returned by the backend
- Sort should be case-insensitive (e.g., "Llama" and "llama" treated equally)
- JavaScript's `sort()` with `localeCompare()` is ideal for this

## Implementation Approach
```tsx
// After fetching models from backend
const sortedModels = models.sort((a, b) => 
  a.toLowerCase().localeCompare(b.toLowerCase())
);
setAvailableModels(sortedModels);
```

## Design Considerations
- Keep it simple - alphabetical order is intuitive
- Case-insensitive to handle inconsistent model naming
- No need to change backend - sorting on frontend is sufficient