fix: 修复回忆录celery异常
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user