maxkb/apps/ops/__init__.py
朱潮 638bf0dd1b 修复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>
2025-08-31 01:09:19 +08:00

34 lines
878 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# coding=utf-8
"""
@project: MaxKB
@Author
@file __init__.py.py
@date2024/8/16 14:47
@desc:
"""
from .celery import app as celery_app
# Import and register advanced learning tasks
try:
from knowledge.tasks.advanced_learning import (
advanced_learning_by_document,
batch_advanced_learning
)
# Register tasks with the celery app
celery_app.register_task(advanced_learning_by_document)
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