mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-26 03:31:24 +08:00
refactor(providers): 将 PROVIDER_CONFIG 重命名为 PROVIDER_URLS 并更新相关引用
This commit is contained in:
parent
e8e80d1337
commit
9b065558ff
@ -659,7 +659,19 @@ export function getProviderLogo(providerId: string) {
|
||||
export const NOT_SUPPORTED_REANK_PROVIDERS = ['ollama']
|
||||
export const ONLY_SUPPORTED_DIMENSION_PROVIDERS = ['ollama', 'infini']
|
||||
|
||||
export const PROVIDER_CONFIG = {
|
||||
type ProviderUrls = {
|
||||
api: {
|
||||
url: string
|
||||
}
|
||||
websites?: {
|
||||
official: string
|
||||
apiKey?: string
|
||||
docs: string
|
||||
models?: string
|
||||
}
|
||||
}
|
||||
|
||||
export const PROVIDER_URLS: Record<SystemProviderId, ProviderUrls> = {
|
||||
ph8: {
|
||||
api: {
|
||||
url: 'https://ph8.co'
|
||||
@ -693,17 +705,6 @@ export const PROVIDER_CONFIG = {
|
||||
models: 'https://platform.openai.com/docs/models'
|
||||
}
|
||||
},
|
||||
o3: {
|
||||
api: {
|
||||
url: 'https://api.o3.fan'
|
||||
},
|
||||
websites: {
|
||||
official: 'https://o3.fan',
|
||||
apiKey: 'https://o3.fan/token',
|
||||
docs: '',
|
||||
models: 'https://o3.fan/info/models/'
|
||||
}
|
||||
},
|
||||
burncloud: {
|
||||
api: {
|
||||
url: 'https://ai.burncloud.com'
|
||||
@ -749,17 +750,6 @@ export const PROVIDER_CONFIG = {
|
||||
models: 'https://cloud.siliconflow.cn/models'
|
||||
}
|
||||
},
|
||||
'gitee-ai': {
|
||||
api: {
|
||||
url: 'https://ai.gitee.com'
|
||||
},
|
||||
websites: {
|
||||
official: 'https://ai.gitee.com/',
|
||||
apiKey: 'https://ai.gitee.com/dashboard/settings/tokens',
|
||||
docs: 'https://ai.gitee.com/docs/openapi/v1#tag/%E6%96%87%E6%9C%AC%E7%94%9F%E6%88%90/POST/chat/completions',
|
||||
models: 'https://ai.gitee.com/serverless-api'
|
||||
}
|
||||
},
|
||||
deepseek: {
|
||||
api: {
|
||||
url: 'https://api.deepseek.com'
|
||||
@ -1081,17 +1071,6 @@ export const PROVIDER_CONFIG = {
|
||||
models: 'https://fireworks.ai/dashboard/models'
|
||||
}
|
||||
},
|
||||
zhinao: {
|
||||
api: {
|
||||
url: 'https://api.360.cn'
|
||||
},
|
||||
websites: {
|
||||
official: 'https://ai.360.com/',
|
||||
apiKey: 'https://ai.360.com/platform/keys',
|
||||
docs: 'https://ai.360.com/platform/docs/overview',
|
||||
models: 'https://ai.360.com/platform/limit'
|
||||
}
|
||||
},
|
||||
hunyuan: {
|
||||
api: {
|
||||
url: 'https://api.hunyuan.cloud.tencent.com'
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { HStack } from '@renderer/components/Layout'
|
||||
import { PROVIDER_CONFIG } from '@renderer/config/providers'
|
||||
import { PROVIDER_URLS } from '@renderer/config/providers'
|
||||
import { useAwsBedrockSettings } from '@renderer/hooks/useAwsBedrock'
|
||||
import { Alert, Input } from 'antd'
|
||||
import { FC, useState } from 'react'
|
||||
@ -12,7 +12,7 @@ const AwsBedrockSettings: FC = () => {
|
||||
const { accessKeyId, secretAccessKey, region, setAccessKeyId, setSecretAccessKey, setRegion } =
|
||||
useAwsBedrockSettings()
|
||||
|
||||
const providerConfig = PROVIDER_CONFIG['aws-bedrock']
|
||||
const providerConfig = PROVIDER_URLS['aws-bedrock']
|
||||
const apiKeyWebsite = providerConfig?.websites?.apiKey
|
||||
|
||||
const [localAccessKeyId, setLocalAccessKeyId] = useState(accessKeyId)
|
||||
|
||||
@ -2,7 +2,7 @@ import CollapsibleSearchBar from '@renderer/components/CollapsibleSearchBar'
|
||||
import CustomTag from '@renderer/components/CustomTag'
|
||||
import { LoadingIcon, StreamlineGoodHealthAndWellBeing } from '@renderer/components/Icons'
|
||||
import { HStack } from '@renderer/components/Layout'
|
||||
import { PROVIDER_CONFIG } from '@renderer/config/providers'
|
||||
import { PROVIDER_URLS } from '@renderer/config/providers'
|
||||
import { useProvider } from '@renderer/hooks/useProvider'
|
||||
import { getProviderLabel } from '@renderer/i18n/label'
|
||||
import { SettingHelpLink, SettingHelpText, SettingHelpTextRow, SettingSubtitle } from '@renderer/pages/settings'
|
||||
@ -47,7 +47,7 @@ const ModelList: React.FC<ModelListProps> = ({ providerId }) => {
|
||||
const { t } = useTranslation()
|
||||
const { provider, models, removeModel } = useProvider(providerId)
|
||||
|
||||
const providerConfig = PROVIDER_CONFIG[provider.id]
|
||||
const providerConfig = PROVIDER_URLS[provider.id]
|
||||
const docsWebsite = providerConfig?.websites?.docs
|
||||
const modelsWebsite = providerConfig?.websites?.models
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import SiliconFlowProviderLogo from '@renderer/assets/images/providers/silicon.p
|
||||
import TokenFluxProviderLogo from '@renderer/assets/images/providers/tokenflux.png'
|
||||
import { HStack } from '@renderer/components/Layout'
|
||||
import OAuthButton from '@renderer/components/OAuth/OAuthButton'
|
||||
import { PROVIDER_CONFIG } from '@renderer/config/providers'
|
||||
import { PROVIDER_URLS } from '@renderer/config/providers'
|
||||
import { useProvider } from '@renderer/hooks/useProvider'
|
||||
import { getProviderLabel } from '@renderer/i18n/label'
|
||||
import { providerBills, providerCharge } from '@renderer/utils/oauth'
|
||||
@ -35,7 +35,7 @@ const ProviderOAuth: FC<Props> = ({ providerId }) => {
|
||||
}
|
||||
|
||||
let providerWebsite =
|
||||
PROVIDER_CONFIG[provider.id]?.api?.url.replace('https://', '').replace('api.', '') || provider.name
|
||||
PROVIDER_URLS[provider.id]?.api?.url.replace('https://', '').replace('api.', '') || provider.name
|
||||
if (provider.id === 'ppio') {
|
||||
providerWebsite = 'ppio.com'
|
||||
}
|
||||
@ -62,7 +62,7 @@ const ProviderOAuth: FC<Props> = ({ providerId }) => {
|
||||
i18nKey="settings.provider.oauth.description"
|
||||
components={{
|
||||
website: (
|
||||
<OfficialWebsite href={PROVIDER_CONFIG[provider.id].websites.official} target="_blank" rel="noreferrer" />
|
||||
<OfficialWebsite href={PROVIDER_URLS[provider.id].websites.official} target="_blank" rel="noreferrer" />
|
||||
)
|
||||
}}
|
||||
values={{ provider: providerWebsite }}
|
||||
|
||||
@ -3,7 +3,7 @@ import { LoadingIcon } from '@renderer/components/Icons'
|
||||
import { HStack } from '@renderer/components/Layout'
|
||||
import { ApiKeyListPopup } from '@renderer/components/Popups/ApiKeyListPopup'
|
||||
import { isEmbeddingModel, isRerankModel } from '@renderer/config/models'
|
||||
import { PROVIDER_CONFIG } from '@renderer/config/providers'
|
||||
import { PROVIDER_URLS } from '@renderer/config/providers'
|
||||
import { useTheme } from '@renderer/context/ThemeProvider'
|
||||
import { useAllProviders, useProvider, useProviders } from '@renderer/hooks/useProvider'
|
||||
import i18n from '@renderer/i18n'
|
||||
@ -57,7 +57,7 @@ const ProviderSetting: FC<Props> = ({ providerId }) => {
|
||||
|
||||
const isDmxapi = provider.id === 'dmxapi'
|
||||
|
||||
const providerConfig = PROVIDER_CONFIG[provider.id]
|
||||
const providerConfig = PROVIDER_URLS[provider.id]
|
||||
const officialWebsite = providerConfig?.websites?.official
|
||||
const apiKeyWebsite = providerConfig?.websites?.apiKey
|
||||
const configedApiHost = providerConfig?.api?.url
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { HStack } from '@renderer/components/Layout'
|
||||
import { PROVIDER_CONFIG } from '@renderer/config/providers'
|
||||
import { PROVIDER_URLS } from '@renderer/config/providers'
|
||||
import { useProvider } from '@renderer/hooks/useProvider'
|
||||
import { useVertexAISettings } from '@renderer/hooks/useVertexAI'
|
||||
import { Alert, Input, Space } from 'antd'
|
||||
@ -30,7 +30,7 @@ const VertexAISettings: FC<Props> = ({ providerId }) => {
|
||||
const { provider, updateProvider } = useProvider(providerId)
|
||||
const [apiHost, setApiHost] = useState(provider.apiHost)
|
||||
|
||||
const providerConfig = PROVIDER_CONFIG['vertexai']
|
||||
const providerConfig = PROVIDER_URLS['vertexai']
|
||||
const apiKeyWebsite = providerConfig?.websites?.apiKey
|
||||
|
||||
const onUpdateApiHost = () => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user