Skip to content

Commit

Permalink
feat(chat): integrate prompt_toolkit for advanced input handling and …
Browse files Browse the repository at this point in the history
…rich for output formatting

- Added prompt_toolkit PromptSession to handle multi-line input, history, and cursor movement.
- Integrated rich for rendering Markdown and colorized output.
- Adjusted input processing to pass user queries to the assistant via create_message.
- Ensured the output is displayed using rich's console.print for proper formatting.
- Included error handling for invalid commands and exceptions during execution.
  • Loading branch information
Estrada Irribarra, Rodrigo Andres committed Oct 23, 2024
1 parent 2b46226 commit c299820
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions storycraftr/prompts/iterate.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
"""

INSERT_CHAPTER_PROMPT = """
Insert a new chapter at position {position} in the book. When a new chapter is inserted at position {position},
all subsequent chapters will be renumbered accordingly.
Insert a new chapter at position {position} in the book. When a new chapter is inserted at position {position}, all subsequent chapters will be renumbered accordingly.
For example, if a new chapter is inserted at position 3, the current chapter 3 will become chapter 4, chapter 4 will become chapter 5, and so on.
Use the retrieval system to access the chapters before and after this position, ensuring that the new chapter fits seamlessly with the narrative, themes, and character arcs.
Generate content only for the newly inserted chapter, not for the surrounding chapters.
Expand All @@ -48,7 +47,8 @@
"""

INSERT_FLASHBACK_CHAPTER_PROMPT = """
Insert a new chapter at position {position} in the book, ensuring that the inserted chapter serves as a meaningful flashback.
Insert a new chapter at position {position} in the book. When a new chapter is inserted at position {position}, all subsequent chapters will be renumbered accordingly.
Ensure that the inserted chapter serves as a meaningful flashback.
The flashback should provide essential backstory or context that deepens the reader's understanding of the characters, themes, or events.
All subsequent chapters will be renumbered accordingly.
For example, if a new chapter is inserted at position 3, the current chapter 3 will become chapter 4, chapter 4 will become chapter 5, and so on.
Expand Down Expand Up @@ -78,10 +78,11 @@

INSERT_SPLIT_CHAPTER_PROMPT = """
Split chapter {position} at the appropriate point, ensuring that both resulting chapters maintain their coherence and flow.
Insert a new chapter at position {position} in the book containing the first half of the split. When a new chapter is inserted at position {position}, all subsequent chapters will be renumbered accordingly.
The newly created chapters should complement each other, with both parts containing essential narrative elements that enhance character development, themes, or plot progression.
Use the retrieval system to access the context of the chapter, making sure the split fits seamlessly within the overall story structure.
Ensure the tone, style, and character arcs remain consistent in both parts, preserving the integrity of the original chapter.
Generate content only for the two resulting chapters, not for the surrounding chapters.
Generate content only for the new resulting chapters, not for the surrounding chapters.
Review and enhance the content while preserving its original format, structure, and intent.
Ensure that 'Chapter' remains as 'Chapter,' and the same applies for 'cover,' 'back-cover,' and 'epilogue.'
"""
Expand Down

0 comments on commit c299820

Please sign in to comment.