| | |
| | | import type { FC } from 'react' |
| | | import { useState } from 'react' |
| | | import { useTranslation } from 'react-i18next' |
| | | import { RiEqualizer2Line } from '@remixicon/react' |
| | | import ModelSelector from '../model-selector' |
| | | import { |
| | | useModelList, |
| | |
| | | } from '../declarations' |
| | | import { ModelTypeEnum } from '../declarations' |
| | | import Tooltip from '@/app/components/base/tooltip' |
| | | import { Settings01 } from '@/app/components/base/icons/src/vender/line/general' |
| | | import { |
| | | PortalToFollowElem, |
| | | PortalToFollowElemContent, |
| | |
| | | rerankDefaultModel: DefaultModelResponse | undefined |
| | | speech2textDefaultModel: DefaultModelResponse | undefined |
| | | ttsDefaultModel: DefaultModelResponse | undefined |
| | | notConfigured: boolean |
| | | } |
| | | const SystemModel: FC<SystemModelSelectorProps> = ({ |
| | | textGenerationDefaultModel, |
| | |
| | | rerankDefaultModel, |
| | | speech2textDefaultModel, |
| | | ttsDefaultModel, |
| | | notConfigured, |
| | | }) => { |
| | | const { t } = useTranslation() |
| | | const { notify } = useToastContext() |
| | |
| | | }} |
| | | > |
| | | <PortalToFollowElemTrigger onClick={() => setOpen(v => !v)}> |
| | | <Button |
| | | className='relative' |
| | | variant={notConfigured ? 'primary' : 'secondary'} |
| | | size='small' |
| | | > |
| | | <RiEqualizer2Line className='mr-1 h-3.5 w-3.5' /> |
| | | <div className={` |
| | | flex items-center px-2 h-6 text-xs text-gray-700 cursor-pointer bg-white rounded-md border-[0.5px] border-gray-200 shadow-xs |
| | | hover:bg-gray-100 hover:shadow-none |
| | | ${open && 'bg-gray-100 shadow-none'} |
| | | `}> |
| | | <Settings01 className='mr-1 w-3 h-3 text-gray-500' /> |
| | | {t('common.modelProvider.systemModelSettings')} |
| | | </Button> |
| | | </div> |
| | | </PortalToFollowElemTrigger> |
| | | <PortalToFollowElemContent className='z-[60]'> |
| | | <div className='w-[360px] rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg pt-4 shadow-xl'> |
| | | <PortalToFollowElemContent className='z-50'> |
| | | <div className='pt-4 w-[360px] rounded-xl border-[0.5px] border-black/5 bg-white shadow-xl'> |
| | | <div className='px-6 py-1'> |
| | | <div className='flex h-8 items-center text-[13px] font-medium text-text-primary'> |
| | | <div className='flex items-center h-8 text-[13px] font-medium text-gray-900'> |
| | | {t('common.modelProvider.systemReasoningModel.key')} |
| | | <Tooltip |
| | | popupContent={ |
| | | <div className='w-[261px] text-text-tertiary'> |
| | | <div className='w-[261px] text-gray-500'> |
| | | {t('common.modelProvider.systemReasoningModel.tip')} |
| | | </div> |
| | | } |
| | |
| | | </div> |
| | | </div> |
| | | <div className='px-6 py-1'> |
| | | <div className='flex h-8 items-center text-[13px] font-medium text-text-primary'> |
| | | <div className='flex items-center h-8 text-[13px] font-medium text-gray-900'> |
| | | {t('common.modelProvider.embeddingModel.key')} |
| | | <Tooltip |
| | | popupContent={ |
| | | <div className='w-[261px] text-text-tertiary'> |
| | | <div className='w-[261px] text-gray-500'> |
| | | {t('common.modelProvider.embeddingModel.tip')} |
| | | </div> |
| | | } |
| | |
| | | </div> |
| | | </div> |
| | | <div className='px-6 py-1'> |
| | | <div className='flex h-8 items-center text-[13px] font-medium text-text-primary'> |
| | | <div className='flex items-center h-8 text-[13px] font-medium text-gray-900'> |
| | | {t('common.modelProvider.rerankModel.key')} |
| | | <Tooltip |
| | | popupContent={ |
| | | <div className='w-[261px] text-text-tertiary'> |
| | | <div className='w-[261px] text-gray-500'> |
| | | {t('common.modelProvider.rerankModel.tip')} |
| | | </div> |
| | | } |
| | |
| | | </div> |
| | | </div> |
| | | <div className='px-6 py-1'> |
| | | <div className='flex h-8 items-center text-[13px] font-medium text-text-primary'> |
| | | <div className='flex items-center h-8 text-[13px] font-medium text-gray-900'> |
| | | {t('common.modelProvider.speechToTextModel.key')} |
| | | <Tooltip |
| | | popupContent={ |
| | | <div className='w-[261px] text-text-tertiary'> |
| | | <div className='w-[261px] text-gray-500'> |
| | | {t('common.modelProvider.speechToTextModel.tip')} |
| | | </div> |
| | | } |
| | |
| | | </div> |
| | | </div> |
| | | <div className='px-6 py-1'> |
| | | <div className='flex h-8 items-center text-[13px] font-medium text-text-primary'> |
| | | <div className='flex items-center h-8 text-[13px] font-medium text-gray-900'> |
| | | {t('common.modelProvider.ttsModel.key')} |
| | | <Tooltip |
| | | popupContent={ |
| | | <div className='w-[261px] text-text-tertiary'> |
| | | <div className='w-[261px] text-gray-500'> |
| | | {t('common.modelProvider.ttsModel.tip')} |
| | | </div> |
| | | } |