修复Celery任务注册问题

- 在tasks/__init__.py中导入media_learning任务
- 在ops/__init__.py中注册media_learning任务到Celery应用
- 修复KeyError: 'media_learning_by_document'错误

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
朱潮 2025-08-31 01:09:19 +08:00
parent 459b0c8307
commit 638bf0dd1b
2 changed files with 14 additions and 1 deletions

View File

@ -2,4 +2,5 @@
# Import tasks for Celery discovery
# Note: We import the specific tasks, not * to avoid circular imports
from .advanced_learning import advanced_learning_by_document, batch_advanced_learning
from .advanced_learning import advanced_learning_by_document, batch_advanced_learning
from .media_learning import media_learning_by_document, media_learning_batch

View File

@ -19,3 +19,15 @@ try:
celery_app.register_task(batch_advanced_learning)
except ImportError:
pass
# Import and register media learning tasks
try:
from knowledge.tasks.media_learning import (
media_learning_by_document,
media_learning_batch
)
# Register tasks with the celery app
celery_app.register_task(media_learning_by_document)
celery_app.register_task(media_learning_batch)
except ImportError:
pass