Strengthened writing.
This commit is contained in:
38
main.py
38
main.py
@@ -100,7 +100,14 @@ def process_book(bp, folder, context="", resume=False, interactive=False):
|
||||
utils.log("RESUME", "Rebuilding 'Story So Far' from existing manuscript...")
|
||||
try:
|
||||
combined_text = "\n".join([f"Chapter {c['num']}: {c['content']}" for c in ms])
|
||||
resp_sum = ai.model_writer.generate_content(f"Create a detailed, cumulative 'Story So Far' summary from the following text. Use dense, factual bullet points. Focus on character meetings, relationships, and known information:\n{combined_text}")
|
||||
resp_sum = ai.model_writer.generate_content(f"""
|
||||
ROLE: Series Historian
|
||||
TASK: Create a cumulative 'Story So Far' summary.
|
||||
INPUT_TEXT:
|
||||
{combined_text}
|
||||
INSTRUCTIONS: Use dense, factual bullet points. Focus on character meetings, relationships, and known information.
|
||||
OUTPUT: Summary text.
|
||||
""")
|
||||
utils.log_usage(folder, "writer-flash", resp_sum.usage_metadata)
|
||||
summary = resp_sum.text
|
||||
except: summary = "The story continues."
|
||||
@@ -161,29 +168,30 @@ def process_book(bp, folder, context="", resume=False, interactive=False):
|
||||
|
||||
try:
|
||||
update_prompt = f"""
|
||||
Update the 'Story So Far' summary to include the events of this new chapter.
|
||||
ROLE: Series Historian
|
||||
TASK: Update the 'Story So Far' summary to include the events of this new chapter.
|
||||
|
||||
STYLE: Dense, factual, chronological bullet points. Avoid narrative prose.
|
||||
GOAL: Maintain a perfect memory of the plot for continuity.
|
||||
|
||||
CRITICAL INSTRUCTIONS:
|
||||
1. CUMULATIVE: Do NOT remove old events. Append and integrate new information.
|
||||
2. TRACKING: Explicitly note who met whom, who knows what, and current locations.
|
||||
3. RELEVANCE: Ensure details needed for the UPCOMING CONTEXT are preserved.
|
||||
|
||||
CURRENT STORY SO FAR:
|
||||
INPUT_DATA:
|
||||
- CURRENT_SUMMARY:
|
||||
{summary}
|
||||
|
||||
NEW CHAPTER CONTENT:
|
||||
- NEW_CHAPTER_TEXT:
|
||||
{txt}
|
||||
{next_info}
|
||||
- UPCOMING_CONTEXT_HINT: {next_info}
|
||||
|
||||
INSTRUCTIONS:
|
||||
1. STYLE: Dense, factual, chronological bullet points. Avoid narrative prose.
|
||||
2. CUMULATIVE: Do NOT remove old events. Append and integrate new information.
|
||||
3. TRACKING: Explicitly note who met whom, who knows what, and current locations.
|
||||
4. RELEVANCE: Ensure details needed for the UPCOMING CONTEXT are preserved.
|
||||
|
||||
OUTPUT: Updated summary text.
|
||||
"""
|
||||
resp_sum = ai.model_writer.generate_content(update_prompt)
|
||||
utils.log_usage(folder, "writer-flash", resp_sum.usage_metadata)
|
||||
summary = resp_sum.text
|
||||
except:
|
||||
try:
|
||||
resp_fallback = ai.model_writer.generate_content(f"Summarize plot points:\n{txt}")
|
||||
resp_fallback = ai.model_writer.generate_content(f"ROLE: Summarizer\nTASK: Summarize plot points.\nTEXT: {txt}\nOUTPUT: Bullet points.")
|
||||
utils.log_usage(folder, "writer-flash", resp_fallback.usage_metadata)
|
||||
summary += f"\n\nChapter {ch['chapter_number']}: " + resp_fallback.text
|
||||
except: summary += f"\n\nChapter {ch['chapter_number']}: [Content processed]"
|
||||
|
||||
Reference in New Issue
Block a user