chouchouvs commited on
Commit
8bbbad5
·
verified ·
1 Parent(s): 5c37037

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +8 -4
main.py CHANGED
@@ -191,7 +191,12 @@ async def qdrant_count(client: httpx.AsyncClient, coll: str) -> int:
191
 
192
  async def qdrant_search(client: httpx.AsyncClient, coll: str, vector: List[float], limit: int = 5) -> Dict[str, Any]:
193
  url = f"{QDRANT_URL}/collections/{coll}/points/search"
194
- r = await client.post(url, headers={"api-key": QDRANT_API_KEY}, json={"vector": vector, "limit": limit, "with_payload": True}, timeout=30)
 
 
 
 
 
195
  if r.status_code != 200:
196
  raise HTTPException(status_code=500, detail=f"Qdrant search échoué: {r.text}")
197
  return r.json()
@@ -468,7 +473,7 @@ async def ui_index_sample(project: str, chunk_size: int, overlap: int, batch_siz
468
  store_text=store_text,
469
  )
470
  try:
471
- job = create_and_start_job(req) # ← lance dans le thread dédié
472
  return f"🚀 Job lancé: {job.job_id}", job.job_id
473
  except ValidationError as ve:
474
  return f"❌ Payload invalide: {ve}", ""
@@ -485,7 +490,7 @@ async def ui_status(job_id: str):
485
  lines += st.get("messages", [])[-50:]
486
  if st.get("errors"):
487
  lines.append("Erreurs:")
488
- lines += [f" - {e}" for e in st["errors"]]
489
  return "\n".join(lines)
490
  except Exception as e:
491
  return f"❌ Status erreur: {e}"
@@ -558,7 +563,6 @@ with gr.Blocks(title="Remote Indexer — Tests sans console", analytics_enabled=
558
  auto_chk.change(lambda x: gr.update(active=x), inputs=auto_chk, outputs=timer)
559
 
560
  # Monte l'UI Gradio
561
- fastapi_app.mount("/static", gr.routes.App.get_blocks().static_files) # pour servir les assets si nécessaire
562
  app = gr.mount_gradio_app(fastapi_app, ui, path=UI_PATH)
563
 
564
  if __name__ == "__main__":
 
191
 
192
  async def qdrant_search(client: httpx.AsyncClient, coll: str, vector: List[float], limit: int = 5) -> Dict[str, Any]:
193
  url = f"{QDRANT_URL}/collections/{coll}/points/search"
194
+ r = await client.post(
195
+ url,
196
+ headers={"api-key": QDRANT_API_KEY},
197
+ json={"vector": vector, "limit": limit, "with_payload": True},
198
+ timeout=30,
199
+ )
200
  if r.status_code != 200:
201
  raise HTTPException(status_code=500, detail=f"Qdrant search échoué: {r.text}")
202
  return r.json()
 
473
  store_text=store_text,
474
  )
475
  try:
476
+ job = create_and_start_job(req)
477
  return f"🚀 Job lancé: {job.job_id}", job.job_id
478
  except ValidationError as ve:
479
  return f"❌ Payload invalide: {ve}", ""
 
490
  lines += st.get("messages", [])[-50:]
491
  if st.get("errors"):
492
  lines.append("Erreurs:")
493
+ lines += [f" - {e}" for e in st['errors']]
494
  return "\n".join(lines)
495
  except Exception as e:
496
  return f"❌ Status erreur: {e}"
 
563
  auto_chk.change(lambda x: gr.update(active=x), inputs=auto_chk, outputs=timer)
564
 
565
  # Monte l'UI Gradio
 
566
  app = gr.mount_gradio_app(fastapi_app, ui, path=UI_PATH)
567
 
568
  if __name__ == "__main__":