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

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from typing import Any
from .base import Base
from .document import Document
@ -151,3 +151,23 @@ class DataSet(Base):
res = res.json()
if res.get("code") != 0:
raise Exception(res.get("message"))
def get_auto_metadata(self) -> dict[str, Any]:
"""
Retrieve auto-metadata configuration for a dataset via SDK.
"""
res = self.get(f"/datasets/{self.id}/auto_metadata")
res = res.json()
if res.get("code") == 0:
return res["data"]
raise Exception(res["message"])
def update_auto_metadata(self, **config: Any) -> dict[str, Any]:
"""
Update auto-metadata configuration for a dataset via SDK.
"""
res = self.put(f"/datasets/{self.id}/auto_metadata", config)
res = res.json()
if res.get("code") == 0:
return res["data"]
raise Exception(res["message"])

View File

@ -111,26 +111,6 @@ class RAGFlow:
return result_list
raise Exception(res["message"])
def get_auto_metadata(self, dataset_id: str) -> dict[str, Any]:
"""
Retrieve auto-metadata configuration for a dataset via SDK.
"""
res = self.get(f"/datasets/{dataset_id}/auto_metadata")
res = res.json()
if res.get("code") == 0:
return res["data"]
raise Exception(res["message"])
def update_auto_metadata(self, dataset_id: str, **config: Any) -> dict[str, Any]:
"""
Update auto-metadata configuration for a dataset via SDK.
"""
res = self.put(f"/datasets/{dataset_id}/auto_metadata", config)
res = res.json()
if res.get("code") == 0:
return res["data"]
raise Exception(res["message"])
def create_chat(self, name: str, avatar: str = "", dataset_ids=None, llm: Chat.LLM | None = None, prompt: Chat.Prompt | None = None) -> Chat:
if dataset_ids is None:
dataset_ids = []