Sort models alphabetically in Chat view

Signed-off-by: Fred Bricon <fbricon@gmail.com>
This commit is contained in:
Fred Bricon 2025-04-10 10:33:02 +02:00
parent 4e8a69ec30
commit 88e3fbbc98

View file

@ -131,8 +131,9 @@ function ModelSelect() {
// Sort so that options without an API key are at the end
useEffect(() => {
const enabledOptions = options.filter((option) => option.apiKey !== "");
const disabledOptions = options.filter((option) => option.apiKey === "");
const alphaSort = options.sort((a, b) => a.title.localeCompare(b.title));
const enabledOptions = alphaSort.filter((option) => option.apiKey !== "");
const disabledOptions = alphaSort.filter((option) => option.apiKey === "");
const sorted = [...enabledOptions, ...disabledOptions];