A powerful Next.js application that combines AI story generation, chat functionality, and streaming capabilities using the AI Tutor API.
- Story Generation: Create unique stories using AI with custom prompts
- Interactive Chat: Real-time chat interface with AI
- Streaming Responses: Stream AI responses for a more natural conversation flow
- Token Management: Built-in token generation and management
- Beautiful UI: Modern, responsive design with glass-morphism effects
- Multiple Modes: Switch between different interaction modes:
- 🔧 Workflow Mode
- 💬 Chat Mode
- 📡 Streaming Mode
- 🔑 Token Generation
- Node.js 16.8 or later
- pnpm (recommended) or npm
- AI Tutor API credentials
- Clone the repository:
git clone https://github.com/yourusername/ai-story-generator.git
cd ai-story-generator
Install dependencies:
pnpm install
Create a .env.local file in the root directory:
AITUTOR_API_KEY=xxxxxxxxx
WORKFLOW_ID=xxxxxxxxx
CHATBOT_ID=xxxxxxxxx
NEXT_PUBLIC_AITUTOR_TOKEN=xxxxxxxxxx
Run the development server:
pnpm dev
Visit http://localhost:3000 to see the application.
- Framework: Next.js 13
- Styling: Tailwind CSS
- AI Integration: AI Tutor API
- Icons: React Icons
- Markdown: marked
- Type Safety: TypeScript
ai-story-generator/
├── src/
│ ├── app/
│ │ ├── api/
│ │ │ ├── chat/
│ │ │ ├── run/
│ │ │ └── token/
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── components/
│ │ ├── StoryDisplay.tsx
│ │ └── StreamingChat.tsx
│ └── styles/
│ └── globals.css
├── public/
├── .env.local
└── package.json
The workflow mode provides an intuitive interface for story creation with AI. Simply enter your prompt and get creative stories in response.
Engage in dynamic conversations with AI using the chat mode. Features include:
- Streaming responses for natural conversation flow
- Message history tracking
- Markdown formatting support
- Error handling and recovery
Generate and manage API tokens directly from the interface:
- One-click token generation
- Secure token storage
- Token refresh capabilities
- Clear token display and management
- Responsive Design: Works seamlessly on desktop and mobile
- Glass Morphism: Modern, translucent UI elements
- Gradient Themes: Beautiful color schemes throughout
- Loading States: Clear feedback during operations
- Error Handling: User-friendly error messages
- Smooth Transitions: Polished mode switching
- Accessibility: Keyboard navigation support
The application integrates with the AI Tutor API for various functionalities:
POST /api/run
body: { story: string }
POST /api/chat
body: { messages: Message[] }
POST /api/token
response: { success: boolean, token: string }
Deploy your own version of the AI Story Generator:
- Fork this repository
- Set up environment variables in your deployment platform
- Deploy to your preferred hosting service (Vercel recommended)
This project is licensed under the MIT License - see the LICENSE.md file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
For support, email your-email@example.com or open an issue in this repository.
- AI Tutor API for providing the AI capabilities
- Next.js team for the amazing framework
- All contributors who help improve this project
- Made with ❤️ by TSI