diff --git a/Dockerfile b/Dockerfile index a39891a46ef2..ff604c1ec879 100644 --- a/Dockerfile +++ b/Dockerfile @@ -149,7 +149,7 @@ ENV \ # 01.AI ZEROONE_API_KEY="" \ # Zhipu - ZHIPU_API_KEY="" + ZHIPU_API_KEY="" ZHIPU_MODEL_LIST="" USER nextjs diff --git a/src/config/llm.ts b/src/config/llm.ts index efa57c8e25d5..a13b9b46fc21 100644 --- a/src/config/llm.ts +++ b/src/config/llm.ts @@ -20,6 +20,7 @@ export const getLLMConfig = () => { ENABLED_ZHIPU: z.boolean(), ZHIPU_API_KEY: z.string().optional(), + ZHIPU_MODEL_LIST: z.string().optional(), ENABLED_DEEPSEEK: z.boolean(), DEEPSEEK_API_KEY: z.string().optional(), @@ -109,6 +110,7 @@ export const getLLMConfig = () => { ENABLED_ZHIPU: !!process.env.ZHIPU_API_KEY, ZHIPU_API_KEY: process.env.ZHIPU_API_KEY, + ZHIPU_MODEL_LIST: process.env.ZHIPU_MODEL_LIST, ENABLED_DEEPSEEK: !!process.env.DEEPSEEK_API_KEY, DEEPSEEK_API_KEY: process.env.DEEPSEEK_API_KEY, diff --git a/src/config/modelProviders/zhipu.ts b/src/config/modelProviders/zhipu.ts index 6ca6e2cfb97e..4cdf24eb5f45 100644 --- a/src/config/modelProviders/zhipu.ts +++ b/src/config/modelProviders/zhipu.ts @@ -55,6 +55,8 @@ const ZhiPu: ModelProviderCard = { { description: '适用简单任务,速度最快,价格最实惠的版本', displayName: 'GLM-4-Flash', + enabled: true, + functionCall: true, id: 'glm-4-flash', tokens: 128_000, }, diff --git a/src/server/globalConfig/index.ts b/src/server/globalConfig/index.ts index 9bbff0e0a32c..bf5a808ca1d2 100644 --- a/src/server/globalConfig/index.ts +++ b/src/server/globalConfig/index.ts @@ -9,6 +9,7 @@ import { OpenRouterProviderCard, SiliconCloudProviderCard, TogetherAIProviderCard, + ZhiPuProviderCard, } from '@/config/modelProviders'; import { enableNextAuth } from '@/const/auth'; import { parseSystemAgent } from '@/server/globalConfig/parseSystemAgent'; @@ -26,6 +27,8 @@ export const getServerGlobalConfig = () => { ENABLED_MOONSHOT, ENABLED_ZHIPU, + ZHIPU_MODEL_LIST, + ENABLED_AWS_BEDROCK, ENABLED_GOOGLE, ENABLED_GROQ, @@ -136,7 +139,14 @@ export const getServerGlobalConfig = () => { }), }, zeroone: { enabled: ENABLED_ZEROONE }, - zhipu: { enabled: ENABLED_ZHIPU }, + zhipu: { + enabled: ENABLED_ZHIPU, + enabledModels: extractEnabledModels(ZHIPU_MODEL_LIST), + serverModelCards: transformToChatModelCards({ + defaultChatModels: ZhiPuProviderCard.chatModels, + modelString: ZHIPU_MODEL_LIST + }), + }, }, oAuthSSOProviders: authEnv.NEXT_AUTH_SSO_PROVIDERS.trim().split(/[,,]/), systemAgent: parseSystemAgent(appEnv.SYSTEM_AGENT),