mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-02-06 19:11:09 +08:00
fix: Handle :cloud suffix in getLowerBaseModelName for Ollama models (#12633)
* refactor: Add support for removing :cloud suffix in model names * test: Add test for removing trailing :cloud from model name
This commit is contained in:
parent
ec5bac9d43
commit
6bf3e5506f
@ -225,6 +225,9 @@ describe('naming', () => {
|
||||
it('should remove trailing (free)', () => {
|
||||
expect(getLowerBaseModelName('agent/gpt-4(free)')).toBe('gpt-4')
|
||||
})
|
||||
it('should remove trailing :cloud', () => {
|
||||
expect(getLowerBaseModelName('local/kimi-k2.5:cloud')).toBe('kimi-k2.5')
|
||||
})
|
||||
})
|
||||
|
||||
describe('getFirstCharacter', () => {
|
||||
|
||||
@ -74,14 +74,19 @@ export const getBaseModelName = (id: string, delimiter: string = '/'): string =>
|
||||
* @returns {string} 小写的基础名称
|
||||
*/
|
||||
export const getLowerBaseModelName = (id: string, delimiter: string = '/'): string => {
|
||||
const baseModelName = getBaseModelName(id, delimiter).toLowerCase()
|
||||
let baseModelName = getBaseModelName(id, delimiter).toLowerCase()
|
||||
// Remove suffix
|
||||
// for openrouter
|
||||
if (baseModelName.endsWith(':free')) {
|
||||
return baseModelName.replace(':free', '')
|
||||
baseModelName = baseModelName.replace(':free', '')
|
||||
}
|
||||
// for cherryin
|
||||
if (baseModelName.endsWith('(free)')) {
|
||||
return baseModelName.replace('(free)', '')
|
||||
baseModelName = baseModelName.replace('(free)', '')
|
||||
}
|
||||
// for ollama
|
||||
if (baseModelName.endsWith(':cloud')) {
|
||||
baseModelName = baseModelName.replace(':cloud', '')
|
||||
}
|
||||
return baseModelName
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user