Fix: Create dataset performance unmatched between HTTP api and web ui (#10960)

### What problem does this PR solve?

Fix: Create dataset performance unmatched between HTTP api and web ui
#10925

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Billy Bao
2025-11-04 13:45:14 +08:00
committed by GitHub
parent 1e45137284
commit 19f71a961a
12 changed files with 201 additions and 222 deletions

View File

@ -23,7 +23,7 @@ from ragflow_sdk import DataSet, RAGFlow
from utils import encode_avatar
from utils.file_utils import create_image_file
from utils.hypothesis_utils import valid_names
from configs import DEFAULT_PARSER_CONFIG
@pytest.mark.usefixtures("clear_datasets")
class TestAuthorization:
@ -586,14 +586,7 @@ class TestDatasetCreate:
def test_parser_config_empty(self, client):
excepted_value = DataSet.ParserConfig(
client,
{
"chunk_token_num": 512,
"delimiter": r"\n",
"html4excel": False,
"layout_recognize": "DeepDOC",
"raptor": {"use_raptor": False},
"graphrag": {"use_graphrag": False},
},
DEFAULT_PARSER_CONFIG,
)
parser_config_o = DataSet.ParserConfig(client, {})
payload = {"name": "parser_config_empty", "parser_config": parser_config_o}
@ -604,14 +597,7 @@ class TestDatasetCreate:
def test_parser_config_unset(self, client):
excepted_value = DataSet.ParserConfig(
client,
{
"chunk_token_num": 512,
"delimiter": r"\n",
"html4excel": False,
"layout_recognize": "DeepDOC",
"raptor": {"use_raptor": False},
"graphrag": {"use_graphrag": False},
},
DEFAULT_PARSER_CONFIG,
)
payload = {"name": "parser_config_unset"}
dataset = client.create_dataset(**payload)
@ -621,14 +607,7 @@ class TestDatasetCreate:
def test_parser_config_none(self, client):
excepted_value = DataSet.ParserConfig(
client,
{
"chunk_token_num": 512,
"delimiter": r"\n",
"html4excel": False,
"layout_recognize": "DeepDOC",
"raptor": {"use_raptor": False},
"graphrag": {"use_graphrag": False},
},
DEFAULT_PARSER_CONFIG,
)
payload = {"name": "parser_config_empty", "parser_config": None}
dataset = client.create_dataset(**payload)

View File

@ -24,7 +24,7 @@ from ragflow_sdk import DataSet
from utils import encode_avatar
from utils.file_utils import create_image_file
from utils.hypothesis_utils import valid_names
from configs import DEFAULT_PARSER_CONFIG
class TestRquest:
@pytest.mark.p2
@ -634,14 +634,7 @@ class TestDatasetUpdate:
dataset = add_dataset_func
expected_config = DataSet.ParserConfig(
client,
{
"chunk_token_num": 512,
"delimiter": r"\n",
"html4excel": False,
"layout_recognize": "DeepDOC",
"raptor": {"use_raptor": False},
"graphrag": {"use_graphrag": False},
},
DEFAULT_PARSER_CONFIG,
)
dataset.update({"parser_config": {}})
assert str(dataset.parser_config) == str(expected_config), str(dataset)
@ -654,14 +647,7 @@ class TestDatasetUpdate:
dataset = add_dataset_func
expected_config = DataSet.ParserConfig(
client,
{
"chunk_token_num": 512,
"delimiter": r"\n",
"html4excel": False,
"layout_recognize": "DeepDOC",
"raptor": {"use_raptor": False},
"graphrag": {"use_graphrag": False},
},
DEFAULT_PARSER_CONFIG,
)
dataset.update({"parser_config": None})
assert str(dataset.parser_config) == str(expected_config), str(dataset)

View File

@ -17,7 +17,7 @@
import pytest
from configs import DOCUMENT_NAME_LIMIT
from ragflow_sdk import DataSet
from configs import DEFAULT_PARSER_CONFIG
class TestDocumentsUpdated:
@pytest.mark.p1
@ -206,14 +206,7 @@ class TestUpdateDocumentParserConfig:
("naive", {}, ""),
(
"naive",
{
"chunk_token_num": 512,
"layout_recognize": "DeepDOC",
"html4excel": False,
"delimiter": r"\n",
"task_page_size": 12,
"raptor": {"use_raptor": False},
},
DEFAULT_PARSER_CONFIG,
"",
),
pytest.param(
@ -294,7 +287,12 @@ class TestUpdateDocumentParserConfig:
"",
marks=pytest.mark.skip(reason="issues/6098"),
),
("naive", {"raptor": {"use_raptor": True}}, ""),
("naive", {"raptor": {"use_raptor": True,
"prompt": "Please summarize the following paragraphs. Be careful with the numbers, do not make things up. Paragraphs as following:\n {cluster_content}\nThe above is the content you need to summarize.",
"max_token": 256,
"threshold": 0.1,
"max_cluster": 64,
"random_seed": 0,}}, ""),
("naive", {"raptor": {"use_raptor": False}}, ""),
pytest.param(
"naive",
@ -400,13 +398,6 @@ class TestUpdateDocumentParserConfig:
else:
expected_config = DataSet.ParserConfig(
client,
{
"chunk_token_num": 512,
"delimiter": r"\n",
"html4excel": False,
"layout_recognize": "DeepDOC",
"raptor": {"use_raptor": False},
"graphrag": {"use_graphrag": False},
},
DEFAULT_PARSER_CONFIG,
)
assert str(updated_doc.parser_config) == str(expected_config), str(updated_doc)