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: get rid of graphrag raptor in parser_config in REST API (#19161)
Wang Qi6ec9c6a7376d
diff --git a/api/apps/restful_apis/document_api.py b/api/apps/restful_apis/document_api.pyindex 78cb021670..4f5b1b2c5b 100644--- a/api/apps/restful_apis/document_api.py+++ b/api/apps/restful_apis/document_api.py@@ -60,6 +60,7 @@ from api.utils.api_utils import (get_request_json,get_error_argument_result,check_duplicate_ids,+ strip_graphrag_raptor_config,)from api.utils.pagination_utils import DEFAULT_PAGE, DEFAULT_PAGE_SIZE, validate_rest_api_ids, validate_rest_api_page, validate_rest_api_page_sizefrom api.utils.validation_utils import (@@ -713,7 +714,7 @@ async def _upload_local_documents(kb, tenant_id):return_raw_files = request.args.get("return_raw_files", "false").lower() == "true"if return_raw_files:- doc_data = files+ doc_data = [strip_graphrag_raptor_config(doc) for doc in files]else:doc_data = [map_doc_keys_with_run_status(doc, run_status="0") for doc in files]@@ -1296,7 +1297,7 @@ async def update_metadata_config(tenant_id, dataset_id, document_id):except Exception as e:return get_json_result(code=RetCode.EXCEPTION_ERROR, message=repr(e))- return get_result(data=doc.to_dict())+ return get_result(data=strip_graphrag_raptor_config(doc.to_dict()))@manager.route("/thumbnails", methods=["GET"]) # noqa: F821diff --git a/api/apps/services/document_api_service.py b/api/apps/services/document_api_service.pyindex aa4663661a..707894abad 100644--- a/api/apps/services/document_api_service.py+++ b/api/apps/services/document_api_service.py@@ -22,7 +22,7 @@ from api.db.services.file_service import FileServicefrom api.utils import validation_utilsfrom common import settingsfrom common.constants import TaskStatus-from api.utils.api_utils import get_error_data_result, server_error_response, get_parser_config+from api.utils.api_utils import get_error_data_result, server_error_response, get_parser_config, strip_graphrag_raptor_configfrom api.utils.validation_utils import UpdateDocumentReqfrom rag.nlp import rag_tokenizer, search@@ -282,7 +282,7 @@ def _process_key_mappings(doc):for key, value in items:new_key = key_mapping.get(key, key)renamed_doc[new_key] = value- return renamed_doc+ return strip_graphrag_raptor_config(renamed_doc)def _process_run_mapping(doc, run_status):diff --git a/api/utils/api_utils.py b/api/utils/api_utils.pyindex d2a2ef4ea1..a112f09e61 100644--- a/api/utils/api_utils.py+++ b/api/utils/api_utils.py@@ -371,57 +371,25 @@ def get_parser_config(chunk_method, parser_config):"auto_questions": 0,"html4excel": False,"topn_tags": 3,- "raptor": {- "use_raptor": True,- "prompt": "Summarize the paragraphs below without inventing facts or changing numbers.\nOutput exactly two parts in the same language as the source:\n1. First line: a concise title only.\n2. Following lines: a concise summary of the content.\nDo not output labels, Markdown headings, bullet points, or any other commentary.\n\nParagraphs:\n{cluster_content}",- "max_token": 512,- "clustering_threshold": 0.3,- "clustering_ratio": 0.5,- "max_cluster": 64,- "random_seed": 0,- },- "graphrag": {- "use_graphrag": True,- "entity_types": [- "organization",- "person",- "geo",- "event",- "category",- ],- "method": "light",- "batch_chunk_token_size": 4096,- "retry_attempts": 2,- "retry_backoff_seconds": 2.0,- "retry_backoff_max_seconds": 60.0,- "build_subgraph_timeout_per_chunk_seconds": 300,- "build_subgraph_min_timeout_seconds": 600,- "merge_timeout_seconds": 180,- "resolution_timeout_seconds": 1800,- "community_timeout_seconds": 1800,- "lock_acquire_timeout_seconds": 600,- },"parent_child": {"use_parent_child": False,"children_delimiter": "\n",},},- "qa": {"raptor": {"use_raptor": False}, "graphrag": {"use_graphrag": False}},+ "qa": {},"tag": None,"resume": None,- "manual": {"raptor": {"use_raptor": False}, "graphrag": {"use_graphrag": False}},+ "manual": {},"table": None,- "paper": {"raptor": {"use_raptor": False}, "graphrag": {"use_graphrag": False}},- "book": {"raptor": {"use_raptor": False}, "graphrag": {"use_graphrag": False}},- "laws": {"raptor": {"use_raptor": False}, "graphrag": {"use_graphrag": False}},- "presentation": {"raptor": {"use_raptor": False}, "graphrag": {"use_graphrag": False}},+ "paper": {},+ "book": {},+ "laws": {},+ "presentation": {},"one": None,"knowledge_graph": {"chunk_token_num": 8192,"delimiter": "\n","entity_types": ["organization", "person", "location", "event", "time"],- "raptor": {"use_raptor": False},- "graphrag": {"use_graphrag": False},},"email": None,"picture": None,@@ -644,6 +612,14 @@ def deep_merge(default: dict, custom: dict) -> dict:return merged+def strip_graphrag_raptor_config(source_data: dict) -> dict:+ result = dict(source_data)+ parser_config = source_data.get("parser_config")+ if isinstance(parser_config, dict):+ result["parser_config"] = {key: value for key, value in parser_config.items() if key not in ("graphrag", "raptor")}+ return result++def remap_dictionary_keys(source_data: dict, key_aliases: dict = None) -> dict:"""Transform dictionary keys using a configurable mapping schema.@@ -676,7 +652,7 @@ def remap_dictionary_keys(source_data: dict, key_aliases: dict = None) -> dict:mapped_key = mapping.get(original_key, original_key)transformed_data[mapped_key] = value- return transformed_data+ return strip_graphrag_raptor_config(transformed_data)def group_by(list_of_dict, key):diff --git a/test/testcases/configs.py b/test/testcases/configs.pyindex 608b25d59e..280b659ec4 100644--- a/test/testcases/configs.py+++ b/test/testcases/configs.py@@ -86,36 +86,6 @@ DEFAULT_PARSER_CONFIG = {"table_context_size": 0,"topn_tags": 3,"llm_id": "glm-4-flash@CI@ZHIPU-AI",- "raptor": {- "use_raptor": True,- "prompt": "Summarize the paragraphs below without inventing facts or changing numbers.\nOutput exactly two parts in the same language as the source:\n1. First line: a concise title only.\n2. Following lines: a concise summary of the content.\nDo not output labels, Markdown headings, bullet points, or any other commentary.\n\nParagraphs:\n{cluster_content}",- "max_token": 512,- "clustering_threshold": 0.3,- "clustering_ratio": 0.5,- "max_cluster": 64,- "random_seed": 0,- },- "graphrag": {- "use_graphrag": True,- "entity_types": [- "organization",- "person",- "geo",- "event",- "category",- ],- "method": "light",- "batch_chunk_token_size": 4096,- "retry_attempts": 2,- "retry_backoff_seconds": 2.0,- "retry_backoff_max_seconds": 60.0,- "build_subgraph_timeout_per_chunk_seconds": 300,- "build_subgraph_min_timeout_seconds": 600,- "merge_timeout_seconds": 180,- "resolution_timeout_seconds": 1800,- "community_timeout_seconds": 1800,- "lock_acquire_timeout_seconds": 600,- },"parent_child": {"use_parent_child": False,"children_delimiter": "\n",diff --git a/test/testcases/restful_api/test_datasets.py b/test/testcases/restful_api/test_datasets.pyindex 366eb87ba9..77233bec89 100644--- a/test/testcases/restful_api/test_datasets.py+++ b/test/testcases/restful_api/test_datasets.py@@ -362,6 +362,9 @@ def test_dataset_update_parser_config_valid_matrix_contract(rest_client, clear_dassert list_payload["code"] == 0, list_payloadactual_parser_config = list_payload["data"][0]["parser_config"]for key, expected_value in parser_config.items():+ if key in {"graphrag", "raptor"}:+ assert key not in actual_parser_config, list_payload+ continueif isinstance(expected_value, dict):for nested_key, nested_expected in expected_value.items():assert actual_parser_config[key][nested_key] == nested_expected, list_payload@@ -1296,10 +1299,8 @@ def test_dataset_create_parser_config_missing_raptor_and_graphrag(rest_client, cbody = res.json()assert body["code"] == 0, bodyparser_config = body["data"]["parser_config"]- assert "raptor" in parser_config, body- assert "graphrag" in parser_config, body- assert parser_config["raptor"]["use_raptor"] is False, body- assert parser_config["graphrag"]["use_graphrag"] is False, body+ assert "raptor" not in parser_config, body+ assert "graphrag" not in parser_config, bodyassert parser_config["chunk_token_num"] == 1024, body@@ -1448,6 +1449,9 @@ def test_dataset_create_parser_config_valid_matrix_contract(rest_client, clear_dassert body["code"] == 0, bodyactual_parser_config = body["data"]["parser_config"]for key, expected_value in parser_config.items():+ if key in {"graphrag", "raptor"}:+ assert key not in actual_parser_config, body+ continueif isinstance(expected_value, dict):for nested_key, nested_expected in expected_value.items():assert actual_parser_config[key][nested_key] == nested_expected, body@@ -1457,20 +1461,18 @@ def test_dataset_create_parser_config_valid_matrix_contract(rest_client, clear_d@pytest.mark.p1@pytest.mark.parametrize(- "name, parser_config, expected_raptor, expected_graphrag",+ "name, parser_config",[- ("test_parser_config_only_raptor", {"chunk_token_num": 1024, "raptor": {"use_raptor": True}}, True, False),- ("test_parser_config_only_graphrag", {"chunk_token_num": 1024, "graphrag": {"use_graphrag": True}}, False, True),+ ("test_parser_config_only_raptor", {"chunk_token_num": 1024, "raptor": {"use_raptor": True}}),+ ("test_parser_config_only_graphrag", {"chunk_token_num": 1024, "graphrag": {"use_graphrag": True}}),("test_parser_config_both_fields",{"chunk_token_num": 1024, "raptor": {"use_raptor": True}, "graphrag": {"use_graphrag": True}},- True,- True,),],ids=["only_raptor", "only_graphrag", "both_fields"],)-def test_dataset_create_parser_config_bugfix_contract(rest_client, clear_datasets, name, parser_config, expected_raptor, expected_graphrag):+def test_dataset_create_parser_config_bugfix_contract(rest_client, clear_datasets, name, parser_config):if IS_GO_PROXY:pytest.skip("Go CreateDataset does not accept parser_config")res = rest_client.post("/datasets", json={"name": name, "parser_config": parser_config})@@ -1478,10 +1480,8 @@ def test_dataset_create_parser_config_bugfix_contract(rest_client, clear_datasetbody = res.json()assert body["code"] == 0, bodyactual_parser_config = body["data"]["parser_config"]- assert "raptor" in actual_parser_config, body- assert "graphrag" in actual_parser_config, body- assert actual_parser_config["raptor"]["use_raptor"] is expected_raptor, body- assert actual_parser_config["graphrag"]["use_graphrag"] is expected_graphrag, body+ assert "raptor" not in actual_parser_config, body+ assert "graphrag" not in actual_parser_config, bodyassert actual_parser_config["chunk_token_num"] == 1024, body@@ -1505,10 +1505,8 @@ def test_dataset_create_parser_config_different_chunk_methods_contract(rest_clieassert body["code"] == 0, bodyparser_config = body["data"]["parser_config"]assert parser_config["chunk_token_num"] == 512, body- assert "raptor" in parser_config, body- assert "graphrag" in parser_config, body- assert parser_config["raptor"]["use_raptor"] is False, body- assert parser_config["graphrag"]["use_graphrag"] is False, body+ assert "raptor" not in parser_config, body+ assert "graphrag" not in parser_config, bodydef test_dataset_create_name_invalid_and_duplicate_contract(rest_client, clear_datasets):diff --git a/test/testcases/restful_api/test_documents.py b/test/testcases/restful_api/test_documents.pyindex c10e12f417..c7981da8f3 100644--- a/test/testcases/restful_api/test_documents.py+++ b/test/testcases/restful_api/test_documents.py@@ -824,6 +824,9 @@ def test_documents_update_parser_config_contract(rest_client, create_dataset, tmassert doc_parser_config == DEFAULT_PARSER_CONFIG, (parser_config, list_body)else:for key, value in parser_config.items():+ if key in {"graphrag", "raptor"}:+ assert key not in doc_parser_config, (parser_config, list_body)+ continueif isinstance(value, dict):for sub_key, sub_value in value.items():assert doc_parser_config[key][sub_key] == sub_value, (parser_config, list_body)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.pyindex 8a60697e14..39de107137 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@@ -463,6 +463,9 @@ class TestDatasetCreate:payload = {"name": name, "parser_config": parser_config_o}dataset = client.create_dataset(**payload)for k, v in parser_config.items():+ if k in {"graphrag", "raptor"}:+ assert not hasattr(dataset.parser_config, k), str(dataset)+ continueif isinstance(v, dict):for kk, vv in v.items():assert attrgetter(f"{k}.{kk}")(dataset.parser_config) == vv, str(dataset)@@ -653,10 +656,8 @@ class TestParserConfigBugFix:dataset = client.create_dataset(**payload)config = dataset.parser_config- assert hasattr(config, "raptor"), "raptor field should be present"- assert hasattr(config, "graphrag"), "graphrag field should be present"- assert config.raptor.use_raptor is False, "raptor.use_raptor should default to False"- assert config.graphrag.use_graphrag is False, "graphrag.use_graphrag should default to False"+ assert not hasattr(config, "raptor"), "raptor field should not be exposed"+ assert not hasattr(config, "graphrag"), "graphrag field should not be exposed"assert config.chunk_token_num == 1024, "User-provided chunk_token_num should be preserved"@pytest.mark.p1@@ -666,9 +667,8 @@ class TestParserConfigBugFix:dataset = client.create_dataset(**payload)config = dataset.parser_config- assert config.raptor.use_raptor is True, "User-provided raptor.use_raptor should be preserved"- assert hasattr(config, "graphrag"), "graphrag field should be present"- assert config.graphrag.use_graphrag is False, "graphrag.use_graphrag should default to False"+ assert not hasattr(config, "raptor"), "raptor field should not be exposed"+ assert not hasattr(config, "graphrag"), "graphrag field should not be exposed"@pytest.mark.p1def test_parser_config_with_only_graphrag(self, client):@@ -677,9 +677,8 @@ class TestParserConfigBugFix:dataset = client.create_dataset(**payload)config = dataset.parser_config- assert hasattr(config, "raptor"), "raptor field should be present"- assert config.raptor.use_raptor is False, "raptor.use_raptor should default to False"- assert config.graphrag.use_graphrag is True, "User-provided graphrag.use_graphrag should be preserved"+ assert not hasattr(config, "raptor"), "raptor field should not be exposed"+ assert not hasattr(config, "graphrag"), "graphrag field should not be exposed"@pytest.mark.p1def test_parser_config_with_both_fields(self, client):@@ -688,8 +687,8 @@ class TestParserConfigBugFix:dataset = client.create_dataset(**payload)config = dataset.parser_config- assert config.raptor.use_raptor is True, "User-provided raptor.use_raptor should be preserved"- assert config.graphrag.use_graphrag is True, "User-provided graphrag.use_graphrag should be preserved"+ assert not hasattr(config, "raptor"), "raptor field should not be exposed"+ assert not hasattr(config, "graphrag"), "graphrag field should not be exposed"@pytest.mark.p2@pytest.mark.parametrize("chunk_method", ["qa", "manual", "paper", "book", "laws", "presentation"])@@ -699,7 +698,5 @@ class TestParserConfigBugFix:dataset = client.create_dataset(**payload)config = dataset.parser_config- assert hasattr(config, "raptor"), f"raptor field should be present for {chunk_method}"- assert hasattr(config, "graphrag"), f"graphrag field should be present for {chunk_method}"- assert config.raptor.use_raptor is False, f"raptor.use_raptor should default to False for {chunk_method}"- assert config.graphrag.use_graphrag is False, f"graphrag.use_graphrag should default to False for {chunk_method}"+ assert not hasattr(config, "raptor"), f"raptor field should not be exposed for {chunk_method}"+ assert not hasattr(config, "graphrag"), f"graphrag field should not be exposed for {chunk_method}"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.pyindex 4047ec9b26..543245e0dd 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@@ -524,6 +524,9 @@ class TestDatasetUpdate:dataset = add_dataset_funcdataset.update({"parser_config": parser_config})for k, v in parser_config.items():+ if k in {"graphrag", "raptor"}:+ assert not hasattr(dataset.parser_config, k), str(dataset)+ continueif isinstance(v, dict):for kk, vv in v.items():assert attrgetter(f"{k}.{kk}")(dataset.parser_config) == vv, str(dataset)@@ -532,6 +535,9 @@ class TestDatasetUpdate:retrieved_dataset = client.get_dataset(name=dataset.name)for k, v in parser_config.items():+ if k in {"graphrag", "raptor"}:+ assert not hasattr(retrieved_dataset.parser_config, k), str(retrieved_dataset)+ continueif isinstance(v, dict):for kk, vv in v.items():assert attrgetter(f"{k}.{kk}")(retrieved_dataset.parser_config) == vv, str(retrieved_dataset)@@ -688,8 +694,6 @@ class TestDatasetUpdate:expected_config = DataSet.ParserConfig(client,{- "raptor": {"use_raptor": False},- "graphrag": {"use_graphrag": False},"image_context_size": 0,"table_context_size": 0,},@@ -706,8 +710,6 @@ class TestDatasetUpdate:expected_config = DataSet.ParserConfig(client,{- "raptor": {"use_raptor": False},- "graphrag": {"use_graphrag": False},"image_context_size": 0,"table_context_size": 0,},@@ -724,8 +726,6 @@ class TestDatasetUpdate:expected_config = DataSet.ParserConfig(client,{- "raptor": {"use_raptor": False},- "graphrag": {"use_graphrag": False},"image_context_size": 0,"table_context_size": 0,},diff --git a/test/testcases/test_sdk_api/test_file_management_within_dataset/test_update_document.py b/test/testcases/test_sdk_api/test_file_management_within_dataset/test_update_document.pyindex 9ad523b498..81abe6363b 100644--- a/test/testcases/test_sdk_api/test_file_management_within_dataset/test_update_document.py+++ b/test/testcases/test_sdk_api/test_file_management_within_dataset/test_update_document.py@@ -498,6 +498,9 @@ class TestUpdateDocumentParserConfig:updated_doc = [doc for doc in docs if doc.id == document.id][0]if parser_config:for k, v in parser_config.items():+ if k in {"graphrag", "raptor"}:+ assert not hasattr(updated_doc.parser_config, k), str(updated_doc)+ continueif isinstance(v, dict):for kk, vv in v.items():assert attrgetter(f"{k}.{kk}")(updated_doc.parser_config) == vv, str(updated_doc)diff --git a/test/unit_test/api/apps/services/test_update_document_name_only.py b/test/unit_test/api/apps/services/test_update_document_name_only.pyindex 2b1ecac7ed..72b8fa8225 100644--- a/test/unit_test/api/apps/services/test_update_document_name_only.py+++ b/test/unit_test/api/apps/services/test_update_document_name_only.py@@ -45,6 +45,7 @@ def _load_update_document_name_only_module(monkeypatch, *, file_lookup):doc = SimpleNamespace(id="doc-1", kb_id="kb-1")f2d_row = SimpleNamespace(file_id="missing-file-id")+ _stub(monkeypatch, "api.db.services.document_counter_service", release_reparse_counters=lambda doc_id: None)_stub(monkeypatch,"api.db.services.document_service",@@ -75,6 +76,7 @@ def _load_update_document_name_only_module(monkeypatch, *, file_lookup):get_error_data_result=lambda **kwargs: kwargs,server_error_response=lambda e: {"error": str(e)},get_parser_config=lambda doc: {},+ strip_graphrag_raptor_config=lambda data: data,)_stub(monkeypatch, "api.utils.validation_utils", UpdateDocumentReq=object)_stub(monkeypatch, "api.utils", validation_utils=sys.modules["api.utils.validation_utils"])diff --git a/web/src/hooks/parser-config-utils.ts b/web/src/hooks/parser-config-utils.tsindex 08ab8850cf..d0ab2462d2 100644--- a/web/src/hooks/parser-config-utils.ts+++ b/web/src/hooks/parser-config-utils.ts@@ -15,9 +15,9 @@*//**- * Utility functions for extracting parser and raptor config extensions.- * These functions extract known fields from parser/raptor config objects- * and merge unknown fields into the `ext` field for flexible configuration.+ * Utility functions for extracting parser config extensions.+ * These functions extract known fields from parser config objects and merge+ * unknown fields into the `ext` field for flexible configuration.*//**@@ -34,52 +34,6 @@ export const isPipelineParserConfig = (return Object.keys(parserConfig).some((key) => key.includes(':'));};-/**- * Extracts Raptor configuration with extra fields merged into ext.- * @param raptorConfig - The raptor configuration object- * @returns Processed raptor config with extra fields in ext- */-export const extractRaptorConfigExt = (- raptorConfig: Record<string, any> | undefined,-) => {- if (!raptorConfig) return raptorConfig;- const {- use_raptor,- prompt,- max_token,- threshold,- max_cluster,- random_seed,- scope,- clustering_method,- tree_builder,- auto_disable_for_structured_data,- ext,- ...raptorExt- } = raptorConfig;- const extClusteringMethod = ext?.clustering_method;- const normalizedClusteringMethod =- clustering_method ?? extClusteringMethod ?? 'gmm';- const normalizedTreeBuilder = tree_builder ?? ext?.tree_builder ?? 'raptor';-- return {- use_raptor,- prompt,- max_token,- threshold,- max_cluster,- random_seed,- scope,- auto_disable_for_structured_data,- ext: {- ...ext,- ...raptorExt,- clustering_method: normalizedClusteringMethod,- tree_builder: normalizedTreeBuilder,- },- };-};-/*** Extracts Parser configuration with extra fields merged into ext.* @param parserConfig - The parser configuration object@@ -94,10 +48,8 @@ export const extractParserConfigExt = (auto_questions,chunk_token_num,delimiter,- graphrag,html4excel,layout_recognize,- raptor,tag_kb_ids,topn_tags,filename_embd_weight,@@ -109,15 +61,15 @@ export const extractParserConfigExt = (ext,...parserExt} = parserConfig;+ delete parserExt.graphrag;+ delete parserExt.raptor;return {auto_keywords,auto_questions,chunk_token_num,delimiter,- graphrag,html4excel,layout_recognize,- raptor: extractRaptorConfigExt(raptor),tag_kb_ids,topn_tags,filename_embd_weight,diff --git a/web/src/hooks/tests/parser-config-utils.test.ts b/web/src/hooks/tests/parser-config-utils.test.tsdeleted file mode 100644index 6bbfcf0cb6..0000000000--- a/web/src/hooks/tests/parser-config-utils.test.ts+++ /dev/null@@ -1,45 +0,0 @@-import { extractParserConfigExt } from '../parser-config-utils';--describe('extractParserConfigExt', () => {- it('serializes RAPTOR clustering fields through ext for API compatibility', () => {- const result = extractParserConfigExt({- raptor: {- use_raptor: true,- prompt: 'Summarize {cluster_content}',- max_token: 256,- threshold: 0.1,- max_cluster: 317,- random_seed: 0,- scope: 'file',- clustering_method: 'ahc',- tree_builder: 'raptor',- },- });-- expect(result?.raptor).not.toHaveProperty('clustering_method');- expect(result?.raptor).not.toHaveProperty('tree_builder');- expect(result?.raptor?.ext).toMatchObject({- clustering_method: 'ahc',- tree_builder: 'raptor',- });- });-- it('preserves existing RAPTOR ext clustering values when the top-level field is absent', () => {- const result = extractParserConfigExt({- raptor: {- max_cluster: 512,- ext: {- clustering_method: 'ahc',- tree_builder: 'raptor',- psi_bucket_size: 1024,- },- },- });-- expect(result?.raptor?.ext).toMatchObject({- clustering_method: 'ahc',- tree_builder: 'raptor',- psi_bucket_size: 1024,- });- });-});diff --git a/web/src/pages/dataset/setting/python/form-schema.ts b/web/src/pages/dataset/setting/python/form-schema.tsindex 4227e5bae3..6f92ba9dfc 100644--- a/web/src/pages/dataset/setting/python/form-schema.ts+++ b/web/src/pages/dataset/setting/python/form-schema.ts@@ -45,60 +45,6 @@ export const formSchema = zmineru_formula_enable: z.boolean().optional(),mineru_table_enable: z.boolean().optional(),mineru_lang: z.string().optional(),- raptor: z- .object({- use_raptor: z.boolean().optional(),- prompt: z.string().optional(),- max_token: z.coerce.number().optional(),- threshold: z.coerce.number().optional(),- max_cluster: z.coerce.number().optional(),- random_seed: z.coerce.number().optional(),- scope: z.string().optional(),- clustering_method: z.enum(['gmm', 'ahc']).optional(),- tree_builder: z.enum(['raptor', 'psi']).optional(),- ext: z.record(z.string(), z.any()).optional(),- })- .refine(- (data) => {- if (data.use_raptor && !data.prompt) {- return false;- }- return true;- },- {- message: 'Prompt is required',- path: ['prompt'],- },- ),- graphrag: z- .object({- use_graphrag: z.boolean().optional(),- entity_types: z.array(z.string()).optional(),- method: z.string().optional(),- resolution: z.boolean().optional(),- community: z.boolean().optional(),- batch_chunk_token_size: z- .number()- .int()- .min(512)- .max(8196)- .optional(),- })- .refine(- (data) => {- if (- data.use_graphrag &&- (!data.entity_types || data.entity_types.length === 0)- ) {- return false;- }- return true;- },- {- message: 'Please enter Entity types',- path: ['entity_types'],- },- ),metadata: z.any().optional(),built_in_metadata: z.array(diff --git a/web/src/pages/dataset/setting/python/hooks.test.tsx b/web/src/pages/dataset/setting/python/hooks.test.tsxdeleted file mode 100644index 0df505209c..0000000000--- a/web/src/pages/dataset/setting/python/hooks.test.tsx+++ /dev/null@@ -1,78 +0,0 @@-import { useFetchKnowledgeBaseConfiguration } from '@/hooks/use-knowledge-request';-import { renderHook } from '@testing-library/react';-import { useFetchKnowledgeConfigurationOnMount } from './hooks';--jest.mock('@/hooks/use-knowledge-request', () => ({- useFetchKnowledgeBaseConfiguration: jest.fn(),-}));-jest.mock('@/hooks/common-hooks', () => ({- useSetModalState: jest.fn(),-}));-jest.mock('@/hooks/use-user-setting-request', () => ({- useSelectParserList: jest.fn(() => []),-}));-jest.mock('@/services/knowledge-service', () => ({- checkEmbedding: jest.fn(),-}));-jest.mock('react-router', () => ({- useParams: jest.fn(() => ({})),- useSearchParams: jest.fn(() => [new URLSearchParams()]),-}));--const mockUseFetchKnowledgeBaseConfiguration = jest.mocked(- useFetchKnowledgeBaseConfiguration,-);--function renderConfigurationHook(parserConfig: Record<string, unknown>) {- mockUseFetchKnowledgeBaseConfiguration.mockReturnValue({- data: {- name: 'Dataset',- parser_config: parserConfig,- embedding_model: 'BAAI/bge-large-zh-v1.5',- chunk_method: 'naive',- },- loading: false,- } as never);-- const reset = jest.fn();- const form = {- formState: {- defaultValues: {- parser_config: {- raptor: { use_raptor: true },- graphrag: { use_graphrag: true },- },- },- },- reset,- } as never;-- renderHook(() => useFetchKnowledgeConfigurationOnMount(form));-- return reset.mock.calls[0][0].parser_config;-}--describe('useFetchKnowledgeConfigurationOnMount', () => {- it('preserves explicitly disabled RAPTOR and GraphRAG settings', () => {- const parserConfig = renderConfigurationHook({- raptor: {- use_raptor: false,- ext: { clustering_method: 'gmm' },- },- graphrag: { use_graphrag: false },- });-- expect(parserConfig.raptor.use_raptor).toBe(false);- expect(parserConfig.graphrag.use_graphrag).toBe(false);- });-- it('keeps form defaults when saved settings omit the enable flags', () => {- const parserConfig = renderConfigurationHook({- raptor: { ext: { clustering_method: 'gmm' } },- graphrag: {},- });-- expect(parserConfig.raptor.use_raptor).toBe(true);- expect(parserConfig.graphrag.use_graphrag).toBe(true);- });-});diff --git a/web/src/pages/dataset/setting/python/hooks.ts b/web/src/pages/dataset/setting/python/hooks.tsindex eed3e89014..42aebe4985 100644--- a/web/src/pages/dataset/setting/python/hooks.ts+++ b/web/src/pages/dataset/setting/python/hooks.ts@@ -37,16 +37,6 @@ export const useFetchKnowledgeConfigurationOnMount = (const parser_config = {...form.formState?.defaultValues?.parser_config,...knowledgeDetails.parser_config,- raptor: {- ...form.formState?.defaultValues?.parser_config?.raptor,- ...knowledgeDetails.parser_config?.raptor,- clustering_method:- knowledgeDetails.parser_config?.raptor?.ext?.clustering_method,- },- graphrag: {- ...form.formState?.defaultValues?.parser_config?.graphrag,- ...knowledgeDetails.parser_config?.graphrag,- },};const formValues = {...pick({ ...knowledgeDetails, parser_config: parser_config }, [diff --git a/web/src/pages/dataset/setting/python/index.tsx b/web/src/pages/dataset/setting/python/index.tsxindex 0e004c3b12..c7fd5ccbe9 100644--- a/web/src/pages/dataset/setting/python/index.tsx+++ b/web/src/pages/dataset/setting/python/index.tsx@@ -41,20 +41,6 @@ export const DataSetContext = createContext<{knowledgeDetails: IDataset;}>({ loading: false, knowledgeDetails: {} as IDataset });-const initialEntityTypes = [- 'organization',- 'person',- 'geo',- 'event',- 'category',-];--const enum MethodValue {- General = 'general',- Light = 'light',- NER = 'ner',-}-export default function DatasetSettings() {const { t } = useTranslation();@@ -82,23 +68,6 @@ export default function DatasetSettings() {mineru_formula_enable: true,mineru_table_enable: true,mineru_lang: 'English',- raptor: {- use_raptor: true,- max_token: 256,- threshold: 0.1,- max_cluster: 64,- random_seed: 0,- scope: 'file',- clustering_method: 'gmm',- tree_builder: 'raptor',- prompt: t('knowledgeConfiguration.promptText'),- },- graphrag: {- use_graphrag: true,- entity_types: initialEntityTypes,- method: MethodValue.Light,- batch_chunk_token_size: 4096,- },metadata: {type: 'object',properties: {},