Alwrity - Bug fixes
This commit is contained in:
36
alwrity.py
36
alwrity.py
@@ -70,7 +70,7 @@ def start_interactive_mode():
|
||||
if mode:
|
||||
if mode == 'AI Blog Writer':
|
||||
write_blog()
|
||||
elif mode == 'AI Story Writer'
|
||||
elif mode == 'AI Story Writer':
|
||||
write_story()
|
||||
elif mode == 'Do keyword Research':
|
||||
do_web_research()
|
||||
@@ -144,10 +144,44 @@ def get_api_key(api_key: str, api_description: str):
|
||||
print(f"✅ {api_description} API Key added to .env file.")
|
||||
|
||||
|
||||
# FIXME
|
||||
def faq_generator():
|
||||
return
|
||||
|
||||
|
||||
def write_story():
|
||||
|
||||
personas = [
|
||||
("Award-Winning Science Fiction Author", "You are an award-winning science fiction author with a penchant for expansive, intricately woven stories. Your ultimate goal is to write the next award-winning sci-fi novel."),
|
||||
("Historical Fiction Author", "You are a seasoned historical fiction author, meticulously researching past eras to weave captivating narratives. Your goal is to transport readers to different times and places through your vivid storytelling."),
|
||||
("Fantasy World Builder", "You are a world-building enthusiast, crafting intricate realms filled with magic, mythical creatures, and epic quests. Your ambition is to create the next immersive fantasy saga that captivates readers' imaginations."),
|
||||
("Mystery Novelist", "You are a master of suspense and intrigue, intricately plotting out mysteries with unexpected twists and turns. Your aim is to keep readers on the edge of their seats, eagerly turning pages to unravel the truth."),
|
||||
("Romantic Poet", "You are a romantic at heart, composing verses that capture the essence of love, longing, and human connections. Your dream is to write the next timeless love story that leaves readers swooning."),
|
||||
("Thriller Writer", "You are a thrill-seeker, crafting adrenaline-pumping tales of danger, suspense, and high-stakes action. Your mission is to keep readers hooked from start to finish with heart-pounding thrills and unexpected twists."),
|
||||
("Children's Book Author", "You are a storyteller for the young and young at heart, creating whimsical worlds and lovable characters that inspire imagination and wonder. Your goal is to spark joy and curiosity in young readers with enchanting tales."),
|
||||
("Satirical Humorist", "You are a keen observer of society, using humor and wit to satirize the absurdities of everyday life. Your aim is to entertain and provoke thought, delivering biting social commentary through clever and humorous storytelling."),
|
||||
("Biographical Writer", "You are a chronicler of lives, delving into the stories of real people and events to illuminate the human experience. Your passion is to bring history to life through richly detailed biographies that resonate with readers."),
|
||||
("Dystopian Visionary", "You are a visionary writer, exploring dark and dystopian futures that reflect contemporary fears and anxieties. Your vision is to challenge societal norms and provoke reflection on the path humanity is heading."),
|
||||
("Magical Realism Author", "You are a purveyor of magical realism, blending the ordinary with the extraordinary to create enchanting and thought-provoking tales. Your goal is to blur the lines between reality and fantasy, leaving readers enchanted and introspective.")
|
||||
]
|
||||
|
||||
persona_names = [persona[0] for persona in personas]
|
||||
|
||||
dialog = radiolist_dialog(
|
||||
title="Select Your Story Writing Persona",
|
||||
text="Choose a persona that resonates with you:",
|
||||
values=persona_names
|
||||
)
|
||||
|
||||
selected_persona_name = dialog.run()
|
||||
|
||||
if selected_persona_name:
|
||||
selected_persona = next((persona for persona in personas if persona[0] == selected_persona_name), None)
|
||||
if selected_persona:
|
||||
message_dialog(
|
||||
title=selected_persona[0],
|
||||
text=selected_persona[1]
|
||||
).run()
|
||||
|
||||
|
||||
def blog_tools():
|
||||
|
||||
@@ -47,7 +47,6 @@ def write_blog_from_keywords(search_keywords, url=None):
|
||||
logger.error(f"Failed in Google web research: {err}")
|
||||
# logger.info/check the final blog content.
|
||||
logger.info("\n######### Draft1: Finished Blog from Google web search: ###########\n\n")
|
||||
exit(1)
|
||||
|
||||
|
||||
# Do Tavily AI research to augument the above blog.
|
||||
|
||||
57
lib/gpt_providers/text_generation/ai_story_writer.py
Normal file
57
lib/gpt_providers/text_generation/ai_story_writer.py
Normal file
@@ -0,0 +1,57 @@
|
||||
persona = '''\
|
||||
You are an award-winning science fiction author with a penchant for expansive,
|
||||
intricately woven stories. Your ultimate goal is to write the next award winning
|
||||
sci-fi novel.'''
|
||||
|
||||
guidelines = '''\
|
||||
Writing Guidelines
|
||||
|
||||
Delve deeper. Lose yourself in the world you're building. Unleash vivid
|
||||
descriptions to paint the scenes in your reader's mind. Develop your
|
||||
characters—let their motivations, fears, and complexities unfold naturally.
|
||||
Weave in the threads of your outline, but don't feel constrained by it. Allow
|
||||
your story to surprise you as you write. Use rich imagery, sensory details, and
|
||||
evocative language to bring the setting, characters, and events to life.
|
||||
Introduce elements subtly that can blossom into complex subplots, relationships,
|
||||
or worldbuilding details later in the story. Keep things intriguing but not
|
||||
fully resolved. Avoid boxing the story into a corner too early. Plant the seeds
|
||||
of subplots or potential character arc shifts that can be expanded later.
|
||||
|
||||
Remember, your main goal is to write as much as you can. If you get through
|
||||
the story too fast, that is bad. Expand, never summarize.
|
||||
'''
|
||||
|
||||
premise_prompt = f'''\
|
||||
{persona}
|
||||
|
||||
Write a single sentence premise for a sci-fi story featuring cats.'''
|
||||
|
||||
outline_prompt = f'''\
|
||||
{persona}
|
||||
|
||||
You have a gripping premise in mind:
|
||||
|
||||
{{premise}}
|
||||
|
||||
Write an outline for the plot of your story.'''
|
||||
|
||||
starting_prompt = f'''\
|
||||
{persona}
|
||||
|
||||
You have a gripping premise in mind:
|
||||
|
||||
{{premise}}
|
||||
|
||||
Your imagination has crafted a rich narrative outline:
|
||||
|
||||
{{outline}}
|
||||
|
||||
First, silently review the outline and the premise. Consider how to start the
|
||||
story.
|
||||
|
||||
Start to write the very beginning of the story. You are not expected to finish
|
||||
the whole story now. Your writing should be detailed enough that you are only
|
||||
scratching the surface of the first bullet of your outline. Try to write AT
|
||||
MINIMUM 1000 WORDS.
|
||||
|
||||
{guidelines}'''
|
||||
Reference in New Issue
Block a user