(request: InsertRequest)
| 217 | |
| 218 | @app.post("/insert", response_model=Response) |
| 219 | async def insert_endpoint(request: InsertRequest): |
| 220 | try: |
| 221 | loop = asyncio.get_event_loop() |
| 222 | await loop.run_in_executor(None, lambda: rag.insert(request.text)) |
| 223 | return Response(status="success", message="Text inserted successfully") |
| 224 | except Exception as e: |
| 225 | raise HTTPException(status_code=500, detail=str(e)) |
| 226 | |
| 227 | |
| 228 | @app.post("/insert_file", response_model=Response) |