Web Chatbot with document analysis and CMS.
MaxChatbot project was made for internship purposes.
Its goal was to create a chatbot that can be integrated into a website and answer questions based on uploaded files (CSV, DOCX, PDF) and CMS content, using a vector database.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
You need the following installed on your machine:
- A modern web browser (Chrome, Firefox, Edge, etc.)
- Live Server VSCode extension (optional, only if using VSCode and you want Live-Server preview)
- A running instance of the MaxChatbot backend (see Backend Setup)
The frontend requires a working MaxChatbot backend API. You can use either the hosted version on Hugging Face Spaces or run it locally.
https://maxxxxior-maxchatbotbackend.hf.space
- Clone or download the backend repository.
- Open a terminal in the backend folder (where
app.pyis located). - Create and activate a virtual environment:
python -m venv venv
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
.\venv\Scripts\Activate- Install dependencies:
pip install -r requirements.txt- Set your environment variables or edit app.py for testing purposes:
HF_TOKEN = "hf_your_token_here"
QDRANT_API_KEY = "your_qdrant_api_key_here"
QDRANT_HOST = "https://your-qdrant-host-url"- Run the backend:
uvicorn app:app --reload- The backend will now be accessible at:
http://127.0.0.1:8000
- Open
script.jsand set the correct backend URL:
const BACKEND = "http://127.0.0.1:8000"; // for local testing
// or
const BACKEND = "https://maxxxxior-maxchatbotbackend.hf.space"; // for hosted backendMake sure there is no trailing slash
/at the end of the URL.
- Open
index.htmlin a browser.- For live reloading of CSS/JS, use Live Server VS Code extension.
- To customize translations, edit
i18n.js. You can modify existing strings or add new variables/languages.
- Check the live demo frontend here: MaxChatbot Live Demo
- Hosted backend: MaxChatbotBackend on Hugging Face
There are no automated tests for the frontend. Manual testing is recommended by:
- Starting a session
- Uploading sample files (TXT, PDF, CSV, DOCX, JSON)
- Asking the chatbot questions about uploaded files
- Deleting files and observing system bubbles and UI updates
- Enter a session name and click Start session.
- Upload files (up to 3, max 1 MiB each).
- Chat with the bot to query file content.
- Use the Show files panel to view or delete uploaded files.
- Switch languages at any time to see translations of system messages.
You can deploy the frontend simply by hosting index.html and the assets on any static web server. For example:
Ensure the backend is accessible from your frontend (hosted on Hugging Face Spaces or another server) and update
script.jswith the correct backend URL.
- HTML - Markup language for structure
- CSS - Styling
- JavaScript - Frontend logic
- FastAPI - Backend API (separate repository)
- Hugging Face Transformers - NLP model for file analysis
- Qdrant - Vector database for storing embeddings
- SentenceTransformers - Embeddings
All system messages, buttons, copyright and placeholders are translated via i18n.js.
- You can change existing translations by editing the
plorenobjects ini18n.js. - To add a new language, create a new key (e.g.,
esfor Spanish) and provide translations for all existing variables. - Make sure to also update
window.langinscript.jsor add a language switcher to use the new language. - Examples of system messages:
fileDeleted,startSessionFirst,selectFile,fileTooLarge,fileUploaded, etc.
- @Maxxxxior - Idea & Full Implementation