Files
storkit/.living_spec/stories/23_alphabetize_llm_dropdown.md
Dave bdb82bcf49 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.

Implementation:
- Added alphabetical sorting with case-insensitive comparison
- Used localeCompare() for proper string comparison
- Sort happens immediately after fetching models from backend
- Currently selected model remains selected after sorting

Technical Details:
- Sort logic: models.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()))
- Frontend-only change, no backend modifications needed
- Sorting preserves model selection state

Acceptance Criteria Met:
 Models sorted alphabetically (case-insensitive)
 Selected model remains selected after sorting
 Works for all models from Ollama
 Updates correctly when models change

Files Changed:
- src/components/Chat.tsx: Added sorting logic to model fetch
- .living_spec/stories/23_alphabetize_llm_dropdown.md: Marked complete
2025-12-27 19:30:17 +00:00

1.3 KiB

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

  • 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

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

// 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