Skip to content

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

fix(ingestion): migrate composite PaddleOCR layout selectors (#21236)

jay77721ac6876d9e424
diff --git a/internal/dao/ingestion_parser_config_migration.go b/internal/dao/ingestion_parser_config_migration.go
index 0f2b0c97bc..0630165877 100644
--- a/internal/dao/ingestion_parser_config_migration.go
+++ b/internal/dao/ingestion_parser_config_migration.go
@@ -602,10 +602,18 @@ func convertIngestionLayoutRecognize(raw any, config map[string]any, target buil
row.retire("layout_recognize", "the targeted pipeline has no PDF file family")
return nil
}
- // These OCR selectors cannot be resolved by the Go ingestion dispatcher.
- // Preserve them by stopping rather than sending them to generic VLM chat.
switch ingestionModelReferenceEngine(trimmed) {
- case "mistral ocr", "somark", "opendataloader", "paddleocr":
+ case "paddleocr":
+ // The runtime PaddleOCR branch matches the provider spelling and
+ // resolves the tenant's PaddleOCR OCR model; the composite's model
+ // and instance segments are not dispatch selectors there. Store the
+ // engine name that branch reads instead of failing the migration.
+ writes.setSetup(target.parserNode, "pdf", "parse_method", "paddleocr")
+ return nil
+ case "mistral ocr", "somark", "opendataloader":
+ // These OCR selectors cannot be resolved by the Go ingestion
+ // dispatcher. Preserve them by stopping rather than sending them to
+ // generic VLM chat.
return fmt.Errorf("layout_recognize %q has no supported Go model-reference dispatch", trimmed)
}
// Keep supported OCR and VLM model references whole.
diff --git a/internal/dao/ingestion_parser_config_migration_test.go b/internal/dao/ingestion_parser_config_migration_test.go
index 34849ec583..4624675226 100644
--- a/internal/dao/ingestion_parser_config_migration_test.go
+++ b/internal/dao/ingestion_parser_config_migration_test.go
@@ -39,6 +39,7 @@ func TestMigrateParserChunkerTokenizerConfig(t *testing.T) {
{name: "tcadp result options follow the engine", parser: "table", input: `{"layout_recognize":"TCADP Parser","table_result_type":"2","markdown_image_response_type":"2"}`, want: `{"Parser:HipSignsRhyme":{"spreadsheet":{"markdown_image_response_type":"2","parse_method":"tcadp","table_result_type":"2"}}}`},
{name: "tcadp result options without the engine", parser: "table", input: `{"layout_recognize":"DeepDOC","table_result_type":"2"}`, want: `{}`},
{name: "model reference stays a layout recognizer", input: `{"layout_recognize":"bge-m3@mineru"}`, want: `{"Parser:HipSignsRhyme":{"pdf":{"layout_recognizer":"bge-m3@mineru"}}}`},
+ {name: "PaddleOCR model reference becomes the engine", input: `{"layout_recognize":"[email protected]@PaddleOCR"}`, want: `{"Parser:HipSignsRhyme":{"pdf":{"parse_method":"paddleocr"}}}`},
{name: "existing engine wins over old model reference", input: `{"layout_recognize":"foo@MinerU","Parser:HipSignsRhyme":{"pdf":{"parse_method":"plain_text"}}}`, want: `{"Parser:HipSignsRhyme":{"pdf":{"parse_method":"plain_text"}}}`},
{name: "existing model reference wins over old engine", input: `{"layout_recognize":"DeepDOC","Parser:HipSignsRhyme":{"pdf":{"layout_recognizer":"foo@MinerU"}}}`, want: `{"Parser:HipSignsRhyme":{"pdf":{"layout_recognizer":"foo@MinerU"}}}`},
{name: "existing engine supersedes unsupported old engine", input: `{"layout_recognize":"MagicOCR","Parser:HipSignsRhyme":{"pdf":{"parse_method":"plain_text"}}}`, want: `{"Parser:HipSignsRhyme":{"pdf":{"parse_method":"plain_text"}}}`},
@@ -156,7 +157,6 @@ func TestMigrateParserChunkerTokenizerConfigRejectsMalformedValues(t *testing.T)
`{"layout_recognize":"foo@mistral ocr"}`,
`{"layout_recognize":"model@instance@somark"}`,
`{"layout_recognize":"model@instance@opendataloader"}`,
- `{"layout_recognize":"model@instance@paddleocr"}`,
`{"pages":"1-5"}`,
`{"pages":[[0,5]]}`,
`{"pages":[[5,1]]}`,