From be4efc76c1ecf2027b7bae876d19656220847386 Mon Sep 17 00:00:00 2001 From: Bui Trong Khanh Duy <57395332+khanhduyvt0101@users.noreply.github.com> Date: Fri, 13 Sep 2024 12:00:59 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20style:=20Support=20Google=20Mode?= =?UTF-8?q?l=20List=20(#3938)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add sessionToken for bedrock model * Support google model list * update relate sessionToken info * update description and revert gg model list * update description * change session token is a custom field * support google model list --- src/config/llm.ts | 2 ++ src/server/globalConfig/index.ts | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/config/llm.ts b/src/config/llm.ts index 56981d585d66..91ac88e70d50 100644 --- a/src/config/llm.ts +++ b/src/config/llm.ts @@ -28,6 +28,7 @@ export const getLLMConfig = () => { ENABLED_GOOGLE: z.boolean(), GOOGLE_API_KEY: z.string().optional(), GOOGLE_PROXY_URL: z.string().optional(), + GOOGLE_MODEL_LIST: z.string().optional(), ENABLED_MOONSHOT: z.boolean(), MOONSHOT_API_KEY: z.string().optional(), @@ -134,6 +135,7 @@ export const getLLMConfig = () => { ENABLED_GOOGLE: !!process.env.GOOGLE_API_KEY, GOOGLE_API_KEY: process.env.GOOGLE_API_KEY, GOOGLE_PROXY_URL: process.env.GOOGLE_PROXY_URL, + GOOGLE_MODEL_LIST: process.env.GOOGLE_MODEL_LIST, ENABLED_PERPLEXITY: !!process.env.PERPLEXITY_API_KEY, PERPLEXITY_API_KEY: process.env.PERPLEXITY_API_KEY, diff --git a/src/server/globalConfig/index.ts b/src/server/globalConfig/index.ts index 82d8a9e6d620..004eaead6666 100644 --- a/src/server/globalConfig/index.ts +++ b/src/server/globalConfig/index.ts @@ -6,6 +6,7 @@ import { getLLMConfig } from '@/config/llm'; import { BedrockProviderCard, FireworksAIProviderCard, + GoogleProviderCard, GroqProviderCard, NovitaProviderCard, OllamaProviderCard, @@ -39,6 +40,7 @@ export const getServerGlobalConfig = () => { AWS_BEDROCK_MODEL_LIST, ENABLED_GOOGLE, + GOOGLE_MODEL_LIST, ENABLED_GROQ, GROQ_MODEL_LIST, @@ -128,7 +130,14 @@ export const getServerGlobalConfig = () => { }), }, - google: { enabled: ENABLED_GOOGLE }, + google: { + enabled: ENABLED_GOOGLE, + enabledModels: extractEnabledModels(GOOGLE_MODEL_LIST), + serverModelCards: transformToChatModelCards({ + defaultChatModels: GoogleProviderCard.chatModels, + modelString: GOOGLE_MODEL_LIST, + }), + }, groq: { enabled: ENABLED_GROQ, enabledModels: extractEnabledModels(GROQ_MODEL_LIST),