Files
aiagent/backend/app/core/celery_app.py
renjianbo beff3fac8d fix: delete agent 500 error + dynamic personality + deployment guide
- Fix delete agent 500: clean up FK records (agent_llm_logs, permissions,
  schedules, executions, team_members) and unbind goals/tasks before delete
- Remove hardcoded personality templates in Android, replace with dynamic
  system prompt generation from name + description
- Set promptSectionsEnabled=false to bypass PromptComposer for personality
- Add Tencent Cloud Linux deployment guide (Docker Compose)
- Accumulated backend service updates, frontend UI fixes, Android app changes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-29 01:17:21 +08:00

43 lines
1.1 KiB
Python

"""
Celery 应用配置
"""
from celery import Celery
from celery.schedules import crontab
from app.core.config import settings
celery_app = Celery(
"aiagent",
broker=settings.REDIS_URL,
backend=settings.REDIS_URL,
include=[
"app.tasks.workflow_tasks",
"app.tasks.agent_tasks",
"app.tasks.scheduler_tasks",
"app.tasks.goal_tasks",
"app.tasks.knowledge_tasks",
]
)
celery_app.conf.update(
task_serializer="json",
accept_content=["json"],
result_serializer="json",
timezone="Asia/Shanghai",
enable_utc=True,
task_track_started=True,
task_time_limit=30 * 60, # 30分钟
task_soft_time_limit=25 * 60, # 25分钟
)
# Celery Beat 定时调度配置
celery_app.conf.beat_schedule = {
"check-agent-schedules-every-minute": {
"task": "app.tasks.scheduler_tasks.check_agent_schedules_task",
"schedule": crontab(minute="*"), # 每分钟检查
},
"extract-knowledge-every-hour": {
"task": "app.tasks.knowledge_tasks.extract_knowledge_task",
"schedule": crontab(minute="0"), # 每小时整点执行
},
}