From e31086ecf05b0aa3e82e5c7deece377905d44261 Mon Sep 17 00:00:00 2001 From: mohdmaazgani <232573@kit.ac.in> Date: Fri, 23 Jan 2026 16:57:17 +0530 Subject: [PATCH 1/8] feat: add modular chatbot folder structure --- chatbot/README.md | 0 chatbot/chatbot.config.js | 0 chatbot/chatbot.css | 0 chatbot/chatbot.data.js | 0 chatbot/chatbot.html | 0 chatbot/chatbot.js | 0 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 chatbot/README.md create mode 100644 chatbot/chatbot.config.js create mode 100644 chatbot/chatbot.css create mode 100644 chatbot/chatbot.data.js create mode 100644 chatbot/chatbot.html create mode 100644 chatbot/chatbot.js diff --git a/chatbot/README.md b/chatbot/README.md new file mode 100644 index 00000000..e69de29b diff --git a/chatbot/chatbot.config.js b/chatbot/chatbot.config.js new file mode 100644 index 00000000..e69de29b diff --git a/chatbot/chatbot.css b/chatbot/chatbot.css new file mode 100644 index 00000000..e69de29b diff --git a/chatbot/chatbot.data.js b/chatbot/chatbot.data.js new file mode 100644 index 00000000..e69de29b diff --git a/chatbot/chatbot.html b/chatbot/chatbot.html new file mode 100644 index 00000000..e69de29b diff --git a/chatbot/chatbot.js b/chatbot/chatbot.js new file mode 100644 index 00000000..e69de29b From e043c87478ffda899d483effef56ecb3bc13b723 Mon Sep 17 00:00:00 2001 From: mohdmaazgani <232573@kit.ac.in> Date: Fri, 23 Jan 2026 16:59:08 +0530 Subject: [PATCH 2/8] feat: add chatbot UI with floating widget --- chatbot/chatbot.css | 21 +++++++++++++++++++++ chatbot/chatbot.html | 21 +++++++++++++++++++++ chatbot/chatbot.js | 19 +++++++++++++++++++ 3 files changed, 61 insertions(+) diff --git a/chatbot/chatbot.css b/chatbot/chatbot.css index e69de29b..3b43569c 100644 --- a/chatbot/chatbot.css +++ b/chatbot/chatbot.css @@ -0,0 +1,21 @@ +
+ + + +
diff --git a/chatbot/chatbot.html b/chatbot/chatbot.html index e69de29b..3b43569c 100644 --- a/chatbot/chatbot.html +++ b/chatbot/chatbot.html @@ -0,0 +1,21 @@ +
+ + + +
diff --git a/chatbot/chatbot.js b/chatbot/chatbot.js index e69de29b..0ccf1c24 100644 --- a/chatbot/chatbot.js +++ b/chatbot/chatbot.js @@ -0,0 +1,19 @@ +import "./chatbot.css"; + +fetch("./chatbot/chatbot.html") + .then((res) => res.text()) + .then((html) => { + document.body.insertAdjacentHTML("beforeend", html); + + const toggleBtn = document.getElementById("chatbot-toggle"); + const closeBtn = document.getElementById("chatbot-close"); + const windowEl = document.getElementById("chatbot-window"); + + toggleBtn.addEventListener("click", () => { + windowEl.classList.toggle("hidden"); + }); + + closeBtn.addEventListener("click", () => { + windowEl.classList.add("hidden"); + }); + }); From d0294ed993eb9e2dbb1abdeb0770c404df3b22a2 Mon Sep 17 00:00:00 2001 From: mohdmaazgani <232573@kit.ac.in> Date: Fri, 23 Jan 2026 17:04:27 +0530 Subject: [PATCH 3/8] feat: add rule-based chatbot logic for expenses and navigation --- chatbot/chatbot.js | 59 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/chatbot/chatbot.js b/chatbot/chatbot.js index 0ccf1c24..d0177d91 100644 --- a/chatbot/chatbot.js +++ b/chatbot/chatbot.js @@ -1,4 +1,6 @@ import "./chatbot.css"; +import { chatbotKnowledge } from "./chatbot.data.js"; +import { CHATBOT_CONFIG } from "./chatbot.config.js"; fetch("./chatbot/chatbot.html") .then((res) => res.text()) @@ -8,12 +10,57 @@ fetch("./chatbot/chatbot.html") const toggleBtn = document.getElementById("chatbot-toggle"); const closeBtn = document.getElementById("chatbot-close"); const windowEl = document.getElementById("chatbot-window"); + const messagesEl = document.getElementById("chatbot-messages"); + const inputEl = document.getElementById("chatbot-input"); + const sendBtn = document.getElementById("chatbot-send"); - toggleBtn.addEventListener("click", () => { - windowEl.classList.toggle("hidden"); - }); + toggleBtn.onclick = () => windowEl.classList.toggle("hidden"); + closeBtn.onclick = () => windowEl.classList.add("hidden"); - closeBtn.addEventListener("click", () => { - windowEl.classList.add("hidden"); - }); + const addMessage = (text, type = "bot") => { + const msg = document.createElement("div"); + msg.textContent = text; + msg.style.marginBottom = "8px"; + msg.style.textAlign = type === "user" ? "right" : "left"; + messagesEl.appendChild(msg); + messagesEl.scrollTop = messagesEl.scrollHeight; + }; + + if (CHATBOT_CONFIG.welcomeMessage) { + addMessage( + chatbotKnowledge.greetings[ + Math.floor(Math.random() * chatbotKnowledge.greetings.length) + ], + ); + } + + const getResponse = (message) => { + const msg = message.toLowerCase(); + + if (msg.includes("tip")) + return chatbotKnowledge.tips[ + Math.floor(Math.random() * chatbotKnowledge.tips.length) + ]; + if (msg.includes("budget")) return chatbotKnowledge.budget.setup; + if (msg.includes("analytics")) return chatbotKnowledge.budget.analytics; + if (msg.includes("export")) return chatbotKnowledge.navigation.export; + if (msg.includes("notification")) + return chatbotKnowledge.navigation.notifications; + if (msg.includes("dashboard")) + return chatbotKnowledge.navigation.dashboard; + + return "I can help with tips, budgets, analytics, exports, and navigation šŸ™‚"; + }; + + sendBtn.onclick = () => { + const text = inputEl.value.trim(); + if (!text) return; + + addMessage(text, "user"); + inputEl.value = ""; + + setTimeout(() => { + addMessage(getResponse(text)); + }, 400); + }; }); From cacb8fdc6e41ecc611d0984e63f17a1a223ffa99 Mon Sep 17 00:00:00 2001 From: mohdmaazgani <232573@kit.ac.in> Date: Fri, 23 Jan 2026 17:06:48 +0530 Subject: [PATCH 4/8] feat: integrate chatbot module into main UI --- index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.html b/index.html index 1558f80e..a87256e8 100644 --- a/index.html +++ b/index.html @@ -658,6 +658,8 @@

Install ExpenseFlow

+ + From dcec3341cb1fbe6113271dfdf9befb2d2150a93b Mon Sep 17 00:00:00 2001 From: mohdmaazgani <232573@kit.ac.in> Date: Fri, 23 Jan 2026 17:07:42 +0530 Subject: [PATCH 5/8] docs: add chatbot module documentation --- chatbot/README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/chatbot/README.md b/chatbot/README.md index e69de29b..ddd2aca7 100644 --- a/chatbot/README.md +++ b/chatbot/README.md @@ -0,0 +1,22 @@ +# šŸ¤– ExpenseFlow Chatbot + +A modular, rule-based chatbot to help users with: + +- Expense tracking tips +- Budget explanations +- Analytics guidance +- App navigation + +## Features + +- Frontend-only +- No backend dependency +- Easily extendable to AI later + +## Enable Chatbot + +Include this script in your HTML: + +```html + +``` From 627667fe0b56711e22ceb5ed6861cfac994739e4 Mon Sep 17 00:00:00 2001 From: mohdmaazgani <232573@kit.ac.in> Date: Fri, 23 Jan 2026 17:29:54 +0530 Subject: [PATCH 6/8] fix: prevent chatbot auto-open and ensure close button works --- chatbot/chatbot.html | 2 +- chatbot/chatbot.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/chatbot/chatbot.html b/chatbot/chatbot.html index 3b43569c..f921bb1a 100644 --- a/chatbot/chatbot.html +++ b/chatbot/chatbot.html @@ -1,7 +1,7 @@
- +
+