new editor features
This commit is contained in:
35
main.py
35
main.py
@@ -106,7 +106,8 @@ def process_book(bp, folder, context="", resume=False):
|
||||
session_chapters = 0
|
||||
session_time = 0
|
||||
|
||||
for i in range(len(ms), len(chapters)):
|
||||
i = len(ms)
|
||||
while i < len(chapters):
|
||||
ch_start = time.time()
|
||||
ch = chapters[i]
|
||||
|
||||
@@ -165,6 +166,38 @@ def process_book(bp, folder, context="", resume=False):
|
||||
with open(chars_track_path, "w") as f: json.dump(tracking['characters'], f, indent=2)
|
||||
with open(warn_track_path, "w") as f: json.dump(tracking.get('content_warnings', []), f, indent=2)
|
||||
|
||||
# --- DYNAMIC PACING CHECK ---
|
||||
remaining = chapters[i+1:]
|
||||
if remaining:
|
||||
pacing = story.check_pacing(bp, summary, txt, ch, remaining, folder)
|
||||
if pacing and pacing.get('status') == 'add_bridge':
|
||||
new_data = pacing.get('new_chapter', {})
|
||||
new_ch = {
|
||||
"chapter_number": ch['chapter_number'] + 1,
|
||||
"title": new_data.get('title', 'Bridge Chapter'),
|
||||
"pov_character": new_data.get('pov_character', ch.get('pov_character')),
|
||||
"pacing": "Slow",
|
||||
"estimated_words": 1500,
|
||||
"beats": new_data.get('beats', [])
|
||||
}
|
||||
chapters.insert(i+1, new_ch)
|
||||
# Renumber subsequent chapters
|
||||
for k in range(i+1, len(chapters)): chapters[k]['chapter_number'] = k + 1
|
||||
|
||||
with open(chapters_path, "w") as f: json.dump(chapters, f, indent=2)
|
||||
utils.log("ARCHITECT", f" -> ⚠️ Pacing Intervention: Added bridge chapter '{new_ch['title']}' to fix rushing.")
|
||||
|
||||
elif pacing and pacing.get('status') == 'cut_next':
|
||||
removed = chapters.pop(i+1)
|
||||
# Renumber subsequent chapters
|
||||
for k in range(i+1, len(chapters)): chapters[k]['chapter_number'] = k + 1
|
||||
|
||||
with open(chapters_path, "w") as f: json.dump(chapters, f, indent=2)
|
||||
utils.log("ARCHITECT", f" -> ⚠️ Pacing Intervention: Removed redundant chapter '{removed['title']}'.")
|
||||
|
||||
# Increment loop
|
||||
i += 1
|
||||
|
||||
duration = time.time() - ch_start
|
||||
session_chapters += 1
|
||||
session_time += duration
|
||||
|
||||
Reference in New Issue
Block a user