A sophisticated RAG (Retrieval-Augmented Generation) chatbot built with Next.js, LangChain.js, and OpenAI. This application provides intelligent responses by combining retrieval of relevant information with generative AI capabilities.
- RAG Architecture: Combines document retrieval with AI generation for accurate responses
- Modern UI: Clean, responsive interface built with Next.js and Tailwind CSS
- Real-time Chat: Interactive chat experience with streaming responses
- Document Processing: Intelligent document parsing and vector storage
- OpenAI Integration: Powered by OpenAI's GPT models
- Frontend: Next.js 14, React, TypeScript
- Styling: Tailwind CSS
- AI/ML: LangChain.js, OpenAI API
- Database: Vector database for document storage
Before running this project, make sure you have:
- Node.js 18+ installed
- npm or yarn package manager
- OpenAI API key
- Git (for cloning the repository)
git clone https://github.com/yourusername/rag-chat-bot.git
cd rag-chat-bot/nextjs-f1gptnpm install
# or
yarn install
# or
pnpm installCreate a .env.local file in the root directory and add your environment variables:
OPENAI_API_KEY=your_openai_api_key_here
# Add other required environment variablesnpm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 with your browser to see the result.
nextjs-f1gpt/
├── app/
│ ├── api/
│ │ └── chat/
│ │ └── route.ts # Chat API endpoint
│ ├── components/
│ │ ├── Bubble.tsx # Chat bubble component
│ │ ├── LoadingBubble.tsx # Loading animation
│ │ ├── PromptSuggestionButton.tsx
│ │ └── PromptSuggestionsRow.tsx
│ ├── assets/ # Static assets
│ ├── global.css # Global styles
│ ├── layout.tsx # Root layout
│ └── page.tsx # Home page
├── scripts/
│ └── loadDb.ts # Database loading script
└── README.md
The application includes the following API endpoints:
/api/chat- Main chat endpoint for processing user messages and generating responses
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
- Push your code to GitHub
- Connect your repository to Vercel
- Add your environment variables in Vercel dashboard
- Deploy!
npm run build
npm start- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Next.js for the amazing React framework
- LangChain.js for the AI orchestration
- OpenAI for the powerful AI models
If you have any questions or need help, please:
- Check the Issues page
- Create a new issue if your problem isn't already reported
- Contact the maintainers --> widushanp@gmail.com
Repository: https://github.com/widushan/RAG-Chat-Bot.git