|
|
|
|
@ -2,6 +2,7 @@ import type { FC } from 'react'
|
|
|
|
|
import { useState } from 'react'
|
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
|
import {
|
|
|
|
|
RiArrowRightSLine,
|
|
|
|
|
RiLoader2Line,
|
|
|
|
|
} from '@remixicon/react'
|
|
|
|
|
import type {
|
|
|
|
|
@ -21,7 +22,6 @@ import CredentialPanel from './credential-panel'
|
|
|
|
|
import QuotaPanel from './quota-panel'
|
|
|
|
|
import ModelList from './model-list'
|
|
|
|
|
import AddModelButton from './add-model-button'
|
|
|
|
|
import { ChevronDownDouble } from '@/app/components/base/icons/src/vender/line/arrows'
|
|
|
|
|
import { fetchModelProviderModelList } from '@/service/common'
|
|
|
|
|
import { useEventEmitterContextContext } from '@/context/event-emitter'
|
|
|
|
|
import { IS_CE_EDITION } from '@/config'
|
|
|
|
|
@ -116,23 +116,24 @@ const ProviderAddedCard: FC<ProviderAddedCardProps> = ({
|
|
|
|
|
{
|
|
|
|
|
collapsed && (
|
|
|
|
|
<div className='group flex items-center justify-between pl-2 py-1.5 pr-[11px] border-t border-t-black/5 bg-white/30 text-xs font-medium text-gray-500'>
|
|
|
|
|
<div className='group-hover:hidden pl-1 pr-1.5 h-6 leading-6'>
|
|
|
|
|
<div className='group-hover:hidden flex items-center pl-1 pr-1.5 h-6 leading-6'>
|
|
|
|
|
{
|
|
|
|
|
hasModelList
|
|
|
|
|
? t('common.modelProvider.modelsNum', { num: modelList.length })
|
|
|
|
|
: t('common.modelProvider.showModels')
|
|
|
|
|
}
|
|
|
|
|
{!loading && <RiArrowRightSLine className='w-4 h-4' />}
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
className='hidden group-hover:flex items-center pl-1 pr-1.5 h-6 rounded-lg hover:bg-white cursor-pointer'
|
|
|
|
|
onClick={handleOpenModelList}
|
|
|
|
|
>
|
|
|
|
|
<ChevronDownDouble className='mr-0.5 w-3 h-3' />
|
|
|
|
|
{
|
|
|
|
|
hasModelList
|
|
|
|
|
? t('common.modelProvider.showModelsNum', { num: modelList.length })
|
|
|
|
|
: t('common.modelProvider.showModels')
|
|
|
|
|
}
|
|
|
|
|
{!loading && <RiArrowRightSLine className='w-4 h-4' />}
|
|
|
|
|
{
|
|
|
|
|
loading && (
|
|
|
|
|
<RiLoader2Line className='ml-0.5 animate-spin w-3 h-3' />
|
|
|
|
|
@ -143,7 +144,7 @@ const ProviderAddedCard: FC<ProviderAddedCardProps> = ({
|
|
|
|
|
configurationMethods.includes(ConfigurationMethodEnum.customizableModel) && isCurrentWorkspaceManager && (
|
|
|
|
|
<AddModelButton
|
|
|
|
|
onClick={() => onOpenModal(ConfigurationMethodEnum.customizableModel)}
|
|
|
|
|
className='hidden group-hover:flex group-hover:text-primary-600'
|
|
|
|
|
className='flex'
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|