Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Refactor:Improve insert file logic (#8445)

Stephen Hu382d2d0373fe
diff --git a/api/apps/file_app.py b/api/apps/file_app.py
index e06c9650cd..eabe7bd9b1 100644
--- a/api/apps/file_app.py
+++ b/api/apps/file_app.py
@@ -99,6 +99,7 @@ def upload():
FileService.query,
name=file_obj_names[file_len - 1],
parent_id=last_folder.id)
+ STORAGE_IMPL.put(last_folder.id, location, blob)
file = {
"id": get_uuid(),
"parent_id": last_folder.id,
@@ -110,7 +111,6 @@ def upload():
"size": len(blob),
}
file = FileService.insert(file)
- STORAGE_IMPL.put(last_folder.id, location, blob)
file_res.append(file.to_json())
return get_json_result(data=file_res)
except Exception as e: