tech-updates / app /api /v1 /endpoints /trigger.py
HFShishir's picture
Deploy BytePulse AI Backend v1.0
ef58e1a verified
Raw History Blame Contribute Delete
855 Bytes
from fastapi import APIRouter, BackgroundTasks
from app.scheduler.cron import run_daily_tech_digest_pipeline
router = APIRouter()
@router.post("")
async def trigger_manual_scrape(background_tasks: BackgroundTasks):
"""
Manually triggers the tech update scraping, LangChain AI summarization, ChromaDB indexing, and FCM push notification pipeline.
Runs asynchronously in background tasks.
"""
background_tasks.add_task(run_daily_tech_digest_pipeline)
return {
"status": "triggered",
"message": "Daily tech update pipeline started in background. Check /api/v1/digests/latest shortly."
}
@router.post("/sync")
async def trigger_manual_scrape_sync():
"""
Synchronously triggers the pipeline and returns the result immediately.
"""
result = await run_daily_tech_digest_pipeline()
return result