Spaces:
Running
Running
deploy: phase 3 BYOK backend (Dockerfile.hf, FastAPI on 7860)
Browse filesFiles changed (2)
15 unmodified lines161718192021198 unmodified lines22022122222322422522615 unmodified lines".docx",".doc",".txt",".png",".jpg",".jpeg",198 unmodified linesreturn load_pdf(path)elif ext in {".docx", ".doc"}:return load_docx(path)elif ext == ".txt":return load_text(path)elif ext in _IMAGE_EXTENSIONS:return load_image(path)15 unmodified lines1617181920212223198 unmodified lines22222322422522622722822923015 unmodified lines".docx",".doc",".txt",".md",".markdown",".png",".jpg",".jpeg",198 unmodified linesreturn load_pdf(path)elif ext in {".docx", ".doc"}:return load_docx(path)elif ext in {".txt", ".md", ".markdown"}:# Markdown is plain text for retrieval purposes — the `[N]` citation# contract works on raw text, and chunking is markup-agnostic.return load_text(path)elif ext in _IMAGE_EXTENSIONS:return load_image(path)
936 unmodified lines937938939940941942936 unmodified lines),},)# Tag every newly-upserted chunk with the file_id + ingested_at# so the list and delete endpoints can group by file.if result.point_ids:936 unmodified lines937938939940941942943944945946947948949950951952953954955956957958959960961936 unmodified lines),},)# Ingestion produced nothing usable (loader/parse failure, or a# file with no extractable text). Returning 200 with# status="failed" looked like success to the client and the file# silently never appeared. Surface it as a 422 so the UI shows a# real, immediate error instead of waiting on a phantom upload.if result.status == "failed" or not result.point_ids:raise HTTPException(status.HTTP_422_UNPROCESSABLE_ENTITY,detail={"reason": "ingestion_failed","errors": result.errors or ["No extractable text in the file."],"hint": ("Could not extract text from this file. Scanned PDFs ""without a text layer and empty files won't ingest — ""try a text-based .txt, .md, or .pdf."),},)# Tag every newly-upserted chunk with the file_id + ingested_at# so the list and delete endpoints can group by file.if result.point_ids:
ingestion/loaders.py+5-1
interfaces/api.py+19