Auto-commit: Fix 'create new book not showing anything' — 3 root causes

1. templates/project_setup.html: s.tropes|join and s.formatting_rules|join
   raised Jinja2 UndefinedError when AI failed and fallback dict lacked those
   keys → 500 blank page. Fixed with (s.tropes or [])|join(', ').

2. web/routes/project.py (project_setup_wizard): Removed silent redirect-to-
   dashboard when model_logic is None. Now renders the setup form with a
   complete default suggestions dict (all fields present, lists as []) plus a
   clear warning flash so the user can fill it in manually.

3. web/routes/project.py (create_project_final): planner.enrich() was called
   with the full bible dict — enrich() reads manual_instruction from the top
   level (got 'A generic story' fallback) and wrote results into book_metadata
   instead of the bible's books[0]. Fixed to build a proper per-book blueprint,
   call enrich, and merge characters/plot_beats back into the correct locations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-21 10:25:34 -05:00
parent 1f799227d9
commit a24d2809f3
2 changed files with 69 additions and 15 deletions

View File

@@ -121,12 +121,12 @@
<div class="mb-4">
<label class="form-label">Tropes (comma separated)</label>
<input type="text" name="tropes" class="form-control" value="{{ s.tropes|join(', ') }}">
<input type="text" name="tropes" class="form-control" value="{{ (s.tropes or [])|join(', ') }}">
</div>
<div class="mb-4">
<label class="form-label">Formatting Rules (comma separated)</label>
<input type="text" name="formatting_rules" class="form-control" value="{{ s.formatting_rules|join(', ') }}">
<input type="text" name="formatting_rules" class="form-control" value="{{ (s.formatting_rules or [])|join(', ') }}">
</div>
<div class="d-grid gap-2">