()
| 13 | import WildCardIcon from '@/assets/img/wildcard.svg?react' |
| 14 | import RerankIcon from '@/assets/img/rerankIcon.svg?react' |
| 15 | function CommonComponents() { |
| 16 | const { t } = useTranslation() |
| 17 | const statusReverse = { |
| 18 | creating: 'orange', |
| 19 | ready: 'green', |
| 20 | error: 'red', |
| 21 | deleting: 'red', |
| 22 | Inviting: 'orange', |
| 23 | Active: 'green', |
| 24 | Rejected: 'red' |
| 25 | } |
| 26 | const typeIcon = { |
| 27 | chat_completion: <ChatCompletionIcon />, |
| 28 | text_embedding: <TextEmbeddingIcon />, |
| 29 | wildcard: <WildCardIcon />, |
| 30 | rerank: <RerankIcon/> |
| 31 | } |
| 32 | const reverseLabel: Record<string, any> = { |
| 33 | naive: 'Naive', |
| 34 | zero: 'Zero', |
| 35 | [`message_window`]: 'Message Window', |
| 36 | } |
| 37 | const handleCopy = (text: string) => { |
| 38 | const clipboard = new ClipboardJS('.icon-copy', { |
| 39 | text: () => text |
| 40 | }); |
| 41 | clipboard.on('success', function () { |
| 42 | toast.success('Copied to clipboard') |
| 43 | clipboard.destroy() |
| 44 | }); |
| 45 | clipboard.on('error', function (e) { |
| 46 | console.log(e); |
| 47 | }); |
| 48 | } |
| 49 | |
| 50 | |
| 51 | const typeReverse: Record<string, string> = { |
| 52 | instruct_completion: 'Instruct Completion', |
| 53 | chat_completion: 'Chat Completion', |
| 54 | text_embedding: 'Text Embedding' |
| 55 | } |
| 56 | const modelsTableColumn: any = [ |
| 57 | { |
| 58 | title: `${t('projectModelColumnName')}`, |
| 59 | dataIndex: 'name', |
| 60 | key: 'name', |
| 61 | fixed: 'left', |
| 62 | width: 240, |
| 63 | render: (text: string, record: any) => |
| 64 | <div> |
| 65 | <p className='table-text' style={{ fontSize: '14px' }}>{text || 'Untitled Model'}</p> |
| 66 | <p style={{ display: 'flex', alignItems: 'center', margin: 0, lineHeight: '18px' }}> |
| 67 | <span style={{ fontSize: '12px', color: '#777', lineHeight: '18px' }}>{record.model_id}</span><CopyOutlined className='icon-copy' onClick={() => handleCopy(record.model_id)} /> |
| 68 | </p> |
| 69 | </div> |
| 70 | , |
| 71 | }, |
| 72 | { |
no test coverage detected