Strengthened writing.
This commit is contained in:
99
wizard.py
99
wizard.py
@@ -183,31 +183,35 @@ class BookWizard:
|
||||
if concept:
|
||||
with console.status("[bold yellow]AI is analyzing your concept...[/bold yellow]"):
|
||||
prompt = f"""
|
||||
Analyze this story concept and suggest metadata for a book or series.
|
||||
ROLE: Publishing Analyst
|
||||
TASK: Suggest metadata for a story concept.
|
||||
|
||||
CONCEPT: {concept}
|
||||
|
||||
RETURN JSON with these keys:
|
||||
- title: Suggested book title
|
||||
- genre: Genre
|
||||
- target_audience: e.g. Adult, YA
|
||||
- tone: e.g. Dark, Whimsical
|
||||
- length_category: One of ["00", "0", "01", "1", "2", "2b", "3", "4", "5"] based on likely depth.
|
||||
- estimated_chapters: int (suggested chapter count)
|
||||
- estimated_word_count: string (e.g. "75,000")
|
||||
- include_prologue: boolean
|
||||
- include_epilogue: boolean
|
||||
- tropes: list of strings
|
||||
- pov_style: e.g. First Person
|
||||
- time_period: e.g. Modern
|
||||
- spice: e.g. Standard, Explicit
|
||||
- violence: e.g. None, Graphic
|
||||
- is_series: boolean
|
||||
- series_title: string (if series)
|
||||
- narrative_tense: e.g. Past, Present
|
||||
- language_style: e.g. Standard, Flowery
|
||||
- dialogue_style: e.g. Witty, Formal
|
||||
- page_orientation: Portrait, Landscape, or Square
|
||||
- formatting_rules: list of strings
|
||||
OUTPUT_FORMAT (JSON):
|
||||
{{
|
||||
"title": "String",
|
||||
"genre": "String",
|
||||
"target_audience": "String",
|
||||
"tone": "String",
|
||||
"length_category": "String (Select code: '01'=Chapter Book, '1'=Flash Fiction, '2'=Short Story, '2b'=Young Adult, '3'=Novella, '4'=Novel, '5'=Epic)",
|
||||
"estimated_chapters": Int,
|
||||
"estimated_word_count": "String (e.g. '75,000')",
|
||||
"include_prologue": Bool,
|
||||
"include_epilogue": Bool,
|
||||
"tropes": ["String"],
|
||||
"pov_style": "String",
|
||||
"time_period": "String",
|
||||
"spice": "String",
|
||||
"violence": "String",
|
||||
"is_series": Bool,
|
||||
"series_title": "String",
|
||||
"narrative_tense": "String",
|
||||
"language_style": "String",
|
||||
"dialogue_style": "String",
|
||||
"page_orientation": "Portrait|Landscape|Square",
|
||||
"formatting_rules": ["String (e.g. 'Chapter Headers: Number + Title')"]
|
||||
}}
|
||||
"""
|
||||
suggestions = self.ask_gemini_json(prompt)
|
||||
|
||||
@@ -256,10 +260,14 @@ class BookWizard:
|
||||
instruction = Prompt.ask("Instruction (e.g. 'Make it darker', 'Change genre to Sci-Fi')")
|
||||
with console.status("[bold yellow]Refining suggestions...[/bold yellow]"):
|
||||
refine_prompt = f"""
|
||||
Update these project suggestions based on the user instruction.
|
||||
CURRENT JSON: {json.dumps(suggestions)}
|
||||
INSTRUCTION: {instruction}
|
||||
RETURN ONLY VALID JSON with the same keys.
|
||||
ROLE: Publishing Analyst
|
||||
TASK: Refine project metadata based on user instruction.
|
||||
|
||||
INPUT_DATA:
|
||||
- CURRENT_JSON: {json.dumps(suggestions)}
|
||||
- INSTRUCTION: {instruction}
|
||||
|
||||
OUTPUT_FORMAT (JSON): Same structure as input. Ensure length_category matches word count.
|
||||
"""
|
||||
new_sugg = self.ask_gemini_json(refine_prompt)
|
||||
if new_sugg: suggestions = new_sugg
|
||||
@@ -496,25 +504,22 @@ class BookWizard:
|
||||
console.print("\n[bold yellow]✨ Generating full Book Bible (Characters, Plot, etc.)...[/bold yellow]")
|
||||
|
||||
prompt = f"""
|
||||
You are a Creative Director.
|
||||
Create a comprehensive Book Bible for the following project.
|
||||
ROLE: Creative Director
|
||||
TASK: Create a comprehensive Book Bible.
|
||||
|
||||
PROJECT METADATA: {json.dumps(self.data['project_metadata'])}
|
||||
EXISTING BOOKS STRUCTURE: {json.dumps(self.data['books'])}
|
||||
INPUT_DATA:
|
||||
- METADATA: {json.dumps(self.data['project_metadata'])}
|
||||
- BOOKS: {json.dumps(self.data['books'])}
|
||||
|
||||
TASK:
|
||||
1. Create a list of Main Characters (Global for the project).
|
||||
2. For EACH book in the 'books' list:
|
||||
- Generate a catchy Title (if not provided).
|
||||
- Write a 'manual_instruction' (Plot Summary).
|
||||
- Generate 'plot_beats' (10-15 chronological beats).
|
||||
INSTRUCTIONS:
|
||||
1. Create Main Characters.
|
||||
2. For EACH book: Generate Title, Plot Summary (manual_instruction), and 10-15 Plot Beats.
|
||||
|
||||
RETURN JSON in standard Bible format:
|
||||
OUTPUT_FORMAT (JSON):
|
||||
{{
|
||||
"characters": [ {{ "name": "...", "role": "...", "description": "..." }} ],
|
||||
"characters": [ {{ "name": "String", "role": "String", "description": "String" }} ],
|
||||
"books": [
|
||||
{{ "book_number": 1, "title": "...", "manual_instruction": "...", "plot_beats": ["...", "..."] }},
|
||||
...
|
||||
{{ "book_number": Int, "title": "String", "manual_instruction": "String", "plot_beats": ["String"] }}
|
||||
]
|
||||
}}
|
||||
"""
|
||||
@@ -646,12 +651,14 @@ class BookWizard:
|
||||
while True:
|
||||
with console.status("[bold green]AI is updating blueprint...[/bold green]"):
|
||||
prompt = f"""
|
||||
Act as a Book Editor.
|
||||
CURRENT JSON: {json.dumps(current_data)}
|
||||
USER INSTRUCTION: {instruction}
|
||||
ROLE: Senior Editor
|
||||
TASK: Update the Bible JSON based on instruction.
|
||||
|
||||
TASK: Update the JSON based on the instruction. Maintain valid JSON structure.
|
||||
RETURN ONLY THE JSON.
|
||||
INPUT_DATA:
|
||||
- CURRENT_JSON: {json.dumps(current_data)}
|
||||
- INSTRUCTION: {instruction}
|
||||
|
||||
OUTPUT_FORMAT (JSON): The full updated JSON object.
|
||||
"""
|
||||
new_data = self.ask_gemini_json(prompt)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user