Fix: create dataset with chunk_method or pipeline (#13814)

### What problem does this PR solve?

Allow create datasets with parse_type == 1/None and chunk_method, or
parse_type == 2 and pipeline_id.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Lynn
2026-03-26 20:43:53 +08:00
committed by GitHub
parent 6a4a9debd2
commit 8d4a3d0dfe
2 changed files with 19 additions and 21 deletions

View File

@ -217,6 +217,10 @@ async def update_dataset(tenant_id: str, dataset_id: str, req: dict):
elif "parser_config" in req and not req["parser_config"]:
del req["parser_config"]
if kb.pipeline_id and req.get("parser_id") and not req.get("pipeline_id"):
# shift to use parser_id, delete old pipeline_id
req["pipeline_id"] = ""
if "name" in req and req["name"].lower() != kb.name.lower():
exists = KnowledgebaseService.get_or_none(name=req["name"], tenant_id=tenant_id,
status=StatusEnum.VALID.value)
@ -245,6 +249,8 @@ async def update_dataset(tenant_id: str, dataset_id: str, req: dict):
from rag.nlp import search
settings.docStoreConn.update({"exists": PAGERANK_FLD}, {"remove": PAGERANK_FLD},
search.index_name(kb.tenant_id), kb.id)
if "parse_type" in req:
del req["parse_type"]
if not KnowledgebaseService.update_by_id(kb.id, req):
return False, "Update dataset error.(Database error)"