mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-03-18 21:30:01 +08:00
Revert "Refactor: dataset / kb API to RESTFul style" (#13646)
Reverts infiniflow/ragflow#13619
This commit is contained in:
@ -27,7 +27,6 @@ from pydantic import (
|
||||
ValidationError,
|
||||
field_validator,
|
||||
model_validator,
|
||||
ValidationInfo
|
||||
)
|
||||
from pydantic_core import PydanticCustomError
|
||||
from werkzeug.exceptions import BadRequest, UnsupportedMediaType
|
||||
@ -163,15 +162,6 @@ def validate_and_parse_request_args(request: Request, validator: type[BaseModel]
|
||||
- Preserves type conversion from Pydantic validation
|
||||
"""
|
||||
args = request.args.to_dict(flat=True)
|
||||
|
||||
# Handle ext parameter: parse JSON string to dict if it's a string
|
||||
if 'ext' in args and isinstance(args['ext'], str):
|
||||
import json
|
||||
try:
|
||||
args['ext'] = json.loads(args['ext'])
|
||||
except json.JSONDecodeError:
|
||||
pass # Keep the string and let validation handle the error
|
||||
|
||||
try:
|
||||
if extras is not None:
|
||||
args.update(extras)
|
||||
@ -346,7 +336,6 @@ class RaptorConfig(Base):
|
||||
max_cluster: Annotated[int, Field(default=64, ge=1, le=1024)]
|
||||
random_seed: Annotated[int, Field(default=0, ge=0)]
|
||||
auto_disable_for_structured_data: Annotated[bool, Field(default=True)]
|
||||
ext: Annotated[dict, Field(default={})]
|
||||
|
||||
|
||||
class GraphragConfig(Base):
|
||||
@ -388,7 +377,6 @@ class ParserConfig(Base):
|
||||
filename_embd_weight: Annotated[float | None, Field(default=0.1, ge=0.0, le=1.0)]
|
||||
task_page_size: Annotated[int | None, Field(default=None, ge=1)]
|
||||
pages: Annotated[list[list[int]] | None, Field(default=None)]
|
||||
ext: Annotated[dict, Field(default={})]
|
||||
|
||||
|
||||
class CreateDatasetReq(Base):
|
||||
@ -402,25 +390,6 @@ class CreateDatasetReq(Base):
|
||||
pipeline_id: Annotated[str | None, Field(default=None, min_length=32, max_length=32, serialization_alias="pipeline_id")]
|
||||
parser_config: Annotated[ParserConfig | None, Field(default=None)]
|
||||
auto_metadata_config: Annotated[AutoMetadataConfig | None, Field(default=None)]
|
||||
ext: Annotated[dict, Field(default={})]
|
||||
|
||||
@field_validator("pipeline_id", mode="before")
|
||||
@classmethod
|
||||
def handle_pipeline_id(cls, v: str | None, info: ValidationInfo):
|
||||
if v is None:
|
||||
return v
|
||||
if info.data.get("chunk_method") is not None and isinstance(v, str):
|
||||
v = None
|
||||
return v
|
||||
|
||||
@field_validator("parse_type", mode="before")
|
||||
@classmethod
|
||||
def handle_parse_type(cls, v: int | None, info: ValidationInfo):
|
||||
if v is None:
|
||||
return v
|
||||
if info.data.get("chunk_method") is not None and isinstance(v, int):
|
||||
v = None
|
||||
return v
|
||||
|
||||
@field_validator("avatar", mode="after")
|
||||
@classmethod
|
||||
@ -778,4 +747,3 @@ class BaseListReq(BaseModel):
|
||||
|
||||
class ListDatasetReq(BaseListReq):
|
||||
include_parsing_status: Annotated[bool, Field(default=False)]
|
||||
ext: Annotated[dict, Field(default={})]
|
||||
|
||||
Reference in New Issue
Block a user