diff --git a/web/containers/ModelDropdown/index.tsx b/web/containers/ModelDropdown/index.tsx index 3d72df615f..c19fb64bdf 100644 --- a/web/containers/ModelDropdown/index.tsx +++ b/web/containers/ModelDropdown/index.tsx @@ -104,8 +104,23 @@ const ModelDropdown = ({ ) } }) - .sort((a, b) => a.name.localeCompare(b.name)), - [configuredModels, searchText, searchFilter] + .sort((a, b) => a.name.localeCompare(b.name)) + .sort((a, b) => { + const aInDownloadedModels = downloadedModels.some( + (item) => item.id === a.id + ) + const bInDownloadedModels = downloadedModels.some( + (item) => item.id === b.id + ) + if (aInDownloadedModels && !bInDownloadedModels) { + return -1 + } else if (!aInDownloadedModels && bInDownloadedModels) { + return 1 + } else { + return 0 + } + }), + [configuredModels, searchText, searchFilter, downloadedModels] ) useEffect(() => {