Fix for chapter repeats.

This commit is contained in:
2026-02-10 16:23:33 -05:00
parent 848d187f4b
commit 7fdc2ea3de
4 changed files with 6 additions and 5 deletions

View File

@@ -78,7 +78,8 @@ def process_book(bp, folder, context="", resume=False, interactive=False):
# 5. Writing Loop
ms_path = os.path.join(folder, "manuscript.json")
ms = utils.load_json(ms_path) if (resume and os.path.exists(ms_path)) else []
loaded_ms = utils.load_json(ms_path) if (resume and os.path.exists(ms_path)) else []
ms = loaded_ms if loaded_ms is not None else []
# Load Tracking
events_track_path = os.path.join(folder, "tracking_events.json")
@@ -129,7 +130,7 @@ def process_book(bp, folder, context="", resume=False, interactive=False):
# Robust Resume: Check if this specific chapter number is already in the manuscript
# (Handles cases where plan changed or ms is out of sync with index)
if any(c.get('num') == ch['chapter_number'] for c in ms):
if any(str(c.get('num')) == str(ch['chapter_number']) for c in ms):
i += 1
continue