A modern, real-time AI assistant for websites built with Next.js and powered by Unbody. This project showcases Unbody's capabilities in creating intelligent, context-aware chat interfaces with RAG (Retrieval-Augmented Generation) capabilities.
Unbody is a powerful AI platform that enables developers to build intelligent applications with advanced natural language processing and knowledge retrieval capabilities. This project demonstrates how to leverage Unbody's features to create a sophisticated chat interface that can understand, search, and respond to user queries in real-time.
- 🤖 Real-time AI chat interface with streaming responses powered by Unbody
- 🔍 RAG (Retrieval-Augmented Generation) for accurate, context-aware responses
- 🎨 Beautiful, responsive UI with Framer Motion animations
- 📱 Mobile-friendly design
- 🔄 Real-time status updates during processing
- 💬 Thread-based conversation management
- 🖼️ Support for web and image results from Unbody's knowledge base
- ⚡ Server-sent events for streaming responses
- Core Technology: Unbody for AI and RAG capabilities
- Framework: Next.js 14 with App Router
- UI: Tailwind CSS, Framer Motion, Lucide Icons
- State Management: React Hooks
- Type Safety: TypeScript
- Styling: Tailwind CSS with shadcn/ui components
- Animation: Framer Motion
- Node.js 18+
- npm or yarn
- Unbody API Key (sign up at unbody.io)
- Clone the repository:
git clone https://github.com/yourusername/next-js-website-ai-assistant.git
cd next-js-website-ai-assistant
- Install dependencies:
npm install
# or
yarn install
- Set up environment variables:
Create a
.env.local
file in the root directory and add your Unbody API key:
UNBODY_API_KEY=your_api_key_here
- Start the development server:
npm run dev
# or
yarn dev
- Open http://localhost:3000 in your browser.
├── app/ # Next.js app directory
├── components/ # React components
│ ├── chat/ # Chat-related components
│ └── ui/ # Reusable UI components
├── hooks/ # Custom React hooks
├── lib/ # Utility functions and shared logic
│ └── unbody/ # Unbody integration utilities
├── public/ # Static assets
└── types/ # TypeScript type definitions
RagChat
: Main chat component that manages the conversation flowChatMessages
: Displays the message threadChatInput
: Handles user input and message sendingCurrentResponse
: Shows the current processing state
StatusIndicator
: Shows detailed processing statusMiniStatusIndicator
: Compact status display for mobile
useThread
: Manages conversation state and message handlinguseRag
: Handles RAG processing and state management
The assistant uses Unbody's streaming capabilities to provide immediate feedback to users, with server-sent events for real-time updates.
Users can see the current processing stage:
- Understanding the question (using Unbody's NLP)
- Searching for relevant information (Unbody's knowledge retrieval)
- Generating the response (Unbody's response generation)
- Maintains conversation history
- Supports follow-up questions
- Shows processing status for each message
- 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.