Refactor: dataset / kb API to RESTFul style (#13690)

### What problem does this PR solve?

1. Split dataset api to gateway and service, and modify web UI to use
restful http api.
2. Old KB releated APIs are commented.

### Type of change

- [x] Refactoring

---------

Co-authored-by: Yingfeng <yingfeng.zhang@gmail.com>
This commit is contained in:
Lynn
2026-03-19 14:41:36 +08:00
committed by GitHub
parent 7827f0fce5
commit 4bb1acaa5b
53 changed files with 1721 additions and 1207 deletions

View File

@ -409,7 +409,7 @@ def _load_dataset_module(monkeypatch):
rag_nlp_pkg.search = search_mod
module_name = "test_dataset_sdk_routes_unit_module"
module_path = repo_root / "api" / "apps" / "sdk" / "dataset.py"
module_path = repo_root / "api" / "apps" / "restful_apis" / "dataset_api.py"
spec = importlib.util.spec_from_file_location(module_name, module_path)
module = importlib.util.module_from_spec(spec)
module.manager = _DummyManager()
@ -418,7 +418,7 @@ def _load_dataset_module(monkeypatch):
return module
@pytest.mark.p2
@pytest.mark.p3
def test_create_route_error_matrix_unit(monkeypatch):
module = _load_dataset_module(monkeypatch)
req_state = {"name": "kb"}
@ -448,7 +448,7 @@ def test_create_route_error_matrix_unit(monkeypatch):
assert res["message"] == "Database operation failed", res
@pytest.mark.p2
@pytest.mark.p3
def test_delete_route_error_summary_matrix_unit(monkeypatch):
module = _load_dataset_module(monkeypatch)
req_state = {"ids": ["kb-1"]}
@ -476,7 +476,7 @@ def test_delete_route_error_summary_matrix_unit(monkeypatch):
assert res["code"] == module.RetCode.SUCCESS, res
@pytest.mark.p2
@pytest.mark.p3
def test_update_route_branch_matrix_unit(monkeypatch):
module = _load_dataset_module(monkeypatch)
req_state = {"name": "new"}
@ -556,7 +556,7 @@ def test_update_route_branch_matrix_unit(monkeypatch):
assert res["message"] == "Database operation failed", res
@pytest.mark.p2
@pytest.mark.p3
def test_list_knowledge_graph_delete_kg_matrix_unit(monkeypatch):
module = _load_dataset_module(monkeypatch)
@ -629,7 +629,7 @@ def test_list_knowledge_graph_delete_kg_matrix_unit(monkeypatch):
assert res["code"] == module.RetCode.AUTHENTICATION_ERROR, res
@pytest.mark.p2
@pytest.mark.p3
def test_run_trace_graphrag_matrix_unit(monkeypatch):
module = _load_dataset_module(monkeypatch)
@ -705,7 +705,7 @@ def test_run_trace_graphrag_matrix_unit(monkeypatch):
assert res["data"]["id"] == "task-1", res
@pytest.mark.p2
@pytest.mark.p3
def test_run_trace_raptor_matrix_unit(monkeypatch):
module = _load_dataset_module(monkeypatch)