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

@@ -19,7 +19,7 @@ from types import SimpleNamespace
from concurrent.futures import ThreadPoolExecutor, as_completed
import pytest
from common import create_document, list_kbs
from test_web_api.common import create_document, list_datasets
from configs import DOCUMENT_NAME_LIMIT, INVALID_API_TOKEN
from libs.auth import RAGFlowWebApiAuth
from utils.file_utils import create_txt_file
@@ -91,8 +91,8 @@ class TestDocumentCreate:
assert len(responses) == count, responses
assert all(future.result()["code"] == 0 for future in futures), responses
res = list_kbs(WebApiAuth, {"id": kb_id})
assert res["data"]["kbs"][0]["doc_num"] == count, res
res = list_datasets(WebApiAuth, {"id": kb_id})
assert res["data"][0]["document_count"] == count, res
def _run(coro):

View File

@@ -20,7 +20,7 @@ from types import ModuleType, SimpleNamespace
from concurrent.futures import ThreadPoolExecutor, as_completed
import pytest
from common import list_kbs, upload_documents
from common import list_datasets, upload_documents
from configs import DOCUMENT_NAME_LIMIT, INVALID_API_TOKEN
from libs.auth import RAGFlowWebApiAuth
from utils.file_utils import create_txt_file
@@ -172,8 +172,8 @@ class TestDocumentsUpload:
res = upload_documents(WebApiAuth, {"kb_id": kb_id}, fps)
assert res["code"] == 0, res
res = list_kbs(WebApiAuth)
assert res["data"]["kbs"][0]["doc_num"] == expected_document_count, res
res = list_datasets(WebApiAuth)
assert res["data"][0]["document_count"] == expected_document_count, res
@pytest.mark.p3
def test_concurrent_upload(self, WebApiAuth, add_dataset_func, tmp_path):
@@ -191,8 +191,8 @@ class TestDocumentsUpload:
assert len(responses) == count, responses
assert all(future.result()["code"] == 0 for future in futures), responses
res = list_kbs(WebApiAuth)
assert res["data"]["kbs"][0]["doc_num"] == count, res
res = list_datasets(WebApiAuth)
assert res["data"][0]["document_count"] == count, res
class _AwaitableValue: