StoryWeaver AI
StoryWeaver AI is your creative co-pilot, helping you transform fledgling ideas into fully-formed stories. Generate unique characters, sculpt immersive worlds, and weave compelling plots with our intelligent storycrafting assistant. Built with Next.js, Tailwind CSS, shadcn/ui, and powered by Gaia's LLM API.
The complete source code and detailed instructions for setting up and running this example can be found in the Gaia Cookbook repository.
Features
- Idea to Story: Input your core story idea, genre, desired length, and optional details like protagonist, conflict, world vibe, and tone.
- AI-Powered Generation: Leverages a Large Language Model (via Gaia's OpenAI-compatible API) to craft unique stories.
- Markdown Support: Displays generated stories with rich text formatting.
- Download as Image: Save your favorite stories as PNG images.
- Social Sharing: Quickly share links to your app (users can attach their downloaded story image) on X (Twitter), LinkedIn, and Facebook.
- Sleek UI: Modern and responsive interface built with shadcn/ui and Tailwind CSS.
Tech Stack
- Framework: Next.js (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- Form Management: React Hook Form & Zod
- LLM Integration:
openai
npm package configured for Gaia's API - Markdown Rendering:
react-markdown
- HTML to Image:
dom-to-image-more
- Icons:
lucide-react
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Prerequisites
- Node.js (v18.x or later recommended)
- npm or yarn
- A Gaia API Key (Get one here)
Setup & Installation
-
Clone the repository:
git clone https://github.com/harishkotra/story-weaver-ai.git
cd story-weaver-ai -
Install dependencies:
npm install
# or
yarn install -
Set up Environment Variables: Create a
.env.local
file in the root of the project. This file is ignored by Git and is used for local environment configuration.cp .env.example .env.local
Now, open
.env.local
and add your API key:# .env.local
# Required: Your API Key for the Gaia LLM service (or other OpenAI-compatible API)
GAIA_API_KEY="your_actual_gaia_api_key_here"
# Optional: If Gaia changes their endpoint or you use a different compatible service
# Default is 'https://llama70b.gaia.domains/v1' if not set
GAIA_API_ENDPOINT="https://your-custom-openai-compatible-endpoint/v1"
GAIA_API_MODEL="llama70b"Important: Replace
"your_actual_gaia_api_key_here"
with your real API key. (Get one here) -
Initialize shadcn/ui (if you need to add more components): While the project is set up, if you intend to add more shadcn/ui components later, you might need to run init (though it should be configured already):
npx shadcn@latest init
Follow the prompts, accepting the defaults or aligning with existing project configuration (
src/app/globals.css
,tailwind.config.ts
, aliases@/components
and@/lib/utils
).
Running the Application Locally
-
Start the development server:
npm run dev
# or
yarn dev -
Open your browser: Navigate to
http://localhost:3000
.
You should now see the StoryWeaver AI application running!
The complete source code and detailed instructions for setting up and running this example can be found in the Gaia Cookbook repository.