From 335e57f3c904b6d1f20bf18a5f4b2b82b57a1272 Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 10 Dec 2024 11:43:31 +0800 Subject: [PATCH 1/3] feat: auto disable document ui --- .../auto-disabled-document.tsx | 29 +++++++++++++++++++ .../components/datasets/documents/index.tsx | 2 ++ web/i18n/en-US/dataset.ts | 4 ++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 web/app/components/datasets/common/document-status-with-action/auto-disabled-document.tsx diff --git a/web/app/components/datasets/common/document-status-with-action/auto-disabled-document.tsx b/web/app/components/datasets/common/document-status-with-action/auto-disabled-document.tsx new file mode 100644 index 0000000000..150fa00fb9 --- /dev/null +++ b/web/app/components/datasets/common/document-status-with-action/auto-disabled-document.tsx @@ -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 = ({ + datasetId, +}) => { + const { t } = useTranslation() + const data = ['', ''] + const hasDisabledDocument = data.length > 0 + if (!hasDisabledDocument) + return null + + return ( + { }} + /> + ) +} +export default React.memo(AutoDisabledDocument) diff --git a/web/app/components/datasets/documents/index.tsx b/web/app/components/datasets/documents/index.tsx index 84e7191179..b30aea1ee0 100644 --- a/web/app/components/datasets/documents/index.tsx +++ b/web/app/components/datasets/documents/index.tsx @@ -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 = ({ datasetId }) => { onClear={() => handleInputChange('')} />
+ {embeddingAvailable && (