mirror of https://github.com/langgenius/dify.git
feat: auto disable document ui
This commit is contained in:
parent
ae3eae413f
commit
335e57f3c9
|
|
@ -0,0 +1,29 @@
|
|||
'use client'
|
||||
import type { FC } from 'react'
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import StatusWithAction from './status-with-action'
|
||||
|
||||
type Props = {
|
||||
datasetId: string
|
||||
}
|
||||
|
||||
const AutoDisabledDocument: FC<Props> = ({
|
||||
datasetId,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const data = ['', '']
|
||||
const hasDisabledDocument = data.length > 0
|
||||
if (!hasDisabledDocument)
|
||||
return null
|
||||
|
||||
return (
|
||||
<StatusWithAction
|
||||
type='info'
|
||||
description={t('dataset.documentsDisabled', { num: data.length })}
|
||||
actionText={t('dataset.enable')}
|
||||
onAction={() => { }}
|
||||
/>
|
||||
)
|
||||
}
|
||||
export default React.memo(AutoDisabledDocument)
|
||||
|
|
@ -8,6 +8,7 @@ import { useDebounce, useDebounceFn } from 'ahooks'
|
|||
import { groupBy, omit } from 'lodash-es'
|
||||
import { PlusIcon } from '@heroicons/react/24/solid'
|
||||
import { RiExternalLinkLine } from '@remixicon/react'
|
||||
import AutoDisabledDocument from '../common/document-status-with-action/auto-disabled-document'
|
||||
import List from './list'
|
||||
import s from './style.module.css'
|
||||
import Loading from '@/app/components/base/loading'
|
||||
|
|
@ -231,6 +232,7 @@ const Documents: FC<IDocumentsProps> = ({ datasetId }) => {
|
|||
onClear={() => handleInputChange('')}
|
||||
/>
|
||||
<div className='flex gap-2 justify-center items-center !h-8'>
|
||||
<AutoDisabledDocument datasetId={datasetId} />
|
||||
<IndexFailed datasetId={datasetId} />
|
||||
{embeddingAvailable && (
|
||||
<Button variant='primary' onClick={routeToDocCreate} className='shrink-0'>
|
||||
|
|
|
|||
|
|
@ -119,8 +119,10 @@ const translation = {
|
|||
change: 'Change',
|
||||
changeRetrievalMethod: 'Change retrieval method',
|
||||
},
|
||||
docsFailedNotice: 'documents failed to be indexed',
|
||||
docsFailedNotice: 'documents indexed failed',
|
||||
retry: 'Retry',
|
||||
documentsDisabled: '{{num}} documents disabled - inactive for over 30 days',
|
||||
enable: 'Enable',
|
||||
indexingTechnique: {
|
||||
high_quality: 'HQ',
|
||||
economy: 'ECO',
|
||||
|
|
|
|||
Loading…
Reference in New Issue