refactor: 客服agent的切片结构调整重构
This commit is contained in:
+13
-9
@@ -78,15 +78,19 @@ async def confirm_document_upload(
|
||||
_: SysUser = Depends(require_knowledge_operator),
|
||||
):
|
||||
try:
|
||||
body = await request.json()
|
||||
form = await request.form()
|
||||
upload = form.get("file")
|
||||
if upload is None or not hasattr(upload, "read"):
|
||||
raise UploadValidationError("缺少上传文件")
|
||||
result = await _service(request).confirm(
|
||||
upload_id=body.get("upload_id", ""),
|
||||
title=body.get("title", ""),
|
||||
doc_id=body.get("doc_id", ""),
|
||||
collection_name=body.get("collection_name", ""),
|
||||
strategy=body.get("strategy", ""),
|
||||
chunk_size=body.get("chunk_size"),
|
||||
chunk_overlap=body.get("chunk_overlap"),
|
||||
filename=upload.filename,
|
||||
content=await upload.read(),
|
||||
title=form.get("title", ""),
|
||||
doc_id=form.get("doc_id", ""),
|
||||
collection_name=form.get("collection_name", ""),
|
||||
strategy=form.get("strategy", ""),
|
||||
chunk_size=_optional_int(form.get("chunk_size")),
|
||||
chunk_overlap=_optional_int(form.get("chunk_overlap")),
|
||||
)
|
||||
return success(result)
|
||||
except (UploadValidationError, ValueError) as exc:
|
||||
@@ -105,4 +109,4 @@ async def delete_document(
|
||||
return success(result)
|
||||
except (UploadValidationError, ValueError) as exc:
|
||||
response = fail(400, str(exc))
|
||||
return JSONResponse(status_code=400, content=response.model_dump())
|
||||
return JSONResponse(status_code=400, content=response.model_dump())
|
||||
Reference in New Issue
Block a user