feat(provider): add baichuan provider

This commit is contained in:
kangfenmao 2024-07-17 12:44:01 +08:00
parent 8bff4df722
commit 810c44f7fc
9 changed files with 71 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -340,5 +340,28 @@ export const SYSTEM_MODELS: Record<string, SystemModel[]> = {
group: 'Gemma',
defaultEnabled: false
}
],
baichuan: [
{
id: 'Baichuan4',
provider: 'baichuan',
name: 'Baichuan4',
group: 'Baichuan4',
defaultEnabled: true
},
{
id: 'Baichuan3-Turbo',
provider: 'baichuan',
name: 'Baichuan3 Turbo',
group: 'Baichuan3',
defaultEnabled: true
},
{
id: 'Baichuan3-Turbo-128k',
provider: 'baichuan',
name: 'Baichuan3 Turbo 128k',
group: 'Baichuan3',
defaultEnabled: true
}
]
}

View File

@ -69,5 +69,12 @@ export const PROVIDER_CONFIG = {
docs: 'https://github.com/ollama/ollama/tree/main/docs',
models: 'https://ollama.com/library'
}
},
baichuan: {
websites: {
official: 'https://www.baichuan-ai.com/',
docs: 'https://platform.baichuan-ai.com/docs',
models: 'https://platform.baichuan-ai.com/price'
}
}
}

View File

@ -77,7 +77,8 @@ const resources = {
yi: 'Yi',
zhipu: 'ZHIPU AI',
groq: 'Groq',
ollama: 'Ollama'
ollama: 'Ollama',
baichuan: 'Baichuan'
},
settings: {
title: 'Settings',
@ -191,7 +192,8 @@ const resources = {
yi: '零一万物',
zhipu: '智谱AI',
groq: 'Groq',
ollama: 'Ollama'
ollama: 'Ollama',
baichuan: '百川'
},
settings: {
title: '设置',

View File

@ -7,6 +7,7 @@ import ZhipuProviderLogo from '@renderer/assets/images/providers/zhipu.png'
import OllamaProviderLogo from '@renderer/assets/images/providers/ollama.png'
import MoonshotProviderLogo from '@renderer/assets/images/providers/moonshot.jpeg'
import OpenRouterProviderLogo from '@renderer/assets/images/providers/openrouter.png'
import BaichuanProviderLogo from '@renderer/assets/images/providers/baichuan.png'
import ChatGPTModelLogo from '@renderer/assets/images/models/chatgpt.jpeg'
import ChatGLMModelLogo from '@renderer/assets/images/models/chatglm.jpeg'
import DeepSeekModelLogo from '@renderer/assets/images/models/deepseek.png'
@ -17,6 +18,7 @@ import LlamaModelLogo from '@renderer/assets/images/models/llama.jpeg'
import MixtralModelLogo from '@renderer/assets/images/models/mixtral.jpeg'
import MoonshotModelLogo from '@renderer/assets/images/providers/moonshot.jpeg'
import MicrosoftModelLogo from '@renderer/assets/images/models/microsoft.png'
import BaichuanModelLogo from '@renderer/assets/images/models/baichuan.png'
export function getProviderLogo(providerId: string) {
switch (providerId) {
@ -38,6 +40,8 @@ export function getProviderLogo(providerId: string) {
return MoonshotProviderLogo
case 'openrouter':
return OpenRouterProviderLogo
case 'baichuan':
return BaichuanProviderLogo
default:
return undefined
}
@ -55,7 +59,8 @@ export function getModelLogo(modelId: string) {
mixtral: MixtralModelLogo,
mistral: MixtralModelLogo,
moonshot: MoonshotModelLogo,
phi: MicrosoftModelLogo
phi: MicrosoftModelLogo,
baichuan: BaichuanModelLogo
}
for (const key in logoMap) {

View File

@ -19,7 +19,7 @@ const persistedReducer = persistReducer(
{
key: 'cherry-studio',
storage,
version: 9,
version: 10,
blacklist: ['runtime'],
migrate
},

View File

@ -93,6 +93,15 @@ const initialState: LlmState = {
models: [],
isSystem: true,
enabled: false
},
{
id: 'baichuan',
name: 'BAICHUAN AI',
apiKey: '',
apiHost: 'https://api.baichuan-ai.com',
models: SYSTEM_MODELS.baichuan.filter((m) => m.defaultEnabled),
isSystem: true,
enabled: false
}
]
}

View File

@ -156,6 +156,27 @@ const migrate = createMigrate({
})
}
}
},
// @ts-ignore store type is unknown
'10': (state: RootState) => {
return {
...state,
llm: {
...state.llm,
providers: [
...state.llm.providers,
{
id: 'baichuan',
name: 'BAICHUAN AI',
apiKey: '',
apiHost: 'https://api.baichuan-ai.com',
models: SYSTEM_MODELS.baichuan.filter((m) => m.defaultEnabled),
isSystem: true,
enabled: false
}
]
}
}
}
})