RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
feat: handle partial upload success in document batch upload (#16438)
euvrea339e8a57947
diff --git a/api/apps/restful_apis/document_api.py b/api/apps/restful_apis/document_api.pyindex 07edadfe5c..846174b10e 100644--- a/api/apps/restful_apis/document_api.py+++ b/api/apps/restful_apis/document_api.py@@ -608,7 +608,11 @@ async def _upload_local_documents(kb, tenant_id):parent_path=form.get("parent_path"),parser_config_override=parser_config_override,)- if err:++ # Handle partial success: some files uploaded successfully, some had errors+ is_partial_success = err and files++ if err and not is_partial_success:msg = "\n".join(err)logging.error(msg)return get_error_data_result(message=msg, code=RetCode.SERVER_ERROR)@@ -622,10 +626,17 @@ async def _upload_local_documents(kb, tenant_id):return_raw_files = request.args.get("return_raw_files", "false").lower() == "true"if return_raw_files:- return get_result(data=files)+ doc_data = files+ else:+ doc_data = [map_doc_keys_with_run_status(doc, run_status="0") for doc in files]++ # For partial success, include error message along with successful uploads+ if is_partial_success:+ msg = "\n".join(err)+ logging.warning(f"Partial upload success: {len(files)} succeeded, {len(err)} failed - {msg}")+ return construct_json_result(code=RetCode.SERVER_ERROR, message=msg, data=doc_data)- renamed_doc_list = [map_doc_keys_with_run_status(doc, run_status="0") for doc in files]- return get_result(data=renamed_doc_list)+ return get_result(data=doc_data)@manager.route("/datasets/<dataset_id>/documents", methods=["GET"]) # noqa: F821diff --git a/web/src/pages/dataset/dataset/use-upload-document.ts b/web/src/pages/dataset/dataset/use-upload-document.tsindex f96c1a8dbe..5b41cd7900 100644--- a/web/src/pages/dataset/dataset/use-upload-document.ts+++ b/web/src/pages/dataset/dataset/use-upload-document.ts@@ -47,7 +47,12 @@ export const useHandleUploadDocument = () => {return;}- if (isSuccess && parseOnCreation) {+ // Trigger parsing for both full and partial success when parseOnCreation is enabled+ if (+ (isSuccess || isPartialSuccess) &&+ parseOnCreation &&+ ret.data?.length > 0+ ) {runDocumentByIds({documentIds: ret.data.map((x: any) => x.id),run: 1,