NOVA / app /modules /search /router.py
S-4-G-4-R's picture
Initial commit
20b15f3
Raw
History Blame Contribute Delete
590 Bytes
from fastapi import APIRouter, HTTPException
from app.modules.search.jobs import get_job
from app.modules.search.schemas import SearchStatusResponse
router = APIRouter(prefix="/search", tags=["search"])
@router.get("/status/{job_id}", response_model=SearchStatusResponse)
def search_status(job_id: str):
"""Poll this until status is 'done' (or 'error'). On 'done',
clustered_papers is the final payload the UI renders."""
job = get_job(job_id)
if job is None:
raise HTTPException(status_code=404, detail="Unknown job_id.")
return SearchStatusResponse(**job)