Skip to content

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

Fix: Dataset file configuration: switching from "pipeline" to "built-in" also triggers an exclamation mark warning. (#22010)

balibabu8622f62d77b2
diff --git a/web/src/components/document-pipeline-dialog/index.tsx b/web/src/components/document-pipeline-dialog/index.tsx
index 85beac4ac7..c2c64a226a 100644
--- a/web/src/components/document-pipeline-dialog/index.tsx
+++ b/web/src/components/document-pipeline-dialog/index.tsx
@@ -29,7 +29,7 @@ import { ParseType } from '@/constants/knowledge';
import { IModalProps } from '@/interfaces/common';
import { IChangeParserRequestBody } from '@/interfaces/request/document';
import { useCallback } from 'react';
-import { FieldErrors, useFormState, useWatch } from 'react-hook-form';
+import { FieldErrors, useFormState } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import { useParserSelectHandler } from '@/hooks/use-parser-select-handler';
import {
@@ -67,7 +67,7 @@ export function DocumentPipelineDialog({
operatorValues,
showOperatorTabs,
buildSubmitData,
- latestVersionId,
+ versionOutdated,
parserOptionMissing,
} = useDocumentPipelineForm({
parserId,
@@ -78,17 +78,9 @@ export function DocumentPipelineDialog({
const handleParserSelect = useParserSelectHandler(form);
- const selectedVersionId = useWatch({
- control: form.control,
- name: 'pipeline_version_id',
- });
-
- // Outdated = pinned to a non-latest version. A pinned version that was
- // deleted entirely is covered by the select's missing display plus the
- // parserOptionMissing guard below, so no separate Missing banner lives here.
- const versionOutdated =
- !!selectedVersionId && selectedVersionId !== latestVersionId;
-
+ // A pinned version that was deleted entirely is covered by the select's
+ // missing display plus the parserOptionMissing guard below, so no separate
+ // Missing banner lives here.
const onSubmit = useCallback(
async (data: Parameters<typeof buildSubmitData>[0]) => {
// A deleted pinned version/parser never reaches the backend; the
diff --git a/web/src/components/document-pipeline-dialog/use-document-pipeline-form.test.tsx b/web/src/components/document-pipeline-dialog/use-document-pipeline-form.test.tsx
index 69aa3b94e4..b1bc7ee925 100644
--- a/web/src/components/document-pipeline-dialog/use-document-pipeline-form.test.tsx
+++ b/web/src/components/document-pipeline-dialog/use-document-pipeline-form.test.tsx
@@ -100,3 +100,43 @@ describe('useDocumentPipelineForm pipeline_version_id default (design S8: never
expect(result.current.form.getValues('pipeline_version_id')).toBe('v3');
});
});
+
+describe('useDocumentPipelineForm versionOutdated', () => {
+ beforeEach(() => {
+ mockVersions = [];
+ });
+
+ it('is true when the pinned version differs from the latest (Pipeline mode)', () => {
+ mockVersions = [{ id: 'v2', version: 2, name: 'v2' }];
+ const { result } = renderForm({
+ parserId: 'naive',
+ pipelineId: 'canvas-1',
+ pipelineVersionId: 'v1',
+ });
+ expect(result.current.versionOutdated).toBe(true);
+ });
+
+ it('is false when the pinned version is the latest (Pipeline mode)', () => {
+ mockVersions = [{ id: 'v2', version: 2, name: 'v2' }];
+ const { result } = renderForm({
+ parserId: 'naive',
+ pipelineId: 'canvas-1',
+ pipelineVersionId: 'v2',
+ });
+ expect(result.current.versionOutdated).toBe(false);
+ });
+
+ it('is false in BuiltIn mode even when a stale pin survives in the form', () => {
+ // A pipeline→builtin switch clears pipeline_id but the backend keeps
+ // pipeline_version_id, so a reopened dialog seeds the stale pin; the bang
+ // must not show beside a builtin parser.
+ mockVersions = [{ id: 'v2', version: 2, name: 'v2' }];
+ const { result } = renderForm({
+ parserId: 'naive',
+ pipelineId: undefined,
+ pipelineVersionId: 'v1',
+ });
+ expect(result.current.form.getValues('pipeline_version_id')).toBe('v1');
+ expect(result.current.versionOutdated).toBe(false);
+ });
+});
diff --git a/web/src/components/document-pipeline-dialog/use-document-pipeline-form.ts b/web/src/components/document-pipeline-dialog/use-document-pipeline-form.ts
index 3d1a867c61..3478657269 100644
--- a/web/src/components/document-pipeline-dialog/use-document-pipeline-form.ts
+++ b/web/src/components/document-pipeline-dialog/use-document-pipeline-form.ts
@@ -152,6 +152,16 @@ export function useDocumentPipelineForm({
isPipelineMode ? selectedDataFlowId : undefined,
);
const latestVersionId = versions[0]?.id;
+ // Outdated = pinned to a non-latest version, shown as a hint bang on the
+ // parser select. Gated on Pipeline mode: a BuiltIn selection carries no
+ // live version binding, yet a stale pin can sit in the form (the backend
+ // clears pipeline_id but keeps pipeline_version_id after a pipeline→builtin
+ // switch) while the version list is not even fetched, so an ungated check
+ // would flag every builtin parser holding a stale pin.
+ const versionOutdated =
+ isPipelineMode &&
+ !!selectedVersionId &&
+ selectedVersionId !== latestVersionId;
// The saved parser_config only belongs to the pipeline (and parse type) it
// was saved with — expose its id only while that exact pipeline is selected,
// so that after switching, defaults come purely from the new pipeline's DSL.
@@ -263,7 +273,7 @@ export function useDocumentPipelineForm({
operatorValues,
showOperatorTabs,
buildSubmitData,
- latestVersionId,
+ versionOutdated,
parserOptionMissing,
};
}