Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Revert "fix(web): restore auto-metadata checkbox in reparse dialog (#21346)" (#21601)

chanx2d37184d5b0d
diff --git a/web/src/pages/dataset/dataset/parsing-status-cell.test.tsx b/web/src/pages/dataset/dataset/parsing-status-cell.test.tsx
index 0f2722ab0e..0427b502ed 100644
--- a/web/src/pages/dataset/dataset/parsing-status-cell.test.tsx
+++ b/web/src/pages/dataset/dataset/parsing-status-cell.test.tsx
@@ -182,7 +182,7 @@ describe('ParsingStatusCell', () => {
renderCell({
ingestion_status: IngestionTaskStatus.COMPLETED,
chunk_count: 0,
- parser_config: {},
+ parser_config: { enable_metadata: true },
});
fireEvent.click(screen.getByTestId('document-parse-toggle'));
@@ -191,34 +191,6 @@ describe('ParsingStatusCell', () => {
expect(mockShowReparseDialog).not.toHaveBeenCalled();
});
- it('asks for confirmation on a chunkless document when auto-metadata can be applied', () => {
- renderCell({
- ingestion_status: IngestionTaskStatus.COMPLETED,
- chunk_count: 0,
- parser_config: { enable_metadata: true },
- });
-
- fireEvent.click(screen.getByTestId('document-parse-toggle'));
-
- expect(mockShowReparseDialog).toHaveBeenCalledTimes(1);
- expect(mockRunDocumentByIds).not.toHaveBeenCalled();
- });
-
- it('detects auto-metadata in the pipeline parser config shape', () => {
- renderCell({
- ingestion_status: IngestionTaskStatus.COMPLETED,
- chunk_count: 0,
- parser_config: {
- 'Extractor:AutoExtractDefault': { metadata: { enabled: true } },
- },
- });
-
- fireEvent.click(screen.getByTestId('document-parse-toggle'));
-
- expect(mockShowReparseDialog).toHaveBeenCalledTimes(1);
- expect(mockRunDocumentByIds).not.toHaveBeenCalled();
- });
-
// The outdated bang (design D1/D2/D3) lives in the parser dropdown button,
// so it is covered here against ParseDropdownButton.
function renderDropdown(overrides: Record<string, any> = {}) {
diff --git a/web/src/pages/dataset/dataset/parsing-status-cell.tsx b/web/src/pages/dataset/dataset/parsing-status-cell.tsx
index e38fd8aa2d..4563eba986 100644
--- a/web/src/pages/dataset/dataset/parsing-status-cell.tsx
+++ b/web/src/pages/dataset/dataset/parsing-status-cell.tsx
@@ -27,7 +27,6 @@ import { useHandleRunDocumentByIds } from './use-run-document';
import {
getDocumentParserLabel,
getDocumentRunningStatus,
- isAutoMetadataEnabled,
isDocumentProcessing,
isDocumentStopping,
} from './utils';
@@ -143,12 +142,10 @@ export function ParsingStatusCell({
handleRunDocumentByIds(record, isRunning, option);
};
- const autoMetadataEnabled = isAutoMetadataEnabled(record?.parser_config);
-
- // The confirmation only offers real choices when there are existing chunks to
- // drop or auto-metadata to re-apply. Otherwise, and always when cancelling a
- // run, the action fires straight away.
- const needsParseConfirm = !isRunning && (!isZeroChunk || autoMetadataEnabled);
+ // Existing chunks are always dropped server-side on re-ingest, so the
+ // confirmation is only needed when there are existing chunks; otherwise, and
+ // always when cancelling a run, the action fires straight away.
+ const needsParseConfirm = !isRunning && !isZeroChunk;
const handleParseClick = () => {
if (needsParseConfirm) {
@@ -272,8 +269,6 @@ export function ParsingStatusCell({
)}
{reparseDialogVisible && (
<ReparseDialog
- chunk_num={chunk_count}
- enable_metadata={autoMetadataEnabled}
handleOperationIconClick={handleOperationIconClick}
visible={reparseDialogVisible}
hideModal={hideReparseDialogModal}
diff --git a/web/src/pages/dataset/dataset/reparse-dialog.tsx b/web/src/pages/dataset/dataset/reparse-dialog.tsx
index 5816d597dd..665136121b 100644
--- a/web/src/pages/dataset/dataset/reparse-dialog.tsx
+++ b/web/src/pages/dataset/dataset/reparse-dialog.tsx
@@ -1,71 +1,31 @@
import { ConfirmDeleteDialog } from '@/components/confirm-delete-dialog';
-import {
- DynamicForm,
- DynamicFormRef,
- FormFieldConfig,
- FormFieldType,
-} from '@/components/dynamic-form';
-import { Checkbox } from '@/components/ui/checkbox';
+import { DynamicForm, DynamicFormRef } from '@/components/dynamic-form';
import { DialogProps } from '@radix-ui/react-dialog';
-import { memo, useCallback, useEffect, useRef, useState } from 'react';
-import { ControllerRenderProps } from 'react-hook-form';
+import { memo, useCallback, useRef } from 'react';
import { useTranslation } from 'react-i18next';
export const ReparseDialog = memo(
({
handleOperationIconClick,
- chunk_num,
- enable_metadata = false,
visible = true,
hideModal,
}: DialogProps & {
- chunk_num: number;
handleOperationIconClick: (options?: {
delete: boolean;
apply_kb: boolean;
}) => void;
- enable_metadata?: boolean;
visible: boolean;
hideModal: () => void;
}) => {
- const [defaultValues, setDefaultValues] = useState<any>(null);
- const [fields, setFields] = useState<FormFieldConfig[]>([]);
const { t } = useTranslation();
- useEffect(() => {
- // delete has no checkbox in this dialog; seed it so the payload keeps
- // dropping existing chunks (the backend skips re-parse when delete is
- // false and the previous task completed).
- setDefaultValues({
- delete: true,
- apply_kb: false,
- });
- const applyKBField = {
- name: 'apply_kb',
- label: '',
- type: FormFieldType.Checkbox,
- defaultValue: false,
- render: (fieldProps: ControllerRenderProps) => (
- <div className="flex items-center text-text-secondary p-5 border border-border-button rounded-lg">
- <Checkbox
- {...fieldProps}
- checked={fieldProps.value}
- onCheckedChange={(checked: boolean) => {
- fieldProps.onChange(checked);
- }}
- />
- <span className="ml-2">
- {t('knowledgeDetails.applyAutoMetadataSettings')}
- </span>
- </div>
- ),
- };
- if (enable_metadata) {
- setFields([applyKBField]);
- } else {
- setFields([]);
- }
- }, [t, enable_metadata]);
+ // Existing chunks are always dropped on re-ingest, so the dialog only
+ // needs a plain confirmation with no checkboxes. Seed delete: true so the
+ // click payload keeps the drop behavior.
+ const defaultValues = {
+ delete: true,
+ apply_kb: false,
+ };
const formCallbackRef = useRef<DynamicFormRef>(null);
@@ -100,11 +60,7 @@ export const ReparseDialog = memo(
open={visible}
okButtonText={t('common.confirm')}
content={{
- title: t(
- chunk_num > 0
- ? `knowledgeDetails.clearChunksReparseTip`
- : `knowledgeDetails.parseFileTip`,
- ),
+ title: t(`knowledgeDetails.clearChunksReparseTip`),
node: (
<div>
<DynamicForm.Root
@@ -112,7 +68,7 @@ export const ReparseDialog = memo(
console.log('submit', data);
}}
ref={formCallbackRef}
- fields={fields}
+ fields={[]}
defaultValues={defaultValues}
></DynamicForm.Root>
</div>
diff --git a/web/src/pages/dataset/dataset/utils.ts b/web/src/pages/dataset/dataset/utils.ts
index 086accac4a..05057233dc 100644
--- a/web/src/pages/dataset/dataset/utils.ts
+++ b/web/src/pages/dataset/dataset/utils.ts
@@ -421,39 +421,6 @@ export function getSavedParserConfig(
};
}
-/**
- * Whether auto-metadata generation is switched on for the config a document
- * actually runs with. Accepts both shapes a document row can carry: the
- * pipeline shape (an Extractor operator node whose `metadata` group owns the
- * enabled flag, matching transformExtractorConfigToForm's precedence) and the
- * legacy flat shape (a top-level `enable_metadata`).
- */
-export function isAutoMetadataEnabled(
- parserConfig: Record<string, any> | undefined,
-): boolean {
- if (!parserConfig) {
- return false;
- }
- const extractor = Object.entries(parserConfig).find(
- ([operatorId]) => getOperatorType(operatorId) === Operator.Extractor,
- )?.[1];
- if (extractor) {
- const group =
- extractor.metadata !== undefined && !Array.isArray(extractor.metadata)
- ? extractor.metadata
- : extractor.metadata_config;
- if (group?.enabled !== undefined) {
- return Boolean(group.enabled);
- }
- return (
- extractor.enable_metadata === 1 || extractor.enable_metadata === true
- );
- }
- return (
- parserConfig.enable_metadata === 1 || parserConfig.enable_metadata === true
- );
-}
-
export function findParserGap(
fileType: FileType | undefined,
config: SavedParserConfig,