From 88e3fbbc98dc2171ef530beea844c767475ecc23 Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Thu, 10 Apr 2025 10:33:02 +0200 Subject: [PATCH] Sort models alphabetically in Chat view Signed-off-by: Fred Bricon --- gui/src/components/modelSelection/ModelSelect.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 8191af54b..e7dc1fbf5 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -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];