fix(api): AI任务导入改回动态import,避免API容器无worker模块启动失败
Deploy / Build Production Runtime Images (push) Has been skipped
Deploy / Deploy Production (push) Has been skipped
Deploy / Production Browser E2E (push) Has been skipped
Deploy / Staging E2E Tests (push) Failing after 97h26m43s
Deploy / Deploy Staging (push) Failing after 97h29m41s
CI/CD Pipeline / Frontend Lint (push) Failing after 97h29m51s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 97h29m51s
Deploy / Build Production Runtime Images (push) Has been skipped
Deploy / Deploy Production (push) Has been skipped
Deploy / Production Browser E2E (push) Has been skipped
Deploy / Staging E2E Tests (push) Failing after 97h26m43s
Deploy / Deploy Staging (push) Failing after 97h29m41s
CI/CD Pipeline / Frontend Lint (push) Failing after 97h29m51s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 97h29m51s
P3修复中将apps.worker的ai_tasks改为顶部静态导入,但API容器镜像不包含worker代码,导致ModuleNotFoundError。 改回函数内lazy import,保持API容器可独立启动。
This commit is contained in:
@@ -39,8 +39,6 @@ from packages.application.generation_tasks import (
|
||||
from packages.domain.config_schemas import normalize_plan_config
|
||||
from packages.domain.edit_plan import EditPlan, EditPlanStatus
|
||||
|
||||
# AI 推荐 & 封面生成(轻量模块,无 Celery 依赖,可安全静态导入)
|
||||
from apps.worker.worker_app.tasks.ai_tasks import run_ai_recommend, run_generate_cover
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -663,6 +661,7 @@ def ai_recommend_clips(
|
||||
)
|
||||
|
||||
# 调用 AI 推荐服务(同步调用 stub,后续改为 Celery 异步)
|
||||
from apps.worker.worker_app.tasks.ai_tasks import run_ai_recommend
|
||||
result = run_ai_recommend(
|
||||
plan_id=plan_id,
|
||||
template_id=plan.template_id,
|
||||
@@ -783,6 +782,7 @@ def generate_cover(
|
||||
_check_project_access(plan.project_id, current_user.user.id, project_repository)
|
||||
|
||||
# 调用 AI 封面生成服务
|
||||
from apps.worker.worker_app.tasks.ai_tasks import run_generate_cover
|
||||
cover_data = run_generate_cover(
|
||||
plan_id=plan_id,
|
||||
asset_ids=body.asset_ids,
|
||||
|
||||
Reference in New Issue
Block a user