Simple web backend added with upload/status/process/download API
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
"""Status query endpoint."""
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
|
||||
from backend.models.response import StatusResponse
|
||||
from backend.services.task_manager import task_manager
|
||||
|
||||
router = APIRouter(prefix="/api", tags=["status"])
|
||||
|
||||
|
||||
@router.get("/status/{task_id}", response_model=StatusResponse)
|
||||
async def get_status(task_id: str):
|
||||
if not task_manager.has_task(task_id):
|
||||
raise HTTPException(status_code=404, detail=f"Task {task_id} not found")
|
||||
|
||||
status = task_manager.get_status(task_id)
|
||||
|
||||
return StatusResponse(
|
||||
task_id=task_id,
|
||||
status=status["status"],
|
||||
progress=status["progress"],
|
||||
message=status["message"],
|
||||
error=status.get("error"),
|
||||
tracks=status.get("tracks", [])
|
||||
)
|
||||
Reference in New Issue
Block a user