Skip to content

azamzubairi/ai-joke-generator

Repository files navigation

AI Joke Generator

A modern web application that generates customized jokes using OpenAI's GPT-4o-mini model. Built with Next.js, TypeScript, and Tailwind CSS.

AI Joke Generator

Features

  • 🎯 Customizable Joke Parameters

    • Choose from various topics (Work, People, Animals, etc.)
    • Select different tones (Witty, Sarcastic, Silly, etc.)
    • Pick joke types (Pun, Knock-knock, Story, etc.)
    • Adjust creativity level with temperature control
  • 🤖 AI-Powered Generation

    • Uses OpenAI's GPT-4o-mini model
    • Smart prompt engineering for better results
    • Automatic joke evaluation system
  • 📊 Quality Assessment

    • Evaluates humor level
    • Checks appropriateness
    • Monitors potential offensive content
  • 💫 Modern UI/UX

    • Responsive design
    • Beautiful animations
    • Real-time feedback
    • Joke history with scrollable feed

Tech Stack

  • Frontend Framework: Next.js 13.5
  • Language: TypeScript
  • Styling: Tailwind CSS
  • UI Components: shadcn/ui
  • AI Integration: OpenAI API
  • Icons: Lucide React
  • Toast Notifications: Sonner

Getting Started

Prerequisites

  • Node.js 16.8 or later
  • OpenAI API key

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/ai-joke-generator.git
cd ai-joke-generator
  1. Install dependencies:
npm install
  1. Create a .env.local file in the root directory and add your OpenAI API key:
NEXT_PUBLIC_OPENAI_API_KEY=your_api_key_here
  1. Start the development server:
npm run dev
  1. Open http://localhost:3000 in your browser.

Usage

  1. Configure Joke Parameters

    • Select a topic from the dropdown menu
    • Choose the desired tone
    • Pick a joke type
    • Adjust the creativity slider
  2. Generate Joke

    • Click the "Generate Joke" button
    • Wait for the AI to create and evaluate the joke
  3. View Results

    • Read the generated joke
    • Check the evaluation metrics
    • Browse previous jokes in the history section

Project Structure

ai-joke-generator/
├── app/
│   ├── layout.tsx
│   └── page.tsx
├── components/
│   ├── gradient-background.tsx
│   ├── joke-generator.tsx
│   ├── joke-history.tsx
│   └── ui/
├── lib/
│   ├── openai.ts
│   ├── types.ts
│   └── utils.ts
└── public/

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

About

AI Joke Generator based on NextJS using OpenAI API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •