fix: dataset not has type create btn ui problem

This commit is contained in:
Joel 2024-09-03 11:05:32 +08:00
parent a8b9e01b3e
commit 0a9a0c75eb

View File

@ -20,6 +20,7 @@ import type { NotionPage } from '@/models/common'
import type { CreateDocumentReq } from '@/models/datasets'
import { DataSourceType } from '@/models/datasets'
import RetryButton from '@/app/components/base/retry-button'
import cn from '@/utils/classnames'
// Custom page count is not currently supported.
const limit = 15
@ -211,10 +212,14 @@ const Documents: FC<IDocumentsProps> = ({ datasetId }) => {
<RetryButton datasetId={datasetId} />
{embeddingAvailable && (
<Button variant='primary' onClick={routeToDocCreate} className='shrink-0'>
<PlusIcon className='h-4 w-4 mr-2 stroke-current' />
<PlusIcon className={cn('h-4 w-4 stroke-current', dataset?.data_source_type && 'mr-2')} />
{dataset?.data_source_type && (
<>
{isDataSourceNotion && t('datasetDocuments.list.addPages')}
{isDataSourceWeb && t('datasetDocuments.list.addUrl')}
{isDataSourceFile && t('datasetDocuments.list.addFile')}
</>
)}
</Button>
)}
</div>