RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix: switch image/ppt/email/audio from General to pipeline, or switch back, it report error (#18555)
Wang Qi76bff4c915f7
diff --git a/api/utils/validation_utils.py b/api/utils/validation_utils.pyindex 054c6f19c5..0993b8cde0 100644--- a/api/utils/validation_utils.py+++ b/api/utils/validation_utils.py@@ -533,7 +533,7 @@ class UpdateDocumentReq(Base):"""Validate an optional document parser method."""if chunk_method:# Validate chunk method if present- valid_chunk_method = {"naive", "manual", "qa", "table", "paper", "book", "laws", "presentation", "picture", "one", "knowledge_graph", "email", "tag"}+ valid_chunk_method = {"naive", "manual", "qa", "table", "paper", "book", "laws", "presentation", "picture", "one", "knowledge_graph", "email", "audio", "tag"}if chunk_method not in valid_chunk_method:raise PydanticCustomError("format_invalid", "`chunk_method` {chunk_method} doesn't exist", {"chunk_method": chunk_method})@@ -1197,6 +1197,11 @@ def validate_chunk_method(doc, chunk_method=None):"""if chunk_method is not None and len(chunk_method) == 0: # will not be detected in UpdateDocumentReqreturn "`chunk_method` (empty string) is not valid", RetCode.DATA_ERROR- if doc.type == FileType.VISUAL or re.search(r"\.(ppt|pptx|pages)$", doc.name):- return "Not supported yet!", RetCode.DATA_ERROR+ if (+ (doc.type == FileType.VISUAL and chunk_method != "picture")+ or (doc.type == FileType.AURAL and chunk_method != "audio")+ or (re.search(r"\.(ppt|pptx|pages)$", doc.name) and chunk_method != "presentation")+ or (re.search(r"\.(msg|eml)$", doc.name) and chunk_method != "email")+ ):+ return "the automatically detected parser type cannot be changed", RetCode.DATA_ERRORreturn None, Nonediff --git a/test/unit_test/api/utils/test_doc_validation.py b/test/unit_test/api/utils/test_doc_validation.pyindex e30f1cc02a..ec54972be1 100644--- a/test/unit_test/api/utils/test_doc_validation.py+++ b/test/unit_test/api/utils/test_doc_validation.py@@ -326,7 +326,7 @@ def test_validate_chunk_method_visual_not_supported():doc.name = "image.jpg"error_msg, error_code = validate_chunk_method(doc)- assert "Not supported yet!" in error_msg+ assert "the automatically detected parser type cannot be changed" in error_msgassert error_code == RetCode.DATA_ERROR@@ -337,7 +337,7 @@ def test_validate_chunk_method_ppt_not_supported():doc.name = "presentation.ppt"error_msg, error_code = validate_chunk_method(doc)- assert "Not supported yet!" in error_msg+ assert "the automatically detected parser type cannot be changed" in error_msgassert error_code == RetCode.DATA_ERROR@@ -348,7 +348,7 @@ def test_validate_chunk_method_pptx_not_supported():doc.name = "presentation.pptx"error_msg, error_code = validate_chunk_method(doc)- assert "Not supported yet!" in error_msg+ assert "the automatically detected parser type cannot be changed" in error_msgassert error_code == RetCode.DATA_ERROR@@ -359,7 +359,7 @@ def test_validate_chunk_method_pages_not_supported():doc.name = "document.pages"error_msg, error_code = validate_chunk_method(doc)- assert "Not supported yet!" in error_msg+ assert "the automatically detected parser type cannot be changed" in error_msgassert error_code == RetCode.DATA_ERRORdiff --git a/web/src/hooks/use-document-request.ts b/web/src/hooks/use-document-request.tsindex 9ab6d68ef9..fc0815b8b0 100644--- a/web/src/hooks/use-document-request.ts+++ b/web/src/hooks/use-document-request.ts@@ -561,11 +561,10 @@ export const useSetDocumentParser = () => {}) => {// Build update payloadconst updateData: Record<string, unknown> = {};- if (parserId) {- updateData.chunk_method = parserId;- }if (pipelineId) {updateData.pipeline_id = pipelineId;+ } else if (parserId) {+ updateData.chunk_method = parserId;}if (parserConfig) {