Welcome to the Gemini AI Chatbot! This application allows users to interact with an AI chatbot using natural language. Built with React, Node, Express, and Gemini (Google's Generative AI), it offers a seamless experience for engaging in conversations with an intelligent virtual assistant.
- π User Authentication: Users can create an account or log in securely using a Google account. Please note that only Google login works currently.
- π¬ Real-time Messaging: Users can engage in real-time conversations with the AI chatbot, receiving instant responses to their queries.
- π€ AI-powered Responses: The chatbot utilizes Google's Generative AI technology to generate intelligent responses based on user input.
- π Secure Communication: All user interactions are encrypted to ensure privacy and security.
- π Multi-platform Compatibility: The application is compatible across various platforms, including web browsers and mobile devices.
- βοΈ Customizable Settings: Users can personalize their chat experience by adjusting settings such as language preferences and conversation themes.
- Clone the repository:
git clone https://github.com/xsarahyu/gemini-AI-chatbot.git
- Navigate to the backend directory:
cd backend
- Create an .env file with your Gemini API information:
clientID={your clientID} clientSecret={your clientSecret} secret={your secret} PORT=8420 geminiKey={your geminiKey}
- Install backend dependencies:
npm install
- Run the backend:
node server
- Navigate to the frontend directory (in a new terminal):
cd app
- Install frontend dependencies:
npm install
- Run the frontend:
npm run dev
- The app is now live at http://localhost:5173!
app/src
βββ components
β βββ Footer.jsx
β βββ LandingPage.jsx
β βββ LoginPage.jsx
β βββ MessagesComponent.jsx
β βββ NavBar.jsx
βββ App.css
βββ App.jsx
βββ index.css
βββ main.jsx
backend
βββ server.js
To run Jest tests locally:
- Navigate to the frotnend directory:
cd app
- Install frontend dependencies:
npm install
- Run the tests:
npm test
- You should now see test coverage in your terminal.
gemini-AI-chatbot/app/src/components/Footer.test.jsx
Lines 5 to 11 in c8ca1ae
gemini-AI-chatbot/app/src/components/LandingPage.test.jsx
Lines 5 to 11 in c8ca1ae
gemini-AI-chatbot/app/src/components/LoginPage.test.jsx
Lines 17 to 21 in fb21df6
gemini-AI-chatbot/app/src/components/LoginPage.test.jsx
Lines 23 to 27 in fb21df6
gemini-AI-chatbot/app/src/components/LoginPage.test.jsx
Lines 29 to 33 in fb21df6
gemini-AI-chatbot/app/src/components/LoginPage.test.jsx
Lines 35 to 39 in fb21df6
Test #1: Simulates entering text into the message input field, clicking the send button, and then verifies that the entered message renders.
gemini-AI-chatbot/app/src/components/MessagesComponent.test.jsx
Lines 7 to 18 in c8ca1ae
gemini-AI-chatbot/app/src/components/MessagesComponent.test.jsx
Lines 20 to 25 in c8ca1ae
gemini-AI-chatbot/app/src/components/MessagesComponent.test.jsx
Lines 27 to 32 in c8ca1ae
gemini-AI-chatbot/app/src/components/NavBar.test.jsx
Lines 6 to 17 in c8ca1ae
- Make sure that the frontend and backend are running, with all dependencies installed.
- Open the Cypress test runner (in a new terminal):
cd app
β‘οΈnpx cypress open
The following steps occur in the Cypress test runner:
- In the test runner, select "E2E Testing."
- You'll be prompted to choose a browser to run the tests in; any is fine.
- Cypress will open a new window containing a list of all the end-to-end tests.
- Click on a test file to run it.
- The selected test will begin execution. You'll see each step being performed in real-time within the Cypress GUI.
- If the test passes, the screen will turn green. If it fails, the screen will turn red, indicating which step failed.
- To run other test files, navigate back to the main page by selecting the "Specs" label in the sidebar.
- From the main page, you can select and run other test files one by one.
This test suite ensures that the login page can be accessed from the homepage, and checks for the presence of username and password input fields on the login page.
gemini-AI-chatbot/app/cypress/e2e/loginpage.cy.js
Lines 1 to 10 in c8ca1ae
This test suite ensures that users can navigate to the messages page and post a message. It also verifies that the posted message is displayed on the page.
gemini-AI-chatbot/app/cypress/e2e/messagesPage.cy.js
Lines 1 to 12 in c8ca1ae