|
@@ -9,7 +9,7 @@ import DocumentPicker from '../../common/document-picker'
|
|
|
import Completed from './completed'
|
|
|
import Embedding from './embedding'
|
|
|
import Metadata from '@/app/components/datasets/metadata/metadata-document'
|
|
|
-import { ProcessStatus } from './segment-add'
|
|
|
+import SegmentAdd, { ProcessStatus } from './segment-add'
|
|
|
import BatchModal from './batch-modal'
|
|
|
import style from './style.module.css'
|
|
|
import cn from '@/utils/classnames'
|
|
@@ -23,6 +23,8 @@ import { LayoutRight2LineMod } from '@/app/components/base/icons/src/public/know
|
|
|
import { useCheckSegmentBatchImportProgress, useChildSegmentListKey, useSegmentBatchImport, useSegmentListKey } from '@/service/knowledge/use-segment'
|
|
|
import { useDocumentDetail, useDocumentMetadata, useInvalidDocumentList } from '@/service/knowledge/use-document'
|
|
|
import { useInvalid } from '@/service/use-base'
|
|
|
+import Divider from '@/app/components/base/divider'
|
|
|
+import { GetDatasetAuth } from '@/app/(commonLayout)/datasets/Container'
|
|
|
|
|
|
type DocumentContextValue = {
|
|
|
datasetId?: string
|
|
@@ -83,6 +85,11 @@ const DocumentDetail: FC<Props> = ({ datasetId, documentId }) => {
|
|
|
|
|
|
const { notify } = useContext(ToastContext)
|
|
|
const { dataset } = useDatasetDetailContext()
|
|
|
+ const { isCreate, isEdit, isOperation } = GetDatasetAuth(dataset)
|
|
|
+ if (!isOperation) {
|
|
|
+ notify({ type: 'warning', message: '暂无权限!' })
|
|
|
+ router.replace(`/datasets/${datasetId}/documents`)
|
|
|
+ }
|
|
|
const embeddingAvailable = !!dataset?.embedding_available
|
|
|
const [showMetadata, setShowMetadata] = useState(!isMobile)
|
|
|
const [newSegmentModalVisible, setNewSegmentModalVisible] = useState(false)
|
|
@@ -203,18 +210,18 @@ const DocumentDetail: FC<Props> = ({ datasetId, documentId }) => {
|
|
|
processMode={mode}
|
|
|
/>
|
|
|
<div className='flex flex-wrap items-center'>
|
|
|
- {/* {embeddingAvailable && documentDetail && !documentDetail.archived && !isFullDocMode && ( */}
|
|
|
- {/* <> */}
|
|
|
- {/* <SegmentAdd */}
|
|
|
- {/* importStatus={importStatus} */}
|
|
|
- {/* clearProcessStatus={resetProcessStatus} */}
|
|
|
- {/* showNewSegmentModal={showNewSegmentModal} */}
|
|
|
- {/* showBatchModal={showBatchModal} */}
|
|
|
- {/* embedding={embedding} */}
|
|
|
- {/* /> */}
|
|
|
- {/* <Divider type='vertical' className='!mx-3 !h-[14px] !bg-divider-regular' /> */}
|
|
|
- {/* </> */}
|
|
|
- {/* )} */}
|
|
|
+ {embeddingAvailable && documentDetail && !documentDetail.archived && !isFullDocMode && (
|
|
|
+ <>
|
|
|
+ <SegmentAdd
|
|
|
+ importStatus={importStatus}
|
|
|
+ clearProcessStatus={resetProcessStatus}
|
|
|
+ showNewSegmentModal={showNewSegmentModal}
|
|
|
+ showBatchModal={showBatchModal}
|
|
|
+ embedding={embedding}
|
|
|
+ />
|
|
|
+ <Divider type='vertical' className='!mx-3 !h-[14px] !bg-divider-regular' />
|
|
|
+ </>
|
|
|
+ )}
|
|
|
{/* <StatusItem */}
|
|
|
{/* status={documentDetail?.display_status || 'available'} */}
|
|
|
{/* scene='detail' */}
|