entidi2608 commited on
Commit
5ac785f
·
1 Parent(s): 7f9bd61
Files changed (1) hide show
  1. routers/documents.py +4 -4
routers/documents.py CHANGED
@@ -63,9 +63,9 @@ async def upload_and_ingest_documents(
63
  file_hash = calculate_file_hash(temp_file_path)
64
 
65
  # 3. Kiểm tra trùng lặp
66
- if check_if_hash_exists(file_hash):
67
- skipped_files.append({"filename": file.filename, "reason": "Duplicate file (content already processed)"})
68
- os.remove(temp_file_path) # Xóa file tạm
69
  continue
70
 
71
  # 4. File hợp lệ, chuẩn bị để xử lý
@@ -81,7 +81,7 @@ async def upload_and_ingest_documents(
81
  temp_file_path = None # Đánh dấu là đã di chuyển
82
 
83
  # 5. Thêm tác vụ nền cho file này
84
- background_tasks.add_task(full_process_and_ingest_pipeline, final_file_path, file_hash,embedding_model)
85
 
86
  accepted_files.append({"filename": final_filename, "hash": file_hash})
87
 
 
63
  file_hash = calculate_file_hash(temp_file_path)
64
 
65
  # 3. Kiểm tra trùng lặp
66
+ if await check_if_hash_exists(file_hash):
67
+ skipped_files.append({"filename": file.filename, "reason": "Duplicate file content"})
68
+ os.remove(temp_file_path)
69
  continue
70
 
71
  # 4. File hợp lệ, chuẩn bị để xử lý
 
81
  temp_file_path = None # Đánh dấu là đã di chuyển
82
 
83
  # 5. Thêm tác vụ nền cho file này
84
+ background_tasks.add_task(await full_process_and_ingest_pipeline, final_file_path, file_hash,embedding_model)
85
 
86
  accepted_files.append({"filename": final_filename, "hash": file_hash})
87