Skip to content

Commit

Permalink
fix: Each outline comands now focus on its task, not al outline (impr…
Browse files Browse the repository at this point in the history
…ove prompt)
  • Loading branch information
Estrada Irribarra, Rodrigo Andres committed Oct 20, 2024
1 parent ca5dd1b commit 03b5ec3
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ First, install **StoryCraftr** using [pipx](https://pypa.github.io/pipx/), a too
To install **StoryCraftr**, run the following command:

```bash
pipx install git+https://github.com/raestrada/[email protected].1-alpha1
pipx install git+https://github.com/raestrada/[email protected].2-alpha1
```

### Important: Before using StoryCraftr, make sure to set your OpenAI API key:
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ First, install **StoryCraftr** using [pipx](https://pypa.github.io/pipx/), a too
To install **StoryCraftr**, run the following command:

```bash
pipx install git+https://github.com/raestrada/[email protected].1-alpha1
pipx install git+https://github.com/raestrada/[email protected].2-alpha1
```

### Important: Before running the `storycraftr` command
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ <h1>Welcome to StoryCraftr 📚✨</h1>
<div class="coming-soon">
🚧 Coming Soon - Beta Release! 🚀
<br>Meanwhile, you can download the Alpha version, which is fully usable but may still have bugs:
<code>pipx install git+https://github.com/raestrada/[email protected].1-alpha1</code>
<code>pipx install git+https://github.com/raestrada/[email protected].2-alpha1</code>
</div>
</section>

Expand Down
12 changes: 8 additions & 4 deletions storycraftr/prompts/chapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
CHAPTER_PROMPT_NEW = """
Write a detailed and engaging chapter for the following book premise: {prompt}.
Ensure the chapter contributes meaningfully to the plot, character development, and overall progression of the story.
Generate content for a single chapter only, not an overarching story arc. The chapter should include a title and typical chapter structure, without subtitling or segmenting the content.
Generate content for a single chapter only, not an overarching story arc.
The chapter should include a title and typical chapter structure, without subtitling or segmenting the content.
"""


CHAPTER_PROMPT_REFINE = """
Refine and evolve the content based on this prompt: {prompt}.
Improve the narrative flow, character development, and pacing.
Generate content for a single chapter only, not an overarching story arc. The chapter should include a title and typical chapter structure, without subtitling or segmenting the content.
Generate content for a single chapter only, not an overarching story arc.
The chapter should include a title and typical chapter structure, without subtitling or segmenting the content.
"""


Expand All @@ -33,13 +35,15 @@
EPILOGUE_PROMPT_NEW = """
Generate a complete and compelling epilogue for the book based on the following context: {prompt}.
The epilogue should tie up loose ends and provide closure in a way that complements the main storyline.
Generate content for a single chapter only, not an overarching story arc. The chapter should include a title and typical chapter structure, without subtitling or segmenting the content.
Generate content for a single chapter only, not an overarching story arc.
The chapter should include a title and typical chapter structure, without subtitling or segmenting the content.
"""


EPILOGUE_PROMPT_REFINE = """
Refine and evolve the content based on this prompt: {prompt}.
Improve its narrative flow, tie up remaining plot points, and evolve the content.
Ensure that the refined epilogue maintains the tone and themes of the story.
Generate content for a single chapter only, not an overarching story arc. The chapter should include a title and typical chapter structure, without subtitling or segmenting the content.
Generate content for a single chapter only, not an overarching story arc.
The chapter should include a title and typical chapter structure, without subtitling or segmenting the content.
"""
8 changes: 8 additions & 0 deletions storycraftr/prompts/outline.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
GENERAL_OUTLINE_PROMPT_NEW = """
Create a general outline for the book {book_name} based on this prompt: {prompt}.
Focus on general outline, then I will request help on plot-points, character-summary and chapt-synopsis.
"""

GENERAL_OUTLINE_PROMPT_REFINE = """
Refine and evolve the content based on this prompt: {prompt}.
Focus on improving the structure and flow of the outline, ensuring clarity and coherence throughout.
Focus on general outline, then I will request help on plot-points, character-summary and chapt-synopsis.
"""

CHARACTER_SUMMARY_PROMPT_NEW = """
Generate a detailed character summary for the book {book_name} based on this prompt: {prompt}.
Define most important characters startign for the main characters and continuing with secondaries.
Focus on character-summary, then I will request help on plot-points, general-outline and chapt-synopsis.
"""

CHARACTER_SUMMARY_PROMPT_REFINE = """
Refine and evolve the content based on this prompt: {prompt}.
Enhance character depth, motivation, and consistency with the overall narrative.
Focus on character-summary, then I will request help on plot-points, general-outline and chapt-synopsis.
"""

PLOT_POINTS_PROMPT_NEW = """
Generate the main plot points for the book {book_name} based on this prompt: {prompt}.
Focus on plot-points, then I will request help on plot-points, character-summary and chapt-synopsis.
"""

PLOT_POINTS_PROMPT_REFINE = """
Refine and evolve the content based on this prompt: {prompt}.
Ensure logical progression between plot points and strengthen the links between key events.
Focus on plot-points, then I will request help on plot-points, character-summary and chapt-synopsis.
"""

CHAPTER_SYNOPSIS_PROMPT_NEW = """
Generate a chapter-by-chapter synopsis for the book {book_name} based on this prompt: {prompt}.
List all chapters and its synopsis.
Focus on chapter-synopsis, then I will request help on gemneral-outline, character-summary and chapt-synopsis.
"""

CHAPTER_SYNOPSIS_PROMPT_REFINE = """
Refine and evolve the content based on this prompt: {prompt}.
Focus on improving chapter summaries by clarifying pivotal moments and enhancing narrative tension.
Focus on chapter-synopsis, then I will request help on gemneral-outline, character-summary and chapt-synopsis.
"""
7 changes: 1 addition & 6 deletions storycraftr/utils/core.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import secrets # Para generar números aleatorios seguros
import hashlib
import json
from typing import NamedTuple
from rich.console import Console
Expand All @@ -12,15 +11,11 @@


def generate_prompt_with_hash(original_prompt, date):
# Genera un hash basado en el contenido del prompt
hash_object = hashlib.sha256(original_prompt.encode())
hash_hex = hash_object.hexdigest()

# Selecciona una frase aleatoria de la lista usando secrets.choice para mayor seguridad
random_phrase = secrets.choice(longer_date_formats).format(date=date)

# Combina la frase seleccionada, un salto de línea, el hash y el prompt original
modified_prompt = f"{random_phrase}\n\n{hash_hex[:10]}: {original_prompt}" # Usa los primeros 10 caracteres del hash
modified_prompt = f"{random_phrase}\n\n{original_prompt}" # Usa los primeros 10 caracteres del hash

# Si el modo debug está activado, imprime el prompt modificado en formato Markdown
if debug_state.is_debug():
Expand Down

0 comments on commit 03b5ec3

Please sign in to comment.