feat: Save bible snapshot alongside each run on start
Copies bible.json as bible_snapshot.json into the run folder before generation begins, preserving the exact blueprint used for that run. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
13
web/tasks.py
13
web/tasks.py
@@ -281,7 +281,18 @@ def generate_book_task(run_id, project_path, bible_path, allow_copy=True, feedba
|
||||
except Exception as e:
|
||||
utils.log("SYSTEM", f" -> Failed to copy {item}: {e}")
|
||||
|
||||
# 2. Run Generation
|
||||
# 2. Save Bible Snapshot alongside this run
|
||||
run_dir_early = os.path.join(project_path, "runs", f"run_{run_id}")
|
||||
os.makedirs(run_dir_early, exist_ok=True)
|
||||
if os.path.exists(bible_path):
|
||||
snapshot_path = os.path.join(run_dir_early, "bible_snapshot.json")
|
||||
try:
|
||||
shutil.copy2(bible_path, snapshot_path)
|
||||
utils.log("SYSTEM", f"Bible snapshot saved to run folder.")
|
||||
except Exception as _e:
|
||||
utils.log("SYSTEM", f"WARNING: Could not save bible snapshot: {_e}")
|
||||
|
||||
# 3. Run Generation
|
||||
from cli.engine import run_generation
|
||||
run_generation(bible_path, specific_run_id=run_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user