Spaces:
Sleeping
Sleeping
Commit ·
712a66b
1
Parent(s): a96851e
Auto-commit: app.py updated
Browse files495 unmodified lines496497498499500501495 unmodified linesreturn JSONResponse(result)@app.get("/health")async def health():"""Health check endpoint"""495 unmodified lines496497498499500501502503504505506507508509510511512513514515516517518519520521495 unmodified linesreturn JSONResponse(result)@app.get("/preview/{preview_id}")async def get_preview(preview_id: str):"""Get live preview of executed codeAI agents can GET this URL to view the rendered frontend"""# Clean expired previewsnow = datetime.now()expired_keys = [k for k, v in PREVIEW_STORAGE.items() if now - v["created"] > PREVIEW_EXPIRY]for key in expired_keys:del PREVIEW_STORAGE[key]# Return previewpreview = PREVIEW_STORAGE.get(preview_id)if not preview:return HTMLResponse("<h1>Preview not found or expired</h1><p>Previews expire after 1 hour.</p>", status_code=404)return HTMLResponse(preview["html"])@app.get("/health")async def health():"""Health check endpoint"""
app.py+20