Value Added Program  ยท  Day 2

AI Chatbot

A full-featured multimodal chatbot powered by Mistral Pixtral โ€” with multilingual support, regional TTS, file understanding, and session memory.

Node.js Node.js
Express Express
JavaScript JavaScript
HTML5 HTML5
CSS3 CSS3
SQLite SQLite
Mistral Mistral Pixtral
Edge TTS Edge TTS
npm npm
git git
๐Ÿ’ฌ
AI Chat
Powered by Mistral Pixtral with full session memory. Understands context across the entire conversation.
๐Ÿ“Ž
File Understanding
Upload JPG, PNG, or PDFs up to 10MB. Pixtral reads and reasons about images and scanned documents natively.
๐ŸŒ
Multilingual
Respond in 11 languages including Hindi, Marathi, Tamil, Telugu, Bengali, and more โ€” switchable mid-conversation.
๐Ÿ”Š
Text-to-Speech
Edge TTS voices for English and regional Indian languages. Zero extra API calls โ€” runs via a local endpoint.
๐Ÿง 
Session Memory
SQLite stores full chat history per browser tab. Auto-created on first run โ€” no setup needed.
๐ŸŽ›๏ธ
Response Styles
Concise, Detailed, Formal, or Simple (ELI5). Injected into the system prompt โ€” ~10 token overhead only.
01
Clone & Install
Clone the repo and install all dependencies.
git clone <your-repo-url>
cd chatbot
npm install
02
Configure Environment
Copy the example env file and add your Mistral API key. Get one at console.mistral.ai.
cp .env.example .env
MISTRAL_API_KEY=your_key_here
PORT=3000
03
Start the Server
The SQLite database and uploads folder are created automatically on first run.
node server.js
04
Open in Browser
Navigate to http://localhost:3000 โ€” the chatbot is ready.
chatbot/
 โ”œโ”€โ”€ public/             โ† Frontend (served statically)
 โ”‚   โ”œโ”€โ”€ index.html
 โ”‚   โ”œโ”€โ”€ style.css
 โ”‚   โ””โ”€โ”€ js/
 โ”‚        โ””โ”€โ”€ app.js
 โ”œโ”€โ”€ src/
 โ”‚   โ”œโ”€โ”€ routes/
 โ”‚   โ”‚   โ”œโ”€โ”€ chat.js      โ† Pixtral API + history
 โ”‚   โ”‚   โ”œโ”€โ”€ tts.js       โ† Edge TTS audio
 โ”‚   โ”‚   โ”œโ”€โ”€ upload.js    โ† File upload (10MB)
 โ”‚   โ”‚   โ””โ”€โ”€ session.js   โ† Session cleanup
 โ”‚   โ”œโ”€โ”€ db.js          โ† SQLite setup
 โ”‚   โ””โ”€โ”€ config.js
 โ”œโ”€โ”€ docs/              โ† Implementation guides
 โ”œโ”€โ”€ uploads/           โ† Gitignored, auto-cleaned
 โ”œโ”€โ”€ chatbot.db         โ† Auto-created, gitignored
 โ”œโ”€โ”€ .env
 โ”œโ”€โ”€ package.json
 โ””โ”€โ”€ server.js
Method Endpoint Description
POST /api/chat Send message, receive AI reply with session history
POST /api/upload Upload file (JPG / PNG / PDF, max 10MB)
POST /api/tts Convert text to speech audio (Edge TTS)
DELETE /api/session/:id Clear session data and delete uploaded files
๐Ÿ‡บ๐Ÿ‡ธ
English (US)
en-US-AriaNeural
๐Ÿ‡ฌ๐Ÿ‡ง
English (UK)
en-GB-SoniaNeural
๐Ÿ‡ฎ๐Ÿ‡ณ
Hindi
hi-IN-SwaraNeural
๐Ÿ‡ฎ๐Ÿ‡ณ
Marathi
mr-IN-AarohiNeural
๐Ÿ‡ฎ๐Ÿ‡ณ
Tamil
ta-IN-PallaviNeural
๐Ÿ‡ฎ๐Ÿ‡ณ
Telugu
te-IN-MohanNeural
๐Ÿ‡ฎ๐Ÿ‡ณ
Bengali
bn-IN-TanishaaNeural
๐Ÿ‡ฎ๐Ÿ‡ณ
Kannada
kn-IN-SapnaNeural
๐Ÿ‡ฎ๐Ÿ‡ณ
Gujarati
gu-IN-DhwaniNeural
๐Ÿ‡ฎ๐Ÿ‡ณ
Punjabi
pa-IN-OjasNeural
Package Purpose
express Web server and routing
multer File upload handling with 10MB limit enforcement
better-sqlite3 Session memory and chat history (synchronous SQLite)
pdf-parse Text extraction from text-based PDFs
edge-tts Text-to-speech via Microsoft Edge neural voices
uuid Session ID and upload filename generation
dotenv Environment variable loading