mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-24 14:40:22 +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 filteredModels = allModels.filter((m) => m.available);
|
||||||
const defaultModel = filteredModels.find((m) => m.isDefault);
|
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) {
|
if (defaultModel) {
|
||||||
const arr = [
|
const arr = [
|
||||||
defaultModel,
|
defaultModel,
|
||||||
...filteredModels.filter((m) => m !== defaultModel),
|
...groupedModels.filter((m) => m !== defaultModel),
|
||||||
];
|
];
|
||||||
return arr;
|
return arr;
|
||||||
} else {
|
} else {
|
||||||
return filteredModels;
|
return groupedModels;
|
||||||
}
|
}
|
||||||
}, [allModels]);
|
}, [allModels]);
|
||||||
|
|
||||||
const currentModelName = useMemo(() => {
|
const currentModelName = useMemo(() => {
|
||||||
const model = models.find(
|
const model = models.find(
|
||||||
(m) =>
|
(m) =>
|
||||||
|
Loading…
Reference in New Issue
Block a user