| | |
| | | import { AlertTriangle } from '@/app/components/base/icons/src/vender/line/alertsAndFeedback' |
| | | import { useProviderContext } from '@/context/provider-context' |
| | | import Tooltip from '@/app/components/base/tooltip' |
| | | import cn from '@/utils/classnames' |
| | | |
| | | type ModelTriggerProps = { |
| | | modelName: string |
| | | providerName: string |
| | | className?: string |
| | | showWarnIcon?: boolean |
| | | contentClassName?: string |
| | | } |
| | | const ModelTrigger: FC<ModelTriggerProps> = ({ |
| | | modelName, |
| | | providerName, |
| | | className, |
| | | showWarnIcon, |
| | | contentClassName, |
| | | }) => { |
| | | const { t } = useTranslation() |
| | | const { modelProviders } = useProviderContext() |
| | |
| | | |
| | | return ( |
| | | <div |
| | | className={cn('group box-content flex h-8 grow cursor-pointer items-center gap-1 rounded-lg bg-components-input-bg-disabled p-[3px] pl-1', className)} |
| | | className={` |
| | | group flex items-center px-2 h-8 rounded-lg bg-[#FFFAEB] cursor-pointer |
| | | ${className} |
| | | `} |
| | | > |
| | | <div className={cn('flex w-full items-center', contentClassName)}> |
| | | <div className='flex min-w-0 flex-1 items-center gap-1 py-[1px]'> |
| | | <ModelIcon |
| | | className="h-4 w-4" |
| | | className='shrink-0 mr-1.5' |
| | | provider={currentProvider} |
| | | modelName={modelName} |
| | | /> |
| | | <div className='system-sm-regular truncate text-components-input-text-filled'> |
| | | <div className='mr-1 text-[13px] font-medium text-gray-800 truncate'> |
| | | {modelName} |
| | | </div> |
| | | </div> |
| | | <div className='flex shrink-0 items-center justify-center'> |
| | | {showWarnIcon && ( |
| | | <div className='shrink-0 flex items-center justify-center w-4 h-4'> |
| | | <Tooltip popupContent={t('common.modelProvider.deprecated')}> |
| | | <AlertTriangle className='h-4 w-4 text-text-warning-secondary' /> |
| | | <AlertTriangle className='w-4 h-4 text-[#F79009]' /> |
| | | </Tooltip> |
| | | )} |
| | | </div> |
| | | </div> |
| | | </div> |
| | | ) |