feat: Initialize frontend with React, Vite, and Tailwind CSS
- Set up main entry point for React application. - Create About, Home, NotFound, Privacy, and Terms pages with SEO support. - Implement API service for file uploads and task management. - Add global styles using Tailwind CSS. - Create utility functions for SEO and text processing. - Configure Vite for development and production builds. - Set up Nginx configuration for serving frontend and backend. - Add scripts for cleanup of expired files and sitemap generation. - Implement deployment script for production environment.
This commit is contained in:
39
backend/app/routes/tasks.py
Normal file
39
backend/app/routes/tasks.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""Task status polling endpoint."""
|
||||
from flask import Blueprint, jsonify
|
||||
from celery.result import AsyncResult
|
||||
|
||||
from app.extensions import celery
|
||||
|
||||
tasks_bp = Blueprint("tasks", __name__)
|
||||
|
||||
|
||||
@tasks_bp.route("/<task_id>/status", methods=["GET"])
|
||||
def get_task_status(task_id: str):
|
||||
"""
|
||||
Get the status of an async task.
|
||||
|
||||
Returns:
|
||||
JSON with task state and result (if completed)
|
||||
"""
|
||||
result = AsyncResult(task_id, app=celery)
|
||||
|
||||
response = {
|
||||
"task_id": task_id,
|
||||
"state": result.state,
|
||||
}
|
||||
|
||||
if result.state == "PENDING":
|
||||
response["progress"] = "Task is waiting in queue..."
|
||||
|
||||
elif result.state == "PROCESSING":
|
||||
meta = result.info or {}
|
||||
response["progress"] = meta.get("step", "Processing...")
|
||||
|
||||
elif result.state == "SUCCESS":
|
||||
task_result = result.result or {}
|
||||
response["result"] = task_result
|
||||
|
||||
elif result.state == "FAILURE":
|
||||
response["error"] = str(result.info) if result.info else "Task failed."
|
||||
|
||||
return jsonify(response)
|
||||
Reference in New Issue
Block a user