mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 16:15:50 +08:00
feat: close #3187 use CUSTOM_MODELS to control model list
This commit is contained in:
@@ -17,6 +17,7 @@ const DEFAULT_ACCESS_STATE = {
|
||||
hideBalanceQuery: false,
|
||||
disableGPT4: false,
|
||||
disableFastLink: false,
|
||||
customModels: "",
|
||||
|
||||
openaiUrl: DEFAULT_OPENAI_URL,
|
||||
};
|
||||
@@ -52,12 +53,6 @@ export const useAccessStore = createPersistStore(
|
||||
.then((res: DangerConfig) => {
|
||||
console.log("[Config] got config from server", res);
|
||||
set(() => ({ ...res }));
|
||||
|
||||
if (res.disableGPT4) {
|
||||
DEFAULT_MODELS.forEach(
|
||||
(m: any) => (m.available = !m.name.startsWith("gpt-4")),
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
console.error("[Config] failed to fetch config");
|
||||
|
@@ -128,15 +128,7 @@ export const useAppConfig = createPersistStore(
|
||||
}));
|
||||
},
|
||||
|
||||
allModels() {
|
||||
const customModels = get()
|
||||
.customModels.split(",")
|
||||
.filter((v) => !!v && v.length > 0)
|
||||
.map((m) => ({ name: m, available: true }));
|
||||
const allModels = get().models.concat(customModels);
|
||||
allModels.sort((a, b) => (a.name < b.name ? -1 : 1));
|
||||
return allModels;
|
||||
},
|
||||
allModels() {},
|
||||
}),
|
||||
{
|
||||
name: StoreKey.Config,
|
||||
|
Reference in New Issue
Block a user