- 平台套图(cover)以前纯文生图,不参考真实商品主图 → 出图与商品对不上; 现以商品主图为参考图1走 image_edit,锁包装一致性,有模特则参考图2=模特 - 新增 build_platform_cover_prompt_refs;model_url 解析对 cover 模式同样生效 - 补回归测试:cover 传商品主图、model 传商品主图+模特图、无主图回落文生图 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
22 lines
882 B
Python
22 lines
882 B
Python
from django.contrib.auth import get_user_model
|
|
|
|
from airshelf.celery import app
|
|
from apps.accounts.models import Team
|
|
|
|
|
|
@app.task
|
|
def ensure_team_notifications_task(team_id: str, user_id: str | None = None) -> None:
|
|
"""后台生成/补齐团队站内通知。
|
|
|
|
原先在 NotificationViewSet.list() 里同步执行:每次刷新都要读计费账本 +
|
|
对项目/资产/扣费流水逐条 get_or_create,几十次 DB 往返压在请求线程上,拖慢通知接口。
|
|
现改由 Celery 异步执行,请求只负责读现有通知,生成搬到后台 worker。
|
|
"""
|
|
from apps.ops.views import ensure_team_notifications # 延迟导入避免循环依赖
|
|
|
|
team = Team.objects.filter(id=team_id).first()
|
|
if team is None:
|
|
return
|
|
user = get_user_model().objects.filter(id=user_id).first() if user_id else None
|
|
ensure_team_notifications(team, user)
|