One stop solution for organizations to manage the use of Generative AI chatbots like Gemini and ChatGPT by their employees.
System Requirements:
Python 3.12.0
NodeJS v21.7.2
Clone the project using the GitUrl
git clone <git-url>
cd backend
Use the package manager pip to install necessary requirements.
pip install -r requirements.txt
Now we will configure ngrok
to create an https
URL for our backend so that chrome extension could make API requests to it.
Chrome does not allow to make requests to http
based local host servers for security reasons. SignUp on the ngrok
website at https://ngrok.com/ and replace the <auth-token>
by the auth token provided by website in the following command.
ngrok config add-authtoken <auth-token>
In a new terminal with base directory as the project folder, run the following command to create an https
secured URL using ngrok which will be used in the frontend to make the requests to the backend.
./ngrok.exe http http://127.0.0.1:8000
Before Initialization, we need to create and configure the following .env
file inside the <PROJECT_FOLDER>\backend\backend
folder.
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_KEY=
FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
API_KEY_XXX=GEMINI_API_KEY
Now we can setup the database by following commands.
python ./manage.py makemigrations
python ./manage.py migrate
To Create a super user, use the following command and set email and password accordingly which will be used to log into the admin dashboard.
python ./manage.py createsuperuser
Now we can successfully start the backend server
python ./manage.py runserver
In a new terminal, change directory to the extension folder using following command:
cd halt-ai
Install the necessary packages to build the extension using the command:
npm install -g pnpm
pnpm install
Now open the file <PROJECT_FOLDER>\halt-ai\src\utils\handler.ts
in any code editor of preference and replace the variable value for this.BASE_URL = '<ngrok-url-for-backend>'
.
Now we will compile the extension using the command:
pnpm build
This will create us a build of extension which could be installed inside the chrome extensions.
Now go to Manage Chrome Extension
page and turn on the Developer Mode
Click on the Load unpacked option and select the following folder <PROJECT_FOLDER>\halt-ai\build\chrome-mv3-prod
Now go to the options panel of the extension by using right click on the extension on the top right and clicking on the options tab.
This will show a window to Login using the Employee ID. Type in the ID of the Employee. This will be used for logging in the administration panel.
The extension automatically activates when the user visits the following Generative AI Chatbots.
User will just have to write the query and press Enter
to start the checking process, if the query is safe, the extension will automatically pass the request to the chatbots to proceed and if not safe then will not allow the request and show the error on the screen of the user.
Admin can visit the administration panel by using the following link in the browser:
https://127.0.0.1:8000/admin
The testing folder contains Jupyter Notebook testing.ipynb
which was used to test the API with 113 different queries stored in the Book1.xlsx
file inside the folder.
For any query, feel free to react out to Siddharth Agrawal on [email protected]