A8多套打包+M4归档+R5多图:存量功能备份

A8 多套交付包(packaging_task.py):
- 修复交付包只打第1条混乱note的bug,按ImageCandidate.strategy分A/B/C组
- 每组生独立note_0N夹(6图+文案.txt),同seq留最新去重,老数据兼容
- task74端到端验:3套各6图,独立agent7项交叉验证全过

M4 归档(tasks.py/exports.py/前端):
- list_tasks加date_from/date_to/product_id筛选+product_name批量填(防N+1)
- 新增exports.py:产品JSON导出+标杆CSV导出(UTF-8 BOM)
- 前端HistoryFilters日期/产品筛选+产品列+打回原因红banner
- response.py加raise_param_error;独立agent验A1/A2/A9通过

R5 产品多图(product_images.py/020迁移/前端):
- product_images表+5端点(上传/列/改场景/设主图/删图)
- 生图按ROLE_SCENE_PREFERENCE选对应场景图,回落primary
- 前端ProductImageManager多图画廊

R6 账号config拆页(settings/):
- 配置页按角色拆/settings(运营+组长+admin)+/config(仅admin)
- Key只显末4位不显余额(守红线)

核销表对齐真实代码状态:D1改稿框/M7裂变/E12评图分纠偏为已完成(曾漏回写)

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

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
yangqianqian
2026-06-18 17:32:49 +08:00
parent 285791c12f
commit 4bed7425a8
41 changed files with 1211 additions and 236 deletions

View File

@@ -148,7 +148,8 @@ def run_image_generation(db, clients, task, product_dict: dict,
first_copy: dict, upload_base_path: str,
regen_strategy: str | None = None,
regen_role: str | None = None,
custom_prompt: str | None = None) -> int:
custom_prompt: str | None = None,
flywheel_fragment: str | None = None) -> int:
"""
Step6+7+8(image): 调 generate_storyboard_images → 后处理 → 存 ImageCandidate → 推 SSE。
返回 next_seq。
@@ -202,6 +203,23 @@ def run_image_generation(db, clients, task, product_dict: dict,
"拒绝降级纯文生图。请确认产品已上传参考图。"
)
# R5多图按场景分组加载产品图生图按分镜 role 选对应场景图
images_by_scene: dict[str, list[bytes]] = {}
for _im in (product_dict.get("images") or []):
_p = _resolve_image_path(_im.get("path", ""))
_scene = _im.get("scene") or "primary"
if _p and os.path.isfile(_p):
try:
with open(_p, "rb") as _f:
images_by_scene.setdefault(_scene, []).append(_f.read())
except Exception as _e:
logger.warning("产品图(scene=%s)读取失败,跳过:%s %s", _scene, _p, _e)
# 主图始终保底进 primary多图表为空或主图未入表时仍可用
if reference_images and not images_by_scene.get("primary"):
images_by_scene.setdefault("primary", []).extend(reference_images)
if images_by_scene:
logger.info("R5多图已加载%s", {k: len(v) for k, v in images_by_scene.items()})
seq = seq_start
# R2: 限定重生套别(regen_strategy)则只跑该套,否则全量 A/B/C 三套正交叙事
_strategies = (regen_strategy,) if regen_strategy else ("A", "B", "C")
@@ -227,6 +245,8 @@ def run_image_generation(db, clients, task, product_dict: dict,
strategy=strategy,
target_role=regen_role,
custom_prompt=custom_prompt,
images_by_scene=images_by_scene or None,
flywheel_fragment=flywheel_fragment,
))
except Exception as exc:
img_success = False