From d1c8800ede5baa57149b26c7af399554e8c6b52d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 21:23:50 +0000 Subject: [PATCH 1/3] Initial plan From 39f6d9efee745554a9b311651966e5e431598b98 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 21:26:44 +0000 Subject: [PATCH 2/3] Update README: improve description, add prerequisites, project structure, CI/CD details, and dialog format docs Co-authored-by: joshuvavinith <146979257+joshuvavinith@users.noreply.github.com> --- README.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d487a17..8767916 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,25 @@ # 🤖 AI ChatBot ![CI](https://github.com/joshuvavinith/AI_ChatBot/actions/workflows/ci.yml/badge.svg) -![Python](https://img.shields.io/badge/python-3.12-blue) +![Python](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue) ![License](https://img.shields.io/badge/license-MIT-green) -A modern, extensible Python chatbot with two backends: +A modern, extensible Python chatbot that generates context-aware, dynamic +responses. It ships with two interchangeable backends and three ready-to-use +interfaces — no external services are required to get started. | Mode | When active | What it uses | |------|-------------|--------------| | **LLM** | `OPENAI_API_KEY` is set | OpenAI Chat Completions (GPT-3.5 / GPT-4o) | | **Pattern Matching** | No API key present | Offline CSV dialog dataset | -Three interfaces are available: a **Tkinter desktop GUI**, a **Streamlit web app**, and a **FastAPI REST backend**. +Three interfaces are included out of the box: + +| Interface | Entry point | Default URL | +|-----------|-------------|-------------| +| **Streamlit web app** | `streamlit run web_demo.py` | `http://localhost:8501` | +| **FastAPI REST API** | `uvicorn api:app --reload` | `http://localhost:8000/docs` | +| **Tkinter desktop GUI** | `python ai_chatbot.py` | *(native window)* | --- @@ -20,6 +28,7 @@ Three interfaces are available: a **Tkinter desktop GUI**, a **Streamlit web app - [Key Features](#-key-features) - [Quick Start](#-quick-start) +- [Prerequisites](#prerequisites) - [Installation](#-installation) - [Configuration](#-configuration) - [Running the Chatbot](#-running-the-chatbot) @@ -30,6 +39,7 @@ Three interfaces are available: a **Tkinter desktop GUI**, a **Streamlit web app - [API Reference](#-api-reference) - [Testing](#-testing) - [CI/CD](#-cicd) +- [Project Structure](#-project-structure) - [Architecture](#-architecture) - [Contributing](#-contributing) @@ -65,6 +75,15 @@ streamlit run web_demo.py --- +## Prerequisites + +- **Python 3.10 or later** (tested on 3.10, 3.11, and 3.12) +- **pip** (included with Python) +- *(Optional)* An [OpenAI API key](https://platform.openai.com/account/api-keys) to enable LLM mode +- *(Optional)* [Docker](https://docs.docker.com/get-docker/) for containerised deployment + +--- + ## 🔧 Installation ### 1. Clone & set up environment @@ -221,11 +240,32 @@ The test suite covers: ## 🔄 CI/CD -GitHub Actions runs on every push and pull request to `main`: +GitHub Actions runs on every push and pull request to `main` / `master`: -1. **Lint** — `flake8` for syntax errors and undefined names -2. **Test** — `pytest` full suite -3. **Docker build** — both `web` and `api` images +1. **Lint** — `flake8` checks for syntax errors and undefined names +2. **Test** — `pytest` full suite with coverage, across Python 3.10, 3.11, and 3.12 +3. **Docker build** — both `web` and `api` images are built to verify the Dockerfile + +Coverage reports are uploaded as build artifacts for each Python version. + +--- + +## 📂 Project Structure + +``` +AI_ChatBot/ +├── ai_chatbot.py # Core module: SimpleBot, LLMBot, ChatBot facade, Tkinter GUI +├── api.py # FastAPI REST backend +├── web_demo.py # Streamlit web interface +├── dialog.csv # Default offline dialog dataset +├── test_chatbot.py # Pytest test suite (SimpleBot, ChatBot, FastAPI) +├── requirements.txt # Python dependencies +├── Dockerfile # Multi-mode Docker image (web / api) +├── LICENSE # MIT License +└── .github/ + └── workflows/ + └── ci.yml # CI pipeline: lint → test → Docker build +``` --- @@ -264,6 +304,20 @@ GitHub Actions runs on every push and pull request to `main`: Please follow PEP 8 and include tests for any new logic. +### Adding dialog patterns + +To extend the offline pattern-matching bot, add rows to `dialog.csv`. +Each question/answer pair uses two rows sharing the same `dialog_id`: + +```csv +dialog_id,line_id,text +8,1,What is Python? +8,2,Python is a popular programming language! +``` + +- `line_id` **1** = the user question (matched case-insensitively) +- `line_id` **2** = the bot response + --- ## 📄 License From 97a0c0362cc856eb8f00b3d28c10476abaaca05c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 21:27:15 +0000 Subject: [PATCH 3/3] Simplify CI/CD branch reference to just main Co-authored-by: joshuvavinith <146979257+joshuvavinith@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8767916..75652c4 100644 --- a/README.md +++ b/README.md @@ -240,7 +240,7 @@ The test suite covers: ## 🔄 CI/CD -GitHub Actions runs on every push and pull request to `main` / `master`: +GitHub Actions runs on every push and pull request to `main`: 1. **Lint** — `flake8` checks for syntax errors and undefined names 2. **Test** — `pytest` full suite with coverage, across Python 3.10, 3.11, and 3.12