RAG document ingestion
This page talks directly to your FastAPI app. File uploads use POST /ingest/file, /ingest/url, or /ingest/crawl. File uploads use multipart field file (PDF or HTML). Same filename replaces existing rows for that source.
Set NEXT_PUBLIC_RAG_API_URL in .env.local to your FastAPI root (e.g. http://127.0.0.1:8000). Local dev uses that default when the variable is omitted; production builds require it.
Upload file
Do not set Content-Type manually; the browser sets multipart boundaries.
Ingest from URL
POST /ingest/url with JSON { "url": "…" }. Source in the DB is the URL string.
Crawl from start URL
POST /ingest/crawl with JSON { "start_url": "…" }. Only start_url is required. This can take a while for large sites.
FastAPI must allow browser requests from this site (CORS), e.g. CORSMiddleware with http://localhost:3000. API keys and Supabase stay on the server; only the public API base URL is in NEXT_PUBLIC_RAG_API_URL.