From d1452d4af4ec2d41e90f7f3db68ae81bfdc4e280 Mon Sep 17 00:00:00 2001 From: JzoNg Date: Fri, 11 Oct 2024 13:04:57 +0800 Subject: [PATCH] no provider installed --- .../model-provider-page/index.tsx | 48 +++++++++++-------- web/i18n/en-US/common.ts | 6 +++ web/i18n/zh-Hans/common.ts | 6 +++ 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/web/app/components/header/account-setting/model-provider-page/index.tsx b/web/app/components/header/account-setting/model-provider-page/index.tsx index 8862b0029b..744e8b8daa 100644 --- a/web/app/components/header/account-setting/model-provider-page/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/index.tsx @@ -1,6 +1,6 @@ import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { RiAlertFill } from '@remixicon/react' +import { RiAlertFill, RiBrainLine } from '@remixicon/react' import SystemModelSelector from './system-model-selector' import ProviderAddedCard, { UPDATE_MODEL_PROVIDER_CUSTOM_MODEL_LIST } from './provider-added-card' import ProviderCard from './provider-card' @@ -58,25 +58,25 @@ const ModelProviderPage = () => { const handleOpenModal = ( provider: ModelProvider, - configurateMethod: ConfigurationMethodEnum, + configurationMethod: ConfigurationMethodEnum, CustomConfigurationModelFixedFields?: CustomConfigurationModelFixedFields, ) => { setShowModelModal({ payload: { currentProvider: provider, - currentConfigurationMethod: configurateMethod, + currentConfigurationMethod: configurationMethod, currentCustomConfigurationModelFixedFields: CustomConfigurationModelFixedFields, }, onSaveCallback: () => { updateModelProviders() - if (configurateMethod === ConfigurationMethodEnum.predefinedModel) { + if (configurationMethod === ConfigurationMethodEnum.predefinedModel) { provider.supported_model_types.forEach((type) => { updateModelList(type) }) } - if (configurateMethod === ConfigurationMethodEnum.customizableModel && provider.custom_configuration.status === CustomConfigurationStatusEnum.active) { + if (configurationMethod === ConfigurationMethodEnum.customizableModel && provider.custom_configuration.status === CustomConfigurationStatusEnum.active) { eventEmitter?.emit({ type: UPDATE_MODEL_PROVIDER_CUSTOM_MODEL_LIST, payload: provider.provider, @@ -114,21 +114,29 @@ const ModelProviderPage = () => { /> - { - !!configuredProviders?.length && ( -
- { - configuredProviders?.map(provider => ( - handleOpenModal(provider, configurateMethod, currentCustomConfigurationModelFixedFields)} - /> - )) - } + {!configuredProviders?.length && ( +
+
+
- ) - } +
{t('common.modelProvider.emptyProviderTitle')}
+
{t('common.modelProvider.emptyProviderTip')}
+
+ )} + {!!configuredProviders?.length && ( +
+ {configuredProviders?.map(provider => ( + handleOpenModal(provider, configurationMethod, currentCustomConfigurationModelFixedFields)} + /> + ))} +
+ )} +
{t('common.modelProvider.configureRequired')}
+
{t('common.modelProvider.installProvider')}
+
{t('common.modelProvider.discoverMore')}
{ !!notConfiguredProviders?.length && ( <> @@ -142,7 +150,7 @@ const ModelProviderPage = () => { handleOpenModal(provider, configurateMethod)} + onOpenModal={(configurationMethod: ConfigurationMethodEnum) => handleOpenModal(provider, configurationMethod)} /> )) } diff --git a/web/i18n/en-US/common.ts b/web/i18n/en-US/common.ts index 3bdeb7cec9..11db6f7359 100644 --- a/web/i18n/en-US/common.ts +++ b/web/i18n/en-US/common.ts @@ -374,6 +374,12 @@ const translation = { loadBalancingLeastKeyWarning: 'To enable load balancing at least 2 keys must be enabled.', loadBalancingInfo: 'By default, load balancing uses the Round-robin strategy. If rate limiting is triggered, a 1-minute cooldown period will be applied.', upgradeForLoadBalancing: 'Upgrade your plan to enable Load Balancing.', + configureRequired: 'Configure required', + configureTip: 'Set up api-key or add model to use', + installProvider: 'Install model providers', + discoverMore: 'Discover more in', + emptyProviderTitle: 'Model provider not set up', + emptyProviderTip: 'Please install a model provider first.', }, dataSource: { add: 'Add a data source', diff --git a/web/i18n/zh-Hans/common.ts b/web/i18n/zh-Hans/common.ts index f80afe8fca..17edc3a958 100644 --- a/web/i18n/zh-Hans/common.ts +++ b/web/i18n/zh-Hans/common.ts @@ -374,6 +374,12 @@ const translation = { loadBalancingInfo: '默认情况下,负载平衡使用 Round-robin 策略。如果触发速率限制,将应用 1 分钟的冷却时间', upgradeForLoadBalancing: '升级以解锁负载均衡功能', apiKey: 'API 密钥', + configureRequired: '尚未配置', + configureTip: '请配置 API 密钥,添加模型。', + installProvider: '安装模型供应商', + discoverMore: '发现更多就在', + emptyProviderTitle: '尚未安装模型供应商', + emptyProviderTip: '请安装模型供应商。', }, dataSource: { add: '添加数据源',