This project is an AI chatbot application built with Next.js, leveraging the Vercel AI SDK and OpenAI's GPT model. It provides a modern, responsive interface for users to interact with an AI assistant.
- Real-time chat interface with streaming responses
- Integration with OpenAI's GPT model via Vercel AI SDK
- Responsive design with dark mode support
- Error handling with modal dialogs
- Auto-resizing text area for input
- Modern UI components from shadcn/ui
- Next.js 14
- React 18
- Vercel AI SDK
- OpenAI API
- Tailwind CSS
- Radix UI components (via shadcn/ui)
- TypeScript
Before you begin, ensure you have the following installed:
- Node.js (v18 or later)
- npm or yarn
You will also need an OpenAI API key.
-
Clone the repository:
git clone https://github.com/aayank13/gpt_chatbot.git cd gpt_chatbot
-
Install dependencies:
npm install # or yarn install
-
Create a
.env.local
file and add your OpenAI API key:OPENAI_API_KEY=your-api-key
-
Run the development server:
npm run dev # or yarn dev
-
Open http://localhost:3000 with your browser to see the result.
- Navigate to the home page to access the chatbot interface.
- Type your queries into the input field and press Enter or click the send button.
- View the AI's responses in real-time, with smooth streaming text updates.
- Use the dark mode toggle to switch between light and dark themes.
To deploy the application, you can use Vercel:
- Push your code to a GitHub repository.
- Link the repository to your Vercel account.
- Set up the necessary environment variables in the Vercel dashboard.
- Deploy the project with a single click.
Alternatively, you can use another hosting provider that supports Next.js.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feature-name
- Commit your changes with clear messages:
git commit -m "Add feature-name"
- Push the branch to your forked repository:
git push origin feature-name
- Create a pull request to the main repository.
This project is licensed under the MIT License. See the LICENSE file for details.
- Vercel AI SDK for providing easy integration with OpenAI.
- shadcn/ui for modern and accessible UI components.
- OpenAI for the GPT model API.
- All contributors who helped build and improve this project.