from celery import Celery

app = Celery(
    "ai_worker",
    broker="redis://localhost:6379/0",
    backend="redis://localhost:6379/0",
)

app.conf.update(
    task_track_started=True,
    task_serializer="json",
    result_serializer="json",
    accept_content=["json"],
    task_time_limit=600,  # 10 minutes
    worker_concurrency=2,
    worker_prefetch_multiplier=1,
)

# Auto-discover tasks from the tasks package
app.autodiscover_tasks(["tasks"])
