Fixed refinement
This commit is contained in:
@@ -397,6 +397,11 @@ def view_project(id):
|
||||
bible_path = os.path.join(proj.folder_path, "bible.json")
|
||||
bible_data = utils.load_json(bible_path)
|
||||
|
||||
# Check for active refinement or pending draft
|
||||
draft_path = os.path.join(proj.folder_path, "bible_draft.json")
|
||||
has_draft = os.path.exists(draft_path)
|
||||
is_refining = os.path.exists(os.path.join(proj.folder_path, ".refining"))
|
||||
|
||||
# Load Personas for dropdown
|
||||
personas = {}
|
||||
if os.path.exists(config.PERSONAS_FILE):
|
||||
@@ -463,7 +468,7 @@ def view_project(id):
|
||||
'type': f.split('.')[-1].upper()
|
||||
})
|
||||
|
||||
return render_template('project.html', project=proj, bible=bible_data, runs=runs, active_run=latest_run, artifacts=artifacts, cover_image=cover_image, personas=personas, generated_books=generated_books, other_projects=other_projects, locked=locked)
|
||||
return render_template('project.html', project=proj, bible=bible_data, runs=runs, active_run=latest_run, artifacts=artifacts, cover_image=cover_image, personas=personas, generated_books=generated_books, other_projects=other_projects, locked=locked, has_draft=has_draft, is_refining=is_refining)
|
||||
|
||||
@app.route('/project/<int:id>/run', methods=['POST'])
|
||||
@login_required
|
||||
|
||||
@@ -378,6 +378,9 @@ def refine_bible_task(project_path, instruction, source_type, selected_keys=None
|
||||
try:
|
||||
bible_path = os.path.join(project_path, "bible.json")
|
||||
draft_path = os.path.join(project_path, "bible_draft.json")
|
||||
lock_path = os.path.join(project_path, ".refining")
|
||||
|
||||
with open(lock_path, 'w') as f: f.write("running")
|
||||
|
||||
base_bible = utils.load_json(bible_path)
|
||||
if not base_bible: return False
|
||||
@@ -408,4 +411,6 @@ def refine_bible_task(project_path, instruction, source_type, selected_keys=None
|
||||
|
||||
except Exception as e:
|
||||
utils.log("ERROR", f"Bible refinement task failed: {e}")
|
||||
return False
|
||||
return False
|
||||
finally:
|
||||
if os.path.exists(lock_path): os.remove(lock_path)
|
||||
Reference in New Issue
Block a user