mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-24 06:30:16 +09:00
feat: rewrite the model list collation
This commit is contained in:
parent
6593e05fcb
commit
26b0b49c31
@ -522,16 +522,23 @@ export function ChatActions(props: {
|
||||
const filteredModels = allModels.filter((m) => m.available);
|
||||
const defaultModel = filteredModels.find((m) => m.isDefault);
|
||||
|
||||
const groupedModels = filteredModels.sort((a, b) => {
|
||||
const providerA = a.provider?.providerName || "";
|
||||
const providerB = b.provider?.providerName || "";
|
||||
return providerA.localeCompare(providerB);
|
||||
});
|
||||
|
||||
if (defaultModel) {
|
||||
const arr = [
|
||||
defaultModel,
|
||||
...filteredModels.filter((m) => m !== defaultModel),
|
||||
...groupedModels.filter((m) => m !== defaultModel),
|
||||
];
|
||||
return arr;
|
||||
} else {
|
||||
return filteredModels;
|
||||
return groupedModels;
|
||||
}
|
||||
}, [allModels]);
|
||||
|
||||
const currentModelName = useMemo(() => {
|
||||
const model = models.find(
|
||||
(m) =>
|
||||
|
Loading…
Reference in New Issue
Block a user