fix: improve incremental wiki compilation (#18164)

This commit is contained in:
buua436
2026-08-12 19:12:39 +08:00
committed by GitHub
parent 3d64f8d044
commit 649b631cac
7 changed files with 1231 additions and 118 deletions

View File

@@ -381,3 +381,39 @@ def test_string_list_decodes_legacy_json_and_native_arrays(monkeypatch):
assert module._string_list('["doc_1", "doc_2"]') == ["doc_1", "doc_2"]
assert module._string_list(["doc_1", "doc_2", "doc_1"]) == ["doc_1", "doc_2"]
assert module._string_list("doc_1###doc_2") == ["doc_1", "doc_2"]
def test_wiki_alteration_treats_wiki_template_as_eligible(monkeypatch):
module, _, _ = _load_list_datasets_module(
monkeypatch,
kbs=[],
parsing_status_by_kb={},
)
_stub(
monkeypatch,
"api.db.services.compilation_template_service",
CompilationTemplateService=SimpleNamespace(
get_saved=lambda template_id, tenant_id: {
"id": template_id,
"kind": "wiki",
"config": {"kind": "wiki"},
}
),
)
_stub(monkeypatch, "rag.svr", __path__=[])
_stub(monkeypatch, "rag.svr.task_executor_refactor", __path__=[])
_stub(
monkeypatch,
"rag.svr.task_executor_refactor.chunk_post_processor",
_parser_config_compilation_template_ids=lambda parser_config, tenant_id: parser_config.get("compilation_template_ids", []),
)
docs = [
{
"id": "doc-wiki",
"status": "1",
"parser_config": {"compilation_template_ids": ["template-wiki"]},
}
]
assert module._eligible_doc_ids_for_kind(docs, "tenant-1", "wiki") == {"doc-wiki"}