From 8dc47d200bb0958270873ea3fb9ac1b2146ee3ea Mon Sep 17 00:00:00 2001 From: yangshilin <2157598560@qq.com> Date: Thu, 19 Mar 2026 14:02:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9B=9E=E5=BF=86?= =?UTF-8?q?=E5=BD=95celery=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/tasks/memoir_tasks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/app/tasks/memoir_tasks.py b/api/app/tasks/memoir_tasks.py index c70e895..f2b2a73 100644 --- a/api/app/tasks/memoir_tasks.py +++ b/api/app/tasks/memoir_tasks.py @@ -387,10 +387,13 @@ def _save_narrative_to_sections(db: Session, chapter, narrative: str, title: str def _placeholder_for_segment(seg: dict, order_idx: int) -> dict | None: ph = seg.get("placeholder_info") if ph and ph.get("placeholder") and ph.get("description"): + # 确保有 index,build_initial_image_assets 依赖此字段 + if "index" not in ph: + ph = {**ph, "index": order_idx} return ph content = (seg.get("content") or "").strip() desc = (content[:50] + "…") if len(content) > 50 else (content or "章节配图") - return {"placeholder": f"{{{{{{{{IMAGE:{desc}}}}}}}}}", "description": desc} + return {"placeholder": f"{{{{{{{{IMAGE:{desc}}}}}}}}}", "description": desc, "index": order_idx} # 按顺序创建 section,每 3 个 section 对应 1 张配图 for i, seg in enumerate(segments):