This project is a smart e-commerce support chatbot built with Next.js, Google Gemini API, and ShadCN UI components. The chatbot provides real-time assistance to users, analyzes their sentiments, and stores all conversation data in the browser's localStorage. It also collects user feedback and saves it for future insights. For now I have taken a usecase as if it is a support assistant for an e-commerce store of shoes named Snikre(which is my brand itself).
- AI-Powered Chatbot: Powered by the Google Gemini API to provide intelligent responses.
- Sentiment Analysis: Analyzes the sentiment of user messages (positive, neutral, or negative).
- Local Data Storage: Stores conversation history and sentiment data in
localStoragefor persistence. - Feedback Collection: Collects user feedback on products for sentiment tracking and insights.
- Modern UI: Built with ShadCN's elegant and responsive UI components.
- Lightweight and Fast: Optimized for performance and usability.
-
Clone the Repository
git clone https://github.com/AyushAwasthi2384/Support-System-Chatbot cd Support-System-Chatbot -
Install Dependencies Make sure you have Node.js and npm/yarn installed. Then, install the dependencies:
npm install # or yarn install -
Set Up Environment Variables Create a
.envfile in the root of your project and add your Google Gemini API key:GEMINI_API=your-google-gemini-api-key
-
Run the Application Start the development server:
npm run dev # or yarn dev -
Open in Browser Navigate to http://localhost:3000 to view the application.
- User Interaction: Users type messages in the chatbot interface.
- Sentiment Analysis: Each user message is analyzed for sentiment using a lightweight sentiment analysis function.
- Response Generation: The Google Gemini API generates intelligent responses based on the conversation context.
- Data Persistence:
- The entire conversation, including sentiment data, is saved in the browser's
localStorage. - Feedback for specific products is collected and also stored in
localStorage.
- The entire conversation, including sentiment data, is saved in the browser's
Route: /api/save/conversation
Method: POST
Description: Saves conversation data in localStorage.
Route: /api/save/product-feedback
Method: POST
Description: Collects user feedback for products and stores it with relevant sentiment data.
Route: /api/sentiment
Method: POST
Description: Analyzes the sentiment of a given message.
- Next.js: Framework for building the application.
- Google Gemini API: For generative AI capabilities.
- ShadCN: For responsive and modern UI components.
- React: Frontend library for building the chatbot interface.
- React-Markdown: For rendering markdown in chat messages.
- LocalStorage: For storing conversation and feedback data.
- Add user authentication for personalized experiences.
- Migrate from
localStorageto a robust database like MongoDB. - Enable exporting chat history for customer support teams.
- Add multi-language support for a global audience.
We welcome contributions to improve this project! To contribute:
- Fork this repository.
- Create a new branch:
git checkout -b feature-name. - Make your changes and commit:
git commit -m 'Add feature-name'. - Push to the branch:
git push origin feature-name. - Create a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
- Google Gemini API for powerful and efficient NLP.
- ShadCN for their amazing UI components.
Developed by Ayush Awasthi🚀 and team!
(in half an hour😉)