This is a small AI-powered chat application built with Next.js 15 (App Router), Tailwind CSS, ShadCN UI components, and TypeScript. It integrates with HuggingFace's API to provide AI responses in a conversational format.
useChat
, to maintain clean and modular code.useChat
Hook:
messages
array) and communication with Hugging Face AI via fetchHuggingFaceResponse
.Chat Components:
ChatWindow
: Main layout that combines the chat area, sidebar, and message input.MessageBubble
: Displays individual chat messages with sender information.TypingIndicator
: Shows a loading indicator while waiting for AI responses.MessageInput
: Input field for users to type and send messages.AI Response Handling:
fetchHuggingFaceResponse
.MessageInput
component.sendMessage
function in the useChat
hook.sendMessage
updates the chat state with the user's message, fetches the AI response, and appends the response to the chat history.ChatWindow
component renders the updated messages in real-time.git clone https://github.com/shamimulhaque1992/next15-chatBot.git
cd next15-chatBot
npm install
NEXT_PUBLIC_HUGGINGFACE_API_KEY=your_hugging_face_api_key
npm run dev
The app will be available at http://localhost:${PORT}.
This should be the full setup and ready for deployment! If you need anything else, feel free to ask.