Skip to content

Commit

Permalink
merge feat/model-provider-based-on-runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
zxhlyh committed Jan 2, 2024
2 parents 80149ab + ed6e99b commit 53837db
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ const ModelModal: FC<ModelModalProps> = ({
{
showConfirm && (
<ConfirmCommon
title='Are you sure?'
title={t('common.modelProvider.confirmDelete')}
isShow={showConfirm}
onCancel={() => setShowConfirm(false)}
onConfirm={handleRemove}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const PopupItem: FC<PopupItemProps> = ({
showFeatures
/>
{
defaultModel?.model === modelItem.model && (
defaultModel?.model === modelItem.model && defaultModel.provider === currentProvider.provider && (
<Check className='shrink-0 w-4 h-4 text-primary-600' />
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { ChevronDownDouble } from '@/app/components/base/icons/src/vender/line/a
import { Loading02 } from '@/app/components/base/icons/src/vender/line/general'
import { fetchModelProviderModelList } from '@/service/common'
import { useEventEmitterContextContext } from '@/context/event-emitter'
import { IS_CE_EDITION } from '@/config'

export const UPDATE_MODEL_PROVIDER_CUSTOM_MODEL_LIST = 'UPDATE_MODEL_PROVIDER_CUSTOM_MODEL_LIST'
type ProviderAddedCardProps = {
Expand All @@ -40,7 +41,7 @@ const ProviderAddedCard: FC<ProviderAddedCardProps> = ({
const configurateMethods = provider.configurate_methods.filter(method => method !== ConfigurateMethodEnum.fetchFromRemote)
const systemConfig = provider.system_configuration
const hasModelList = fetched && !!modelList.length
const showQuota = systemConfig.enabled || ['minimax', 'spark', 'zhipuai', 'anthropic'].includes(provider.provider)
const showQuota = systemConfig.enabled && ['minimax', 'spark', 'zhipuai', 'anthropic'].includes(provider.provider) && !IS_CE_EDITION

const getModelList = async (providerName: string) => {
if (loading)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import s from './index.module.css'
import { Plus, Settings01 } from '@/app/components/base/icons/src/vender/line/general'
import { CoinsStacked01 } from '@/app/components/base/icons/src/vender/line/financeAndECommerce'
import Button from '@/app/components/base/button'
import { IS_CE_EDITION } from '@/config'

type ProviderCardProps = {
provider: ModelProvider
Expand Down Expand Up @@ -54,7 +55,7 @@ const ProviderCard: FC<ProviderCardProps> = ({
}
const handleFreeQuota = useFreeQuota(handleFreeQuotaSuccess)
const configurateMethods = provider.configurate_methods.filter(method => method !== ConfigurateMethodEnum.fetchFromRemote)
const canGetFreeQuota = ['mininmax', 'spark', 'zhipuai'].includes(provider.provider)
const canGetFreeQuota = ['mininmax', 'spark', 'zhipuai'].includes(provider.provider) && !IS_CE_EDITION

return (
<div
Expand Down Expand Up @@ -135,7 +136,7 @@ const ProviderCard: FC<ProviderCardProps> = ({
})
}
{
provider.provider === 'anthropic' && (
provider.provider === 'anthropic' && !IS_CE_EDITION && (
<Button
className='h-7 text-xs text-gray-700'
onClick={handlePay}
Expand Down
1 change: 1 addition & 0 deletions web/i18n/lang/common.en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ const translation = {
getFreeTokens: 'Get free Tokens',
priorityUsing: 'Prioritize using',
deprecated: 'Deprecated',
confirmDelete: 'confirm deletion?',
},
dataSource: {
add: 'Add a data source',
Expand Down
1 change: 1 addition & 0 deletions web/i18n/lang/common.zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ const translation = {
getFreeTokens: '获得免费 Tokens',
priorityUsing: '优先使用',
deprecated: '已弃用',
confirmDelete: '确认删除?',
},
dataSource: {
add: '添加数据源',
Expand Down

0 comments on commit 53837db

Please sign in to comment.