Skip to content

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

Fix: allow create dataset with resume chunk_method (#13798)

Lynn6a4a9debd239
diff --git a/api/utils/validation_utils.py b/api/utils/validation_utils.py
index fb2a048849..a22c3f2a35 100644
--- a/api/utils/validation_utils.py
+++ b/api/utils/validation_utils.py
@@ -652,8 +652,8 @@ class CreateDatasetReq(Base):
@classmethod
def validate_chunk_method(cls, v: Any, handler) -> Any:
"""Wrap validation to unify error messages, including type errors (e.g. list)."""
- allowed = {"naive", "book", "email", "laws", "manual", "one", "paper", "picture", "presentation", "qa", "table", "tag"}
- error_msg = "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table' or 'tag'"
+ allowed = {"naive", "book", "email", "laws", "manual", "one", "paper", "picture", "presentation", "qa", "table", "tag", "resume"}
+ error_msg = "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table', 'tag' or 'resume'"
# Omitted field: handler won't be invoked (wrap still gets value); None treated as explicit invalid
if v is None:
raise PydanticCustomError("literal_error", error_msg)
diff --git a/test/testcases/test_http_api/test_dataset_management/test_create_dataset.py b/test/testcases/test_http_api/test_dataset_management/test_create_dataset.py
index 45c48ee1e7..5a01155afb 100644
--- a/test/testcases/test_http_api/test_dataset_management/test_create_dataset.py
+++ b/test/testcases/test_http_api/test_dataset_management/test_create_dataset.py
@@ -381,7 +381,7 @@ class TestDatasetCreate:
payload = {"name": name, "chunk_method": chunk_method}
res = create_dataset(HttpApiAuth, payload)
assert res["code"] == 101, res
- assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table' or 'tag'" in res["message"], res
+ assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table', 'tag' or 'resume'" in res["message"], res
@pytest.mark.p2
def test_chunk_method_unset(self, HttpApiAuth):
@@ -395,7 +395,7 @@ class TestDatasetCreate:
payload = {"name": "chunk_method_none", "chunk_method": None}
res = create_dataset(HttpApiAuth, payload)
assert res["code"] == 101, res
- assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table' or 'tag'" in res["message"], res
+ assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table', 'tag' or 'resume'" in res["message"], res
@pytest.mark.p1
@pytest.mark.parametrize(
diff --git a/test/testcases/test_http_api/test_dataset_management/test_update_dataset.py b/test/testcases/test_http_api/test_dataset_management/test_update_dataset.py
index 81d948abcd..58885a5395 100644
--- a/test/testcases/test_http_api/test_dataset_management/test_update_dataset.py
+++ b/test/testcases/test_http_api/test_dataset_management/test_update_dataset.py
@@ -460,7 +460,7 @@ class TestDatasetUpdate:
payload = {"chunk_method": chunk_method}
res = update_dataset(HttpApiAuth, dataset_id, payload)
assert res["code"] == 101, res
- assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table' or 'tag'" in res["message"], res
+ assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table', 'tag' or 'resume'" in res["message"], res
@pytest.mark.p3
def test_chunk_method_none(self, HttpApiAuth, add_dataset_func):
@@ -468,7 +468,7 @@ class TestDatasetUpdate:
payload = {"chunk_method": None}
res = update_dataset(HttpApiAuth, dataset_id, payload)
assert res["code"] == 101, res
- assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table' or 'tag'" in res["message"], res
+ assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table', 'tag' or 'resume'" in res["message"], res
@pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="#8208")
@pytest.mark.p2
diff --git a/test/testcases/test_sdk_api/test_dataset_mangement/test_create_dataset.py b/test/testcases/test_sdk_api/test_dataset_mangement/test_create_dataset.py
index 6b7679544d..8f8f9bfeb6 100644
--- a/test/testcases/test_sdk_api/test_dataset_mangement/test_create_dataset.py
+++ b/test/testcases/test_sdk_api/test_dataset_mangement/test_create_dataset.py
@@ -306,8 +306,9 @@ class TestDatasetCreate:
("qa", "qa"),
("table", "table"),
("tag", "tag"),
+ ("resume", "resume")
],
- ids=["naive", "book", "email", "laws", "manual", "one", "paper", "picture", "presentation", "qa", "table", "tag"],
+ ids=["naive", "book", "email", "laws", "manual", "one", "paper", "picture", "presentation", "qa", "table", "tag", "resume"],
)
def test_chunk_method(self, client, name, chunk_method):
payload = {"name": name, "chunk_method": chunk_method}
@@ -327,7 +328,7 @@ class TestDatasetCreate:
payload = {"name": name, "chunk_method": chunk_method}
with pytest.raises(Exception) as exception_info:
client.create_dataset(**payload)
- assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table' or 'tag'" in str(exception_info.value), str(exception_info.value)
+ assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table', 'tag' or 'resume'" in str(exception_info.value), str(exception_info.value)
@pytest.mark.p2
def test_chunk_method_unset(self, client):
diff --git a/test/testcases/test_sdk_api/test_dataset_mangement/test_update_dataset.py b/test/testcases/test_sdk_api/test_dataset_mangement/test_update_dataset.py
index 942e3b5fff..6207e31db1 100644
--- a/test/testcases/test_sdk_api/test_dataset_mangement/test_update_dataset.py
+++ b/test/testcases/test_sdk_api/test_dataset_mangement/test_update_dataset.py
@@ -320,14 +320,14 @@ class TestDatasetUpdate:
dataset = add_dataset_func
with pytest.raises(Exception) as exception_info:
dataset.update({"chunk_method": chunk_method})
- assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table' or 'tag'" in str(exception_info.value), str(exception_info.value)
+ assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table', 'tag' or 'resume'" in str(exception_info.value), str(exception_info.value)
@pytest.mark.p3
def test_chunk_method_none(self, add_dataset_func):
dataset = add_dataset_func
with pytest.raises(Exception) as exception_info:
dataset.update({"chunk_method": None})
- assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table' or 'tag'" in str(exception_info.value), str(exception_info.value)
+ assert "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table', 'tag' or 'resume'" in str(exception_info.value), str(exception_info.value)
@pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="#8208")
@pytest.mark.p2