diff --git a/web/src/assets/svg/llm/vllm.svg b/web/src/assets/svg/llm/vllm.svg new file mode 100644 index 000000000..6aca38486 --- /dev/null +++ b/web/src/assets/svg/llm/vllm.svg @@ -0,0 +1,59 @@ + + vllm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/web/src/components/svg-icon.tsx b/web/src/components/svg-icon.tsx index 19f8f0dd7..76117c5d7 100644 --- a/web/src/components/svg-icon.tsx +++ b/web/src/components/svg-icon.tsx @@ -1,4 +1,4 @@ -import { IconMap } from '@/constants/setting'; +import { IconMap } from '@/constants/llm'; import { cn } from '@/lib/utils'; import Icon, { UserOutlined } from '@ant-design/icons'; import { IconComponentProps } from '@ant-design/icons/lib/components/Icon'; diff --git a/web/src/constants/llm.ts b/web/src/constants/llm.ts new file mode 100644 index 000000000..dcb37b514 --- /dev/null +++ b/web/src/constants/llm.ts @@ -0,0 +1,106 @@ +export enum LLMFactory { + TongYiQianWen = 'Tongyi-Qianwen', + Moonshot = 'Moonshot', + OpenAI = 'OpenAI', + ZhipuAI = 'ZHIPU-AI', + WenXinYiYan = '文心一言', + Ollama = 'Ollama', + Xinference = 'Xinference', + ModelScope = 'ModelScope', + DeepSeek = 'DeepSeek', + VolcEngine = 'VolcEngine', + BaiChuan = 'BaiChuan', + Jina = 'Jina', + MiniMax = 'MiniMax', + Mistral = 'Mistral', + AzureOpenAI = 'Azure-OpenAI', + Bedrock = 'Bedrock', + Gemini = 'Gemini', + Groq = 'Groq', + OpenRouter = 'OpenRouter', + LocalAI = 'LocalAI', + StepFun = 'StepFun', + NVIDIA = 'NVIDIA', + LMStudio = 'LM-Studio', + OpenAiAPICompatible = 'OpenAI-API-Compatible', + Cohere = 'Cohere', + LeptonAI = 'LeptonAI', + TogetherAI = 'TogetherAI', + PerfXCloud = 'PerfXCloud', + Upstage = 'Upstage', + NovitaAI = 'novita.ai', + SILICONFLOW = 'SILICONFLOW', + PPIO = 'PPIO', + ZeroOneAI = '01.AI', + Replicate = 'Replicate', + TencentHunYuan = 'Tencent Hunyuan', + XunFeiSpark = 'XunFei Spark', + BaiduYiYan = 'BaiduYiyan', + FishAudio = 'Fish Audio', + TencentCloud = 'Tencent Cloud', + Anthropic = 'Anthropic', + VoyageAI = 'Voyage AI', + GoogleCloud = 'Google Cloud', + HuggingFace = 'HuggingFace', + YouDao = 'Youdao', + BAAI = 'BAAI', + NomicAI = 'nomic-ai', + JinaAI = 'jinaai', + SentenceTransformers = 'sentence-transformers', + GPUStack = 'GPUStack', + VLLM = 'VLLM', +} + +// Please lowercase the file name +export const IconMap = { + [LLMFactory.TongYiQianWen]: 'tongyi', + [LLMFactory.Moonshot]: 'moonshot', + [LLMFactory.OpenAI]: 'openai', + [LLMFactory.ZhipuAI]: 'zhipu', + [LLMFactory.WenXinYiYan]: 'wenxin', + [LLMFactory.Ollama]: 'ollama', + [LLMFactory.Xinference]: 'xinference', + [LLMFactory.ModelScope]: 'modelscope', + [LLMFactory.DeepSeek]: 'deepseek', + [LLMFactory.VolcEngine]: 'volc_engine', + [LLMFactory.BaiChuan]: 'baichuan', + [LLMFactory.Jina]: 'jina', + [LLMFactory.MiniMax]: 'chat-minimax', + [LLMFactory.Mistral]: 'mistral', + [LLMFactory.AzureOpenAI]: 'azure', + [LLMFactory.Bedrock]: 'bedrock', + [LLMFactory.Gemini]: 'gemini', + [LLMFactory.Groq]: 'groq-next', + [LLMFactory.OpenRouter]: 'open-router', + [LLMFactory.LocalAI]: 'local-ai', + [LLMFactory.StepFun]: 'stepfun', + [LLMFactory.NVIDIA]: 'nvidia', + [LLMFactory.LMStudio]: 'lm-studio', + [LLMFactory.OpenAiAPICompatible]: 'openai-api', + [LLMFactory.Cohere]: 'cohere', + [LLMFactory.LeptonAI]: 'lepton-ai', + [LLMFactory.TogetherAI]: 'together-ai', + [LLMFactory.PerfXCloud]: 'perfx-cloud', + [LLMFactory.Upstage]: 'upstage', + [LLMFactory.NovitaAI]: 'novita-ai', + [LLMFactory.SILICONFLOW]: 'siliconflow', + [LLMFactory.PPIO]: 'ppio', + [LLMFactory.ZeroOneAI]: 'yi', + [LLMFactory.Replicate]: 'replicate', + [LLMFactory.TencentHunYuan]: 'hunyuan', + [LLMFactory.XunFeiSpark]: 'spark', + [LLMFactory.BaiduYiYan]: 'yiyan', + [LLMFactory.FishAudio]: 'fish-audio', + [LLMFactory.TencentCloud]: 'tencent-cloud', + [LLMFactory.Anthropic]: 'anthropic', + [LLMFactory.VoyageAI]: 'voyage', + [LLMFactory.GoogleCloud]: 'google-cloud', + [LLMFactory.HuggingFace]: 'huggingface', + [LLMFactory.YouDao]: 'youdao', + [LLMFactory.BAAI]: 'baai', + [LLMFactory.NomicAI]: 'nomic-ai', + [LLMFactory.JinaAI]: 'jina', + [LLMFactory.SentenceTransformers]: 'sentence-transformers', + [LLMFactory.GPUStack]: 'gpustack', + [LLMFactory.VLLM]: 'vllm', +}; diff --git a/web/src/constants/setting.ts b/web/src/constants/setting.ts index a62b228a6..0b6ad5488 100644 --- a/web/src/constants/setting.ts +++ b/web/src/constants/setting.ts @@ -24,59 +24,6 @@ export enum ProfileSettingRouteKey { Logout = 'logout', } -// Please lowercase the file name -export const IconMap = { - 'Tongyi-Qianwen': 'tongyi', - Moonshot: 'moonshot', - OpenAI: 'openai', - 'ZHIPU-AI': 'zhipu', - 文心一言: 'wenxin', - Ollama: 'ollama', - Xinference: 'xinference', - ModelScope: 'modelscope', - DeepSeek: 'deepseek', - VolcEngine: 'volc_engine', - BaiChuan: 'baichuan', - Jina: 'jina', - MiniMax: 'chat-minimax', - Mistral: 'mistral', - 'Azure-OpenAI': 'azure', - Bedrock: 'bedrock', - Gemini: 'gemini', - Groq: 'groq-next', - OpenRouter: 'open-router', - LocalAI: 'local-ai', - StepFun: 'stepfun', - NVIDIA: 'nvidia', - 'LM-Studio': 'lm-studio', - 'OpenAI-API-Compatible': 'openai-api', - Cohere: 'cohere', - LeptonAI: 'lepton-ai', - TogetherAI: 'together-ai', - PerfXCloud: 'perfx-cloud', - Upstage: 'upstage', - 'novita.ai': 'novita-ai', - SILICONFLOW: 'siliconflow', - PPIO: 'ppio', - '01.AI': 'yi', - Replicate: 'replicate', - 'Tencent Hunyuan': 'hunyuan', - 'XunFei Spark': 'spark', - BaiduYiyan: 'yiyan', - 'Fish Audio': 'fish-audio', - 'Tencent Cloud': 'tencent-cloud', - Anthropic: 'anthropic', - 'Voyage AI': 'voyage', - 'Google Cloud': 'google-cloud', - HuggingFace: 'huggingface', - Youdao: 'youdao', - BAAI: 'baai', - 'nomic-ai': 'nomic-ai', - jinaai: 'jina', - 'sentence-transformers': 'sentence-transformers', - GPUStack: 'gpustack', -}; - export const TimezoneList = [ 'UTC-11\tPacific/Midway', 'UTC-11\tPacific/Niue', diff --git a/web/src/pages/user-setting/constants.tsx b/web/src/pages/user-setting/constants.tsx index df482c4ef..6c7745546 100644 --- a/web/src/pages/user-setting/constants.tsx +++ b/web/src/pages/user-setting/constants.tsx @@ -6,6 +6,7 @@ import { ProfileIcon, TeamIcon, } from '@/assets/icon/Icon'; +import { LLMFactory } from '@/constants/llm'; import { UserSettingRouteKey } from '@/constants/setting'; import { MonitorOutlined } from '@ant-design/icons'; @@ -22,17 +23,18 @@ export const UserSettingIconMap = { export * from '@/constants/setting'; export const LocalLlmFactories = [ - 'Ollama', - 'Xinference', - 'LocalAI', - 'LM-Studio', - 'OpenAI-API-Compatible', - 'TogetherAI', - 'Replicate', - 'OpenRouter', - 'HuggingFace', - 'GPUStack', - 'ModelScope', + LLMFactory.Ollama, + LLMFactory.Xinference, + LLMFactory.LocalAI, + LLMFactory.LMStudio, + LLMFactory.OpenAiAPICompatible, + LLMFactory.TogetherAI, + LLMFactory.Replicate, + LLMFactory.OpenRouter, + LLMFactory.HuggingFace, + LLMFactory.GPUStack, + LLMFactory.ModelScope, + LLMFactory.VLLM, ]; export enum TenantRole { diff --git a/web/src/pages/user-setting/setting-model/api-key-modal/index.tsx b/web/src/pages/user-setting/setting-model/api-key-modal/index.tsx index a2aabe311..c415a6f03 100644 --- a/web/src/pages/user-setting/setting-model/api-key-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/api-key-modal/index.tsx @@ -1,4 +1,5 @@ import { IModalManagerChildrenProps } from '@/components/modal-manager'; +import { LLMFactory } from '@/constants/llm'; import { useTranslate } from '@/hooks/common-hooks'; import { Form, Input, Modal } from 'antd'; import { useEffect } from 'react'; @@ -18,7 +19,7 @@ type FieldType = { group_id?: string; }; -const modelsWithBaseUrl = ['OpenAI', 'Azure-OpenAI']; +const modelsWithBaseUrl = [LLMFactory.OpenAI, LLMFactory.AzureOpenAI]; const ApiKeyModal = ({ visible, diff --git a/web/src/pages/user-setting/setting-model/index.tsx b/web/src/pages/user-setting/setting-model/index.tsx index 09ca05dba..c9fcd64af 100644 --- a/web/src/pages/user-setting/setting-model/index.tsx +++ b/web/src/pages/user-setting/setting-model/index.tsx @@ -1,6 +1,7 @@ import { ReactComponent as MoreModelIcon } from '@/assets/svg/more-model.svg'; import { LlmIcon } from '@/components/svg-icon'; import { useTheme } from '@/components/theme-provider'; +import { LLMFactory } from '@/constants/llm'; import { useSetModalState, useTranslate } from '@/hooks/common-hooks'; import { LlmItem, useSelectLlmList } from '@/hooks/llm-hooks'; import { CloseCircleOutlined, SettingOutlined } from '@ant-design/icons'; @@ -94,14 +95,14 @@ const ModelCard = ({ item, clickApiKey }: IModelCardProps) => {