mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-10 07:19:02 +08:00
feat(baichuan):add baichuan models (#12364)
Co-authored-by: roberto <roberto@baichuan-inc.com>
This commit is contained in:
parent
8223c9fbfd
commit
008df2d4b7
@ -1368,7 +1368,9 @@ describe('findTokenLimit', () => {
|
|||||||
{ modelId: 'qwen-plus-ultra', expected: { min: 0, max: 81_920 } },
|
{ modelId: 'qwen-plus-ultra', expected: { min: 0, max: 81_920 } },
|
||||||
{ modelId: 'qwen-turbo-pro', expected: { min: 0, max: 38_912 } },
|
{ modelId: 'qwen-turbo-pro', expected: { min: 0, max: 38_912 } },
|
||||||
{ modelId: 'qwen-flash-lite', expected: { min: 0, max: 81_920 } },
|
{ modelId: 'qwen-flash-lite', expected: { min: 0, max: 81_920 } },
|
||||||
{ modelId: 'qwen3-7b', expected: { min: 1_024, max: 38_912 } }
|
{ modelId: 'qwen3-7b', expected: { min: 1_024, max: 38_912 } },
|
||||||
|
{ modelId: 'Baichuan-M2', expected: { min: 0, max: 30_000 } },
|
||||||
|
{ modelId: 'baichuan-m2', expected: { min: 0, max: 30_000 } }
|
||||||
]
|
]
|
||||||
|
|
||||||
it.each(cases)('returns correct limits for $modelId', ({ modelId, expected }) => {
|
it.each(cases)('returns correct limits for $modelId', ({ modelId, expected }) => {
|
||||||
|
|||||||
@ -713,6 +713,30 @@ export const SYSTEM_MODELS: Record<SystemProviderId | 'defaultModel', Model[]> =
|
|||||||
provider: 'baichuan',
|
provider: 'baichuan',
|
||||||
name: 'Baichuan3 Turbo 128k',
|
name: 'Baichuan3 Turbo 128k',
|
||||||
group: 'Baichuan3'
|
group: 'Baichuan3'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'Baichuan4-Turbo',
|
||||||
|
provider: 'baichuan',
|
||||||
|
name: 'Baichuan4 Turbo',
|
||||||
|
group: 'Baichuan4'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'Baichuan4-Air',
|
||||||
|
provider: 'baichuan',
|
||||||
|
name: 'Baichuan4 Air',
|
||||||
|
group: 'Baichuan4'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'Baichuan-M2',
|
||||||
|
provider: 'baichuan',
|
||||||
|
name: 'Baichuan M2',
|
||||||
|
group: 'Baichuan-M2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'Baichuan-M2-Plus',
|
||||||
|
provider: 'baichuan',
|
||||||
|
name: 'Baichuan M2 Plus',
|
||||||
|
group: 'Baichuan-M2'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
modelscope: [
|
modelscope: [
|
||||||
|
|||||||
@ -640,6 +640,16 @@ export const isMiniMaxReasoningModel = (model?: Model): boolean => {
|
|||||||
return (['minimax-m1', 'minimax-m2', 'minimax-m2.1'] as const).some((id) => modelId.includes(id))
|
return (['minimax-m1', 'minimax-m2', 'minimax-m2.1'] as const).some((id) => modelId.includes(id))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const isBaichuanReasoningModel = (model?: Model): boolean => {
|
||||||
|
if (!model) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const modelId = getLowerBaseModelName(model.id, '/')
|
||||||
|
|
||||||
|
// 只有 Baichuan-M2 是推理模型(注意:M2-Plus 不是推理模型)
|
||||||
|
return modelId.includes('baichuan-m2') && !modelId.includes('plus')
|
||||||
|
}
|
||||||
|
|
||||||
export function isReasoningModel(model?: Model): boolean {
|
export function isReasoningModel(model?: Model): boolean {
|
||||||
if (!model || isEmbeddingModel(model) || isRerankModel(model) || isTextToImageModel(model)) {
|
if (!model || isEmbeddingModel(model) || isRerankModel(model) || isTextToImageModel(model)) {
|
||||||
return false
|
return false
|
||||||
@ -675,6 +685,7 @@ export function isReasoningModel(model?: Model): boolean {
|
|||||||
isLingReasoningModel(model) ||
|
isLingReasoningModel(model) ||
|
||||||
isMiniMaxReasoningModel(model) ||
|
isMiniMaxReasoningModel(model) ||
|
||||||
isMiMoReasoningModel(model) ||
|
isMiMoReasoningModel(model) ||
|
||||||
|
isBaichuanReasoningModel(model) ||
|
||||||
modelId.includes('magistral') ||
|
modelId.includes('magistral') ||
|
||||||
modelId.includes('pangu-pro-moe') ||
|
modelId.includes('pangu-pro-moe') ||
|
||||||
modelId.includes('seed-oss') ||
|
modelId.includes('seed-oss') ||
|
||||||
@ -718,7 +729,10 @@ const THINKING_TOKEN_MAP: Record<string, { min: number; max: number }> = {
|
|||||||
'(?:anthropic\\.)?claude-opus-4(?:[.-]0)?(?:[@-](?:\\d{4,}|[a-z][\\w-]*))?(?:-v\\d+:\\d+)?$': {
|
'(?:anthropic\\.)?claude-opus-4(?:[.-]0)?(?:[@-](?:\\d{4,}|[a-z][\\w-]*))?(?:-v\\d+:\\d+)?$': {
|
||||||
min: 1024,
|
min: 1024,
|
||||||
max: 32_000
|
max: 32_000
|
||||||
}
|
},
|
||||||
|
|
||||||
|
// Baichuan models
|
||||||
|
'baichuan-m2$': { min: 0, max: 30_000 }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const findTokenLimit = (modelId: string): { min: number; max: number } | undefined => {
|
export const findTokenLimit = (modelId: string): { min: number; max: number } | undefined => {
|
||||||
|
|||||||
@ -1025,7 +1025,7 @@ export const PROVIDER_URLS: Record<SystemProviderId, ProviderUrls> = {
|
|||||||
official: 'https://www.baichuan-ai.com/',
|
official: 'https://www.baichuan-ai.com/',
|
||||||
apiKey: 'https://platform.baichuan-ai.com/console/apikey',
|
apiKey: 'https://platform.baichuan-ai.com/console/apikey',
|
||||||
docs: 'https://platform.baichuan-ai.com/docs',
|
docs: 'https://platform.baichuan-ai.com/docs',
|
||||||
models: 'https://platform.baichuan-ai.com/price'
|
models: 'https://platform.baichuan-ai.com/prices'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modelscope: {
|
modelscope: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user