diff --git a/.living_spec/stories/23_alphabetize_llm_dropdown.md b/.living_spec/stories/23_alphabetize_llm_dropdown.md index d467f2f..8e5d66f 100644 --- a/.living_spec/stories/23_alphabetize_llm_dropdown.md +++ b/.living_spec/stories/23_alphabetize_llm_dropdown.md @@ -4,10 +4,10 @@ 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 -- [ ] The model dropdown list is sorted alphabetically (case-insensitive) -- [ ] The currently selected model remains selected after sorting -- [ ] The sorting works for all models returned from Ollama -- [ ] The sorted list updates correctly when models are added/removed +- [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 diff --git a/src/components/Chat.tsx b/src/components/Chat.tsx index f1f753a..3dbd4e9 100644 --- a/src/components/Chat.tsx +++ b/src/components/Chat.tsx @@ -84,7 +84,11 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) { invoke("get_ollama_models") .then(async (models) => { if (models.length > 0) { - setAvailableModels(models); + // Sort models alphabetically (case-insensitive) + const sortedModels = models.sort((a, b) => + a.toLowerCase().localeCompare(b.toLowerCase()), + ); + setAvailableModels(sortedModels); // Check backend store for saved model try {