Skip to content

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

Fix: The 'image' parsing method has been configured, but uploading images still results in an error. (#19667)

balibabu760556375e46
diff --git a/web/src/pages/agent/form/parser-form/utils.test.ts b/web/src/pages/agent/form/parser-form/utils.test.ts
index a2df564e93..984036b62e 100644
--- a/web/src/pages/agent/form/parser-form/utils.test.ts
+++ b/web/src/pages/agent/form/parser-form/utils.test.ts
@@ -1,35 +1,8 @@
-import { ParseDocumentType } from '@/components/layout-recognize-form-field';
import { ModelTypeToField } from '@/constants/llm';
-import {
- FileType,
- ImageParseMethod,
- initialParserValues,
-} from '../../constant/pipeline';
-import {
- buildInitialParserSetup,
- buildInitialParserValues,
- isStaticParseMethod,
-} from './utils';
+import { FileType, initialParserValues } from '../../constant/pipeline';
+import { buildInitialParserSetup, buildInitialParserValues } from './utils';
describe('parser-form utils', () => {
- describe('isStaticParseMethod', () => {
- it('recognizes the static parse methods', () => {
- expect(isStaticParseMethod(ImageParseMethod.OCR)).toBe(true);
- expect(isStaticParseMethod(ParseDocumentType.DeepDOC)).toBe(true);
- expect(isStaticParseMethod(ParseDocumentType.PlainText)).toBe(true);
- expect(isStaticParseMethod(ParseDocumentType.Docling)).toBe(true);
- expect(isStaticParseMethod(ParseDocumentType.OpenDataLoader)).toBe(true);
- expect(isStaticParseMethod(ParseDocumentType.TCADPParser)).toBe(true);
- });
-
- it('treats LLM model ids and empty values as non-static', () => {
- expect(isStaticParseMethod('gpt-4o@OpenAI')).toBe(false);
- expect(isStaticParseMethod('')).toBe(false);
- expect(isStaticParseMethod(undefined)).toBe(false);
- expect(isStaticParseMethod(null)).toBe(false);
- });
- });
-
describe('buildInitialParserSetup', () => {
it('returns a deep copy of the default setup', () => {
const setup = buildInitialParserSetup(FileType.PDF, {});
diff --git a/web/src/pages/agent/form/parser-form/utils.ts b/web/src/pages/agent/form/parser-form/utils.ts
index 06b4311739..b1aa6bb4d3 100644
--- a/web/src/pages/agent/form/parser-form/utils.ts
+++ b/web/src/pages/agent/form/parser-form/utils.ts
@@ -1,9 +1,7 @@
-import { ParseDocumentType } from '@/components/layout-recognize-form-field';
import { cloneDeep } from 'lodash';
import {
FileType,
FileTypeDefaultModelFieldMap,
- ImageParseMethod,
initialParserValues,
} from '../../constant/pipeline';
@@ -11,24 +9,6 @@ export function buildFieldNameWithPrefix(name: string, prefix: string) {
return `${prefix}.${name}`;
}
-// Static parse-method values across all file types. LLM model ids from the
-// model tree are never in this set, so `isStaticParseMethod` can tell a
-// built-in method apart from a user-picked model.
-// Note: ParseDocumentType is a const enum — list members explicitly instead of
-// Object.values, which is not allowed on const enums (TS2475).
-const KnownStaticParseMethods = new Set<string>([
- ParseDocumentType.DeepDOC,
- ParseDocumentType.PlainText,
- ParseDocumentType.Docling,
- ParseDocumentType.OpenDataLoader,
- ParseDocumentType.TCADPParser,
- ImageParseMethod.OCR,
-]);
-
-export function isStaticParseMethod(value: unknown): value is string {
- return typeof value === 'string' && KnownStaticParseMethods.has(value);
-}
-
// Builds the default setup for a file type being added to the parser form,
// prefilling the tenant default model for types that have one (video/audio).
export function buildInitialParserSetup(
diff --git a/web/src/pages/dataset/dataset/utils.test.ts b/web/src/pages/dataset/dataset/utils.test.ts
index 0f9dba7bcf..83832380ac 100644
--- a/web/src/pages/dataset/dataset/utils.test.ts
+++ b/web/src/pages/dataset/dataset/utils.test.ts
@@ -212,19 +212,16 @@ describe('findMissingParserModel', () => {
});
});
- it('flags image when parse_method is a static method like ocr', () => {
- // The default image setup uses ocr — no vision model configured
- expect(findMissingParserModel(FileType.Image, DefaultSetups)).toEqual({
- fileType: FileType.Image,
- modelKind: 'vision',
- });
- });
-
- it('passes image when parse_method is a vision model', () => {
- const setups = [
- { fileFormat: FileType.Image, parse_method: 'gpt-4o@OpenAI' },
- ];
- expect(findMissingParserModel(FileType.Image, setups)).toBeNull();
+ it('never flags image — ocr-only parsing needs no model', () => {
+ // The image parser always runs OCR; the vision model (picked as
+ // parse_method) is an optional supplement, so neither ocr nor a model
+ // id constitutes a gap.
+ expect(findMissingParserModel(FileType.Image, DefaultSetups)).toBeNull();
+ expect(
+ findMissingParserModel(FileType.Image, [
+ { fileFormat: FileType.Image, parse_method: 'gpt-4o@OpenAI' },
+ ]),
+ ).toBeNull();
});
it('ignores file types without model requirements', () => {
@@ -241,7 +238,6 @@ describe('findFilesMissingParserModels', () => {
);
expect(gaps).toEqual([
{ name: 'song.mp3', fileType: FileType.Audio, modelKind: 'asr' },
- { name: 'photo.jpg', fileType: FileType.Image, modelKind: 'vision' },
]);
});
});
diff --git a/web/src/pages/dataset/dataset/utils.ts b/web/src/pages/dataset/dataset/utils.ts
index 77924c8907..89334692af 100644
--- a/web/src/pages/dataset/dataset/utils.ts
+++ b/web/src/pages/dataset/dataset/utils.ts
@@ -6,7 +6,6 @@ import {
FileTypeSuffixMap,
initialParserValues,
} from '@/pages/agent/constant/pipeline';
-import { isStaticParseMethod } from '@/pages/agent/form/parser-form/utils';
import { pickByBackend } from '@/utils/backend-variant';
import { getExtension } from '@/utils/document-util';
import {
@@ -160,10 +159,13 @@ export const isDocumentProcessing = (
});
// --- Parser model prerequisite checks -------------------------------------
-// Audio/video/image files can only be parsed when the matching model is
-// configured on the dataset's Parser operator. The tenant default is
-// deliberately not consulted: parsing reads the operator setup, so a global
-// default does not make the file parsable.
+// Audio/video files can only be parsed when the matching model is configured
+// on the dataset's Parser operator. The tenant default is deliberately not
+// consulted: parsing reads the operator setup, so a global default does not
+// make the file parsable. Image files are exempt: the image parser always
+// runs OCR and only supplements it with the vision model (picked as the
+// image parse_method, with the tenant default as fallback), so a static
+// method like ocr is a complete configuration.
// These helpers power the upload warning and the parse-click validation.
export type ParserModelGap = {
@@ -238,13 +240,6 @@ export function findMissingParserModel(
const configured = setup?.vlm?.llm_id;
return configured ? null : { fileType, modelKind: 'vision' };
}
- case FileType.Image: {
- // The image parser's vision model is picked as parse_method; a static
- // method (e.g. ocr) means no vision model is configured.
- const configured =
- !!setup?.parse_method && !isStaticParseMethod(setup.parse_method);
- return configured ? null : { fileType, modelKind: 'vision' };
- }
default:
return null;
}