From af21c57e77560087eb2911e88b24398fc6b2d0ff Mon Sep 17 00:00:00 2001 From: lyf <1910527151@qq.com> Date: Wed, 7 Aug 2024 10:15:39 +0800 Subject: [PATCH 1/2] ban gpt4 --- app/api/openai.ts | 2 +- app/config/server.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/api/openai.ts b/app/api/openai.ts index 6d11d679215..d32e45dd997 100644 --- a/app/api/openai.ts +++ b/app/api/openai.ts @@ -13,7 +13,7 @@ function getModels(remoteModelRes: OpenAIListModelResponse) { if (config.disableGPT4) { remoteModelRes.data = remoteModelRes.data.filter( - (m) => !m.id.startsWith("gpt-4"), + (m) => !m.id.startsWith("gpt-4") || m.id.startsWith("gpt-40-mini"), ); } diff --git a/app/config/server.ts b/app/config/server.ts index 1fba454e8d7..5bfa2c2df11 100644 --- a/app/config/server.ts +++ b/app/config/server.ts @@ -119,10 +119,16 @@ export const getServerSideConfig = () => { if (disableGPT4) { if (customModels) customModels += ","; - customModels += DEFAULT_MODELS.filter((m) => m.name.startsWith("gpt-4")) + customModels += DEFAULT_MODELS.filter( + (m) => m.name.startsWith("gpt-4") && !m.name.startsWith("gpt-4o-mini"), + ) .map((m) => "-" + m.name) .join(","); - if (defaultModel.startsWith("gpt-4")) defaultModel = ""; + if ( + defaultModel.startsWith("gpt-4") && + !defaultModel.startsWith("gpt-4o-mini") + ) + defaultModel = ""; } const isStability = !!process.env.STABILITY_API_KEY; From 42fdbd9bb863203912b86205641dec2e5b4d07c3 Mon Sep 17 00:00:00 2001 From: lzz <55302758+122cygf@users.noreply.github.com> Date: Wed, 7 Aug 2024 17:22:32 +0800 Subject: [PATCH 2/2] Fix spelling errors --- app/api/openai.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/openai.ts b/app/api/openai.ts index d32e45dd997..0059ff8b423 100644 --- a/app/api/openai.ts +++ b/app/api/openai.ts @@ -13,7 +13,7 @@ function getModels(remoteModelRes: OpenAIListModelResponse) { if (config.disableGPT4) { remoteModelRes.data = remoteModelRes.data.filter( - (m) => !m.id.startsWith("gpt-4") || m.id.startsWith("gpt-40-mini"), + (m) => !m.id.startsWith("gpt-4") || m.id.startsWith("gpt-4o-mini"), ); }