Spaces:
Sleeping
Sleeping
fix point empty - upset
Browse files
core/document_ingest_service.py
CHANGED
|
@@ -448,10 +448,15 @@ def process_document_ingest(
|
|
| 448 |
effective_source_path=effective_source_path,
|
| 449 |
)
|
| 450 |
|
| 451 |
-
|
|
|
|
|
|
|
| 452 |
|
| 453 |
db.query(DocumentChunk).filter(DocumentChunk.document_id == document.id).delete()
|
| 454 |
-
|
|
|
|
|
|
|
|
|
|
| 455 |
|
| 456 |
if effective_source_path:
|
| 457 |
document.path = effective_source_path
|
|
|
|
| 448 |
effective_source_path=effective_source_path,
|
| 449 |
)
|
| 450 |
|
| 451 |
+
# ✅ Chỉ upsert nếu có points mới (không phải cập nhật existing)
|
| 452 |
+
if points:
|
| 453 |
+
client.upsert(collection_name=target_collection, points=points, wait=True)
|
| 454 |
|
| 455 |
db.query(DocumentChunk).filter(DocumentChunk.document_id == document.id).delete()
|
| 456 |
+
|
| 457 |
+
# ✅ Chỉ bulk save nếu có chunks mới
|
| 458 |
+
if db_chunk_rows:
|
| 459 |
+
db.bulk_save_objects(db_chunk_rows)
|
| 460 |
|
| 461 |
if effective_source_path:
|
| 462 |
document.path = effective_source_path
|