Skip to content

Commit

Permalink
💄 style: add *_MODEL_LIST for Qwen and ZeroOne (lobehub#3704)
Browse files Browse the repository at this point in the history
  • Loading branch information
hezhijie0327 authored Sep 1, 2024
1 parent 4c761c9 commit 05419dc
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ ENV \
# Perplexity
PERPLEXITY_API_KEY="" PERPLEXITY_PROXY_URL="" \
# Qwen
QWEN_API_KEY="" \
QWEN_API_KEY="" QWEN_MODEL_LIST="" \
# SiliconCloud
SILICONCLOUD_API_KEY="" SILICONCLOUD_MODEL_LIST="" SILICONCLOUD_PROXY_URL="" \
# Stepfun
Expand All @@ -149,7 +149,7 @@ ENV \
# Upstage
UPSTAGE_API_KEY="" \
# 01.AI
ZEROONE_API_KEY="" \
ZEROONE_API_KEY="" ZEROONE_MODEL_LIST="" \
# Zhipu
ZHIPU_API_KEY="" ZHIPU_MODEL_LIST=""

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.database
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ ENV \
# Perplexity
PERPLEXITY_API_KEY="" PERPLEXITY_PROXY_URL="" \
# Qwen
QWEN_API_KEY="" \
QWEN_API_KEY="" QWEN_MODEL_LIST="" \
# SiliconCloud
SILICONCLOUD_API_KEY="" SILICONCLOUD_MODEL_LIST="" SILICONCLOUD_PROXY_URL="" \
# Stepfun
Expand All @@ -181,7 +181,7 @@ ENV \
# Upstage
UPSTAGE_API_KEY="" \
# 01.AI
ZEROONE_API_KEY="" \
ZEROONE_API_KEY="" ZEROONE_MODEL_LIST="" \
# Zhipu
ZHIPU_API_KEY=""

Expand Down
4 changes: 4 additions & 0 deletions src/config/llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const getLLMConfig = () => {

ENABLED_ZEROONE: z.boolean(),
ZEROONE_API_KEY: z.string().optional(),
ZEROONE_MODEL_LIST: z.string().optional(),

ENABLED_TOGETHERAI: z.boolean(),
TOGETHERAI_API_KEY: z.string().optional(),
Expand All @@ -73,6 +74,7 @@ export const getLLMConfig = () => {

ENABLED_QWEN: z.boolean(),
QWEN_API_KEY: z.string().optional(),
QWEN_MODEL_LIST: z.string().optional(),

ENABLED_STEPFUN: z.boolean(),
STEPFUN_API_KEY: z.string().optional(),
Expand Down Expand Up @@ -154,6 +156,7 @@ export const getLLMConfig = () => {

ENABLED_ZEROONE: !!process.env.ZEROONE_API_KEY,
ZEROONE_API_KEY: process.env.ZEROONE_API_KEY,
ZEROONE_MODEL_LIST: process.env.ZEROONE_MODEL_LIST,

ENABLED_AWS_BEDROCK: process.env.ENABLED_AWS_BEDROCK === '1',
AWS_REGION: process.env.AWS_REGION,
Expand All @@ -166,6 +169,7 @@ export const getLLMConfig = () => {

ENABLED_QWEN: !!process.env.QWEN_API_KEY,
QWEN_API_KEY: process.env.QWEN_API_KEY,
QWEN_MODEL_LIST: process.env.QWEN_MODEL_LIST,

ENABLED_STEPFUN: !!process.env.STEPFUN_API_KEY,
STEPFUN_API_KEY: process.env.STEPFUN_API_KEY,
Expand Down
25 changes: 23 additions & 2 deletions src/server/globalConfig/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import {
OllamaProviderCard,
OpenAIProviderCard,
OpenRouterProviderCard,
QwenProviderCard,
SiliconCloudProviderCard,
TogetherAIProviderCard,
ZeroOneProviderCard,
ZhiPuProviderCard,
} from '@/config/modelProviders';
import { enableNextAuth } from '@/const/auth';
Expand Down Expand Up @@ -38,7 +40,10 @@ export const getServerGlobalConfig = () => {
ENABLED_MINIMAX,
ENABLED_MISTRAL,
ENABLED_NOVITA,

ENABLED_QWEN,
QWEN_MODEL_LIST,

ENABLED_STEPFUN,
ENABLED_BAICHUAN,
ENABLED_TAICHU,
Expand All @@ -60,6 +65,8 @@ export const getServerGlobalConfig = () => {
OPENROUTER_MODEL_LIST,

ENABLED_ZEROONE,
ZEROONE_MODEL_LIST,

ENABLED_TOGETHERAI,
TOGETHERAI_MODEL_LIST,
} = getLLMConfig();
Expand Down Expand Up @@ -120,7 +127,14 @@ export const getServerGlobalConfig = () => {
}),
},
perplexity: { enabled: ENABLED_PERPLEXITY },
qwen: { enabled: ENABLED_QWEN },
qwen: {
enabled: ENABLED_QWEN,
enabledModels: extractEnabledModels(QWEN_MODEL_LIST),
serverModelCards: transformToChatModelCards({
defaultChatModels: QwenProviderCard.chatModels,
modelString: QWEN_MODEL_LIST,
}),
},
siliconcloud: {
enabled: ENABLED_SILICONCLOUD,
enabledModels: extractEnabledModels(SILICONCLOUD_MODEL_LIST),
Expand All @@ -141,7 +155,14 @@ export const getServerGlobalConfig = () => {
}),
},
upstage: { enabled: ENABLED_UPSTAGE },
zeroone: { enabled: ENABLED_ZEROONE },
zeroone: {
enabled: ENABLED_ZEROONE,
enabledModels: extractEnabledModels(ZEROONE_MODEL_LIST),
serverModelCards: transformToChatModelCards({
defaultChatModels: ZeroOneProviderCard.chatModels,
modelString: ZEROONE_MODEL_LIST,
}),
},
zhipu: {
enabled: ENABLED_ZHIPU,
enabledModels: extractEnabledModels(ZHIPU_MODEL_LIST),
Expand Down

0 comments on commit 05419dc

Please sign in to comment.