Teaching assistant
It acts like a patient tutor that knows the DLS curriculum and speaks in plain language with examples and truth tables.
Digital Logic Studio
This page walks you through what the DLS AI Chatbot project is, how it works, what Pinecone does, and what every folder is for โ no prior AI experience needed.
DLS AI Chatbot is a small backend service built for Digital Logic Studio (Boolforge). It answers student questions about digital logic โ Boolean algebra, gates, flip-flops, counters, and more.
It acts like a patient tutor that knows the DLS curriculum and speaks in plain language with examples and truth tables.
Powered by Groq and the llama-3.3-70b-versatile model โ responses come back in milliseconds.
It can pull real excerpts from your DLD/DLS textbooks stored in Pinecone, so answers match your course material.
The main Boolforge frontend calls this service over REST. It runs on its own port (5100) alongside the main backend.
In plain terms: we built a chatbot that reads your textbooks once, remembers them in a smart search database, and then uses that knowledge plus an AI brain to answer student questions.
/dataYou place PDF or text files of digital logic books (e.g. Morris Mano, Floyd) into the data/ folder.
Run npm run ingest. The script splits each book into small chunks and uploads them to Pinecone's vector database.
From the Boolforge app or the local test UI, a learner types something like "How does a JK flip-flop work?"
The server finds the 5 most relevant book passages in Pinecone, adds them to the AI prompt, and Groq writes a personalized answer.
This pattern is called RAG (Retrieval-Augmented Generation): retrieve facts first, then generate an answer grounded in those facts.
Pinecone is a cloud vector database. Think of it as a library index that understands meaning, not just exact keywords.
When you ingest a book, each chunk of text is turned into a list of numbers called an embedding (a mathematical fingerprint of what that paragraph is about). Pinecone stores millions of these fingerprints.
When a student asks "What is a multiplexer?", Pinecone converts that question into the same kind of fingerprint and finds the book paragraphs whose fingerprints are closest โ even if the book never used the exact same words.
Imagine every paragraph of your textbook on a sticky note. Pinecone is the wall where similar sticky notes are placed near each other. When a student asks a question, we find the nearest sticky notes and hand them to the AI before it answers โ so it cites your actual course material instead of guessing.
data/ folder do?
The data/ folder is your local bookshelf. It is where you put the source material
the chatbot should learn from.
data/ โโโ boolean-algebra-ch1.pdf โ your textbook chapters โโโ sequential-circuits.txt โ course notes โโโ README.md โ instructions (not ingested)
.pdf and .txt only. The ingest script reads text from PDFs automatically.
Actual book PDFs are gitignored for copyright. Each developer adds their own copies locally.
Add new books and run npm run ingest again. Pinecone gets updated with the new content.
Ingest command
npm run ingest
Reads every .pdf / .txt in data/, splits into ~500-word chunks with overlap, uploads to Pinecone.
Every important folder and what it is responsible for.
Dls-AI-Chatbot/ โ project rootserver.js
Starts the HTTP server on port 5100.
index.html
Local test chat UI โ open at /index.html when the server is running.
package.json
Dependencies and scripts: npm run dev, npm start, npm run ingest.
.env
Secret keys (Groq, Pinecone, JWT). Copy from .env.example.
data/ โ your textbooksPut PDF/TXT books here. The ingest script reads this folder and uploads chunks to Pinecone. See section above.
scripts/ โ one-off toolsingest.js
Chunks books from data/ and uploads them to Pinecone. Run with npm run ingest.
src/ โ main application codeapp.js
Express setup: CORS, JSON parsing, routes, static files.
config/groq.js
Connects to Groq AI (the LLM that writes answers).
config/pinecone.js
Connects to Pinecone vector database.
controllers/chatController.js
Handles chat requests: validates input, runs RAG, calls Groq, returns reply.
services/retrieval.js
Searches Pinecone for book chunks related to the user's question.
prompts/systemPrompt.js
Builds the "you are DLS Mentor" instruction with student name, topic, and curriculum.
routes/chat.js
Defines POST /api/ai/chat and streaming endpoint.
middleware/auth.js
Checks JWT login token (shared with main DLS backend).
middleware/rateLimit.js
Limits how many messages one user can send per minute.
website/ โ this guideYou are here. A static explainer page for the project. Open at /website/index.html.
docs/ โ contributor docsCode of conduct, contributing guide, security policy โ for developers joining the repo.
npm install
cp .env.example .env
Then add your Groq and Pinecone API keys.
data/your-book.pdf
npm run ingest
npm run dev
localhost:5100/index.html
localhost:5100/website/