({ collectionId }: { collectionId: string })
| 17 | import ClipboardJS from 'clipboard'; |
| 18 | import { useTranslation } from 'react-i18next'; |
| 19 | function ChunkPage({ collectionId }: { collectionId: string }) { |
| 20 | const { t } = useTranslation(); |
| 21 | const { tooltipEditTitle, tooltipDeleteTitle } = tooltipTitle(); |
| 22 | const handleCopy = (text: string) => { |
| 23 | const clipboard = new ClipboardJS('.icon-copy', { |
| 24 | text: () => text |
| 25 | }); |
| 26 | clipboard.on('success', function () { |
| 27 | toast.success(`${t('CopiedToClipboard')}`) |
| 28 | clipboard.destroy() |
| 29 | }); |
| 30 | clipboard.on('error', function (e) { |
| 31 | console.log(e); |
| 32 | }); |
| 33 | } |
| 34 | const columns = [ |
| 35 | { |
| 36 | title: `${t('projectModelID')}`, |
| 37 | dataIndex: 'chunk_id', |
| 38 | key: 'chunk_id', |
| 39 | width: 240, |
| 40 | fixed: 'left', |
| 41 | render: (text: string) => |
| 42 | <div style={{ display: 'flex', alignItems: 'center', margin: 0 }}> |
| 43 | <span style={{ fontSize: '12px', color: '#777' }}>{text}</span><CopyOutlined className='icon-copy' onClick={() => handleCopy(text)} /> |
| 44 | </div> |
| 45 | , |
| 46 | }, |
| 47 | { |
| 48 | title: `${t('projectChunkColumnContent')}`, |
| 49 | width: 480, |
| 50 | dataIndex: 'content', |
| 51 | key: 'content', |
| 52 | ellipsis: true, |
| 53 | render: (text: any) => ( |
| 54 | <Tooltip title={text} placement='bottom'><span style={{ maxWidth: '480px', overflow: 'hidden', display: 'inline-block' }}>{text}</span></Tooltip> |
| 55 | ), |
| 56 | }, |
| 57 | { |
| 58 | title: t('record'), |
| 59 | dataIndex: 'record_id', |
| 60 | key: 'record_id', |
| 61 | width: 180, |
| 62 | render: (text: string) => ( |
| 63 | <div> |
| 64 | {text} |
| 65 | </div> |
| 66 | ) |
| 67 | }, |
| 68 | { |
| 69 | title: `# ${t('projectChunkColumnTokens')}`, |
| 70 | dataIndex: 'num_tokens', |
| 71 | key: 'num_tokens', |
| 72 | width: 180, |
| 73 | render: (text: string) => ( |
| 74 | <div> |
| 75 | {text} |
| 76 | </div> |
nothing calls this directly
no test coverage detected