mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-02 10:29:02 +08:00
chore: remove cherryin provider references and update versioning
- Commented out all references to the 'cherryin' provider in configuration files. - Updated the version in the persisted reducer from 157 to 158. - Added migration logic to remove 'cherryin' from the state during version 158 migration.
This commit is contained in:
parent
c6dc1810e9
commit
8d041438fd
@ -25,7 +25,7 @@ export const SYSTEM_MODELS: Record<SystemProviderId | 'defaultModel', Model[]> =
|
||||
// Default quick assistant model
|
||||
glm45FlashModel
|
||||
],
|
||||
cherryin: [],
|
||||
// cherryin: [],
|
||||
vertexai: [],
|
||||
'302ai': [
|
||||
{
|
||||
|
||||
@ -78,16 +78,16 @@ export const CHERRYAI_PROVIDER: SystemProvider = {
|
||||
}
|
||||
|
||||
export const SYSTEM_PROVIDERS_CONFIG: Record<SystemProviderId, SystemProvider> = {
|
||||
cherryin: {
|
||||
id: 'cherryin',
|
||||
name: 'CherryIN',
|
||||
type: 'openai',
|
||||
apiKey: '',
|
||||
apiHost: 'https://open.cherryin.ai',
|
||||
models: [],
|
||||
isSystem: true,
|
||||
enabled: true
|
||||
},
|
||||
// cherryin: {
|
||||
// id: 'cherryin',
|
||||
// name: 'CherryIN',
|
||||
// type: 'openai',
|
||||
// apiKey: '',
|
||||
// apiHost: 'https://open.cherryin.ai',
|
||||
// models: [],
|
||||
// isSystem: true,
|
||||
// enabled: true
|
||||
// },
|
||||
silicon: {
|
||||
id: 'silicon',
|
||||
name: 'Silicon',
|
||||
@ -708,17 +708,17 @@ type ProviderUrls = {
|
||||
}
|
||||
|
||||
export const PROVIDER_URLS: Record<SystemProviderId, ProviderUrls> = {
|
||||
cherryin: {
|
||||
api: {
|
||||
url: 'https://open.cherryin.ai'
|
||||
},
|
||||
websites: {
|
||||
official: 'https://open.cherryin.ai',
|
||||
apiKey: 'https://open.cherryin.ai/console/token',
|
||||
docs: 'https://open.cherryin.ai',
|
||||
models: 'https://open.cherryin.ai/pricing'
|
||||
}
|
||||
},
|
||||
// cherryin: {
|
||||
// api: {
|
||||
// url: 'https://open.cherryin.ai'
|
||||
// },
|
||||
// websites: {
|
||||
// official: 'https://open.cherryin.ai',
|
||||
// apiKey: 'https://open.cherryin.ai/console/token',
|
||||
// docs: 'https://open.cherryin.ai',
|
||||
// models: 'https://open.cherryin.ai/pricing'
|
||||
// }
|
||||
// },
|
||||
ph8: {
|
||||
api: {
|
||||
url: 'https://ph8.co'
|
||||
|
||||
@ -2544,6 +2544,15 @@ const migrateConfig = {
|
||||
}
|
||||
},
|
||||
'158': (state: RootState) => {
|
||||
try {
|
||||
state.llm.providers = state.llm.providers.filter((provider) => provider.id !== 'cherryin')
|
||||
return state
|
||||
} catch (error) {
|
||||
logger.error('migrate 158 error', error as Error)
|
||||
return state
|
||||
}
|
||||
},
|
||||
'159': (state: RootState) => {
|
||||
try {
|
||||
// @ts-ignore
|
||||
if (state?.agents?.agents) {
|
||||
|
||||
@ -223,6 +223,159 @@ export type User = {
|
||||
email: string
|
||||
}
|
||||
|
||||
// undefined 视为支持,默认支持
|
||||
export type ProviderApiOptions = {
|
||||
/** 是否不支持 message 的 content 为数组类型 */
|
||||
isNotSupportArrayContent?: boolean
|
||||
/** 是否不支持 stream_options 参数 */
|
||||
isNotSupportStreamOptions?: boolean
|
||||
/**
|
||||
* @deprecated
|
||||
* 是否不支持 message 的 role 为 developer */
|
||||
isNotSupportDeveloperRole?: boolean
|
||||
/* 是否支持 message 的 role 为 developer */
|
||||
isSupportDeveloperRole?: boolean
|
||||
/**
|
||||
* @deprecated
|
||||
* 是否不支持 service_tier 参数. Only for OpenAI Models. */
|
||||
isNotSupportServiceTier?: boolean
|
||||
/* 是否支持 service_tier 参数. Only for OpenAI Models. */
|
||||
isSupportServiceTier?: boolean
|
||||
/** 是否不支持 enable_thinking 参数 */
|
||||
isNotSupportEnableThinking?: boolean
|
||||
}
|
||||
|
||||
export type Provider = {
|
||||
id: string
|
||||
type: ProviderType
|
||||
name: string
|
||||
apiKey: string
|
||||
apiHost: string
|
||||
apiVersion?: string
|
||||
models: Model[]
|
||||
enabled?: boolean
|
||||
isSystem?: boolean
|
||||
isAuthed?: boolean
|
||||
rateLimit?: number
|
||||
|
||||
// API options
|
||||
apiOptions?: ProviderApiOptions
|
||||
serviceTier?: ServiceTier
|
||||
|
||||
/** @deprecated */
|
||||
isNotSupportArrayContent?: boolean
|
||||
/** @deprecated */
|
||||
isNotSupportStreamOptions?: boolean
|
||||
/** @deprecated */
|
||||
isNotSupportDeveloperRole?: boolean
|
||||
/** @deprecated */
|
||||
isNotSupportServiceTier?: boolean
|
||||
|
||||
authType?: 'apiKey' | 'oauth'
|
||||
isVertex?: boolean
|
||||
notes?: string
|
||||
extra_headers?: Record<string, string>
|
||||
}
|
||||
|
||||
export const SystemProviderIds = {
|
||||
// cherryin: 'cherryin',
|
||||
silicon: 'silicon',
|
||||
aihubmix: 'aihubmix',
|
||||
ocoolai: 'ocoolai',
|
||||
deepseek: 'deepseek',
|
||||
ppio: 'ppio',
|
||||
alayanew: 'alayanew',
|
||||
qiniu: 'qiniu',
|
||||
dmxapi: 'dmxapi',
|
||||
burncloud: 'burncloud',
|
||||
tokenflux: 'tokenflux',
|
||||
'302ai': '302ai',
|
||||
cephalon: 'cephalon',
|
||||
lanyun: 'lanyun',
|
||||
ph8: 'ph8',
|
||||
openrouter: 'openrouter',
|
||||
ollama: 'ollama',
|
||||
'new-api': 'new-api',
|
||||
lmstudio: 'lmstudio',
|
||||
anthropic: 'anthropic',
|
||||
openai: 'openai',
|
||||
'azure-openai': 'azure-openai',
|
||||
gemini: 'gemini',
|
||||
vertexai: 'vertexai',
|
||||
github: 'github',
|
||||
copilot: 'copilot',
|
||||
zhipu: 'zhipu',
|
||||
yi: 'yi',
|
||||
moonshot: 'moonshot',
|
||||
baichuan: 'baichuan',
|
||||
dashscope: 'dashscope',
|
||||
stepfun: 'stepfun',
|
||||
doubao: 'doubao',
|
||||
infini: 'infini',
|
||||
minimax: 'minimax',
|
||||
groq: 'groq',
|
||||
together: 'together',
|
||||
fireworks: 'fireworks',
|
||||
nvidia: 'nvidia',
|
||||
grok: 'grok',
|
||||
hyperbolic: 'hyperbolic',
|
||||
mistral: 'mistral',
|
||||
jina: 'jina',
|
||||
perplexity: 'perplexity',
|
||||
modelscope: 'modelscope',
|
||||
xirang: 'xirang',
|
||||
hunyuan: 'hunyuan',
|
||||
'tencent-cloud-ti': 'tencent-cloud-ti',
|
||||
'baidu-cloud': 'baidu-cloud',
|
||||
gpustack: 'gpustack',
|
||||
voyageai: 'voyageai',
|
||||
'aws-bedrock': 'aws-bedrock',
|
||||
poe: 'poe',
|
||||
aionly: 'aionly'
|
||||
} as const
|
||||
|
||||
export type SystemProviderId = keyof typeof SystemProviderIds
|
||||
|
||||
export const isSystemProviderId = (id: string): id is SystemProviderId => {
|
||||
return Object.hasOwn(SystemProviderIds, id)
|
||||
}
|
||||
|
||||
export type SystemProvider = Provider & {
|
||||
id: SystemProviderId
|
||||
isSystem: true
|
||||
apiOptions?: never
|
||||
}
|
||||
|
||||
export type VertexProvider = Provider & {
|
||||
googleCredentials: {
|
||||
privateKey: string
|
||||
clientEmail: string
|
||||
}
|
||||
project: string
|
||||
location: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为系统内置的提供商。比直接使用`provider.isSystem`更好,因为该数据字段不会随着版本更新而变化。
|
||||
* @param provider - Provider对象,包含提供商的信息
|
||||
* @returns 是否为系统内置提供商
|
||||
*/
|
||||
export const isSystemProvider = (provider: Provider): provider is SystemProvider => {
|
||||
return isSystemProviderId(provider.id) && !!provider.isSystem
|
||||
}
|
||||
|
||||
export type ProviderType =
|
||||
| 'openai'
|
||||
| 'openai-response'
|
||||
| 'anthropic'
|
||||
| 'gemini'
|
||||
| 'qwenlm'
|
||||
| 'azure-openai'
|
||||
| 'vertexai'
|
||||
| 'mistral'
|
||||
| 'aws-bedrock'
|
||||
| 'vertex-anthropic'
|
||||
|
||||
export type ModelType = 'text' | 'vision' | 'embedding' | 'reasoning' | 'function_calling' | 'web_search' | 'rerank'
|
||||
|
||||
export type ModelTag = Exclude<ModelType, 'text'> | 'free'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user