chouchouvs commited on
Commit
1bf0e3f
·
verified ·
1 Parent(s): 1379580

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +22 -0
main.py CHANGED
@@ -492,6 +492,28 @@ def run_index_job(job_id: str, req: IndexRequest):
492
  _set_status(job_id, "running")
493
  _append_log(job_id, f"Start project={req.project_id} files={len(req.files)} | backends={EMB_BACKEND_ORDER} | store={VECTOR_STORE} (deterministic_ids={QDRANT_DETERMINISTIC_IDS}, mode={QDRANT_ID_MODE})")
494
  LOG.info(f"[{job_id}] Index start project={req.project_id} files={len(req.files)}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
 
496
  col = f"proj_{req.project_id}"
497
 
 
492
  _set_status(job_id, "running")
493
  _append_log(job_id, f"Start project={req.project_id} files={len(req.files)} | backends={EMB_BACKEND_ORDER} | store={VECTOR_STORE} (deterministic_ids={QDRANT_DETERMINISTIC_IDS}, mode={QDRANT_ID_MODE})")
494
  LOG.info(f"[{job_id}] Index start project={req.project_id} files={len(req.files)}")
495
+ # --- DEBUG DIAGNOSTIC (INSÈRE ICI) ---
496
+ # Log sample files received (first N)
497
+ try:
498
+ N_SAMPLE = 6
499
+ sample = req.files[:N_SAMPLE]
500
+ seen_hashes = {}
501
+ for fidx, fi in enumerate(sample, 1):
502
+ p = getattr(fi, "path", "") or ""
503
+ t = getattr(fi, "text", "") or ""
504
+ h = hashlib.blake2b(t.encode("utf-8", "ignore"), digest_size=8).hexdigest()
505
+ seen_hashes.setdefault(h, []).append(p)
506
+ LOG.info(f"[{job_id}] recv file #{fidx}: path={p!r} len_text={len(t)} hash8={h} preview={repr(t[:120])}")
507
+ # summary
508
+ if len(req.files) > N_SAMPLE:
509
+ LOG.info(f"[{job_id}] ... and {len(req.files)-N_SAMPLE} more files")
510
+ # If most files share same hash, warn
511
+ if len(seen_hashes) == 1 and len(req.files) > 1:
512
+ _append_log(job_id, "⚠️ All received files appear IDENTICAL (same hash). Possible client-side bug.")
513
+ LOG.warning("[%s] All files identical by hash8=%s", job_id, list(seen_hashes.keys())[0])
514
+ except Exception as _e:
515
+ LOG.exception("Debug sample failed: %s", _e)
516
+ # --- end debug block ---
517
 
518
  col = f"proj_{req.project_id}"
519