29ebbfc1c0
- Thay librosa bang app/core/audio_features.py (numpy/scipy/soundfile):
load, beat_track, frames_to_time, spectral_centroid, rms, zero_crossing_rate,
time_stretch, pitch_shift, chroma_stft. A/B ngang librosa (BPM <1% sai lech,
pitch_shift chuan toi Hz). Loai bo llvmlite 171MB + scikit-learn + numba.
- Task layer 2 che do (app/tasks/worker.py): server giu celery; desktop slim
chay in-process thread + registry, giu nguyen API contract (.delay/.id/status
/tasks/{id}) nen frontend khong doi.
- engine.spec: excludes librosa/numba/llvmlite/sklearn/celery/redis/kombu/
billiard/amqp/msgpack/yaml/PIL/cairosvg/zstandard/...; scan scipy gioi han
scipy.signal; giu click (uvicorn.main import click).
- render_engine: scipy.signal thanh lazy import (giam cold start).
- tauri.conf.json: targets [nsis, msi] - NSIS tro lai (bundle nho) de
hooks.nsh cai VC++ Redistributable - sua bug daw_engine.exe khong chay
tren Windows (truoc day MSI-only khong chay hooks).
- build_linux.sh / build_macos.sh: build 1 lenh moi OS.
- Doc: DESKTOP_INSTALL_PLAN.md muc 5.1.
- Verify: 86 tests pass, engine dong goi upload/analyze/waveform/export OK.
27 lines
752 B
Python
27 lines
752 B
Python
import os
|
|
from fastapi import APIRouter
|
|
|
|
router = APIRouter()
|
|
|
|
# Task status endpoint dung chung cho ca 2 che do:
|
|
# - Server/Docker: celery (AsyncResult, broker Redis).
|
|
# - Desktop slim (PyInstaller khong bundle celery): in-process registry
|
|
# (app/tasks/worker._SimpleAsyncResult) — API contract giong het nhau.
|
|
|
|
|
|
@router.get("/tasks/{task_id}")
|
|
async def get_task_status(task_id: str):
|
|
from app.tasks.worker import get_task_result
|
|
|
|
res = get_task_result(task_id)
|
|
response_data = {
|
|
"task_id": task_id,
|
|
"status": res.status,
|
|
}
|
|
if res.ready():
|
|
if res.successful():
|
|
response_data["result"] = res.result
|
|
else:
|
|
response_data["error"] = str(res.result)
|
|
return response_data
|