Fix for chapter repeats.
This commit is contained in:
5
main.py
5
main.py
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user