Skip to content

This Project is an AI-driven web application that allows users to upload PDF Documents and automatically extract structured test cases from them. The extacted test cases can then be viewed, copied or integrated into testing workflows.

Notifications You must be signed in to change notification settings

Himaanshu-Singh/ChatPDF---AI-powered-Test-case-Extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– AI QA Chatbot

A React-based AI-powered QA chatbot that generates structured test cases from PDF documents using AI21’s Jamba model.

This application enables you to upload PDFs, extract text content, and generate test cases interactively via a modern chat interface.


✨ Features

  • πŸ“‚ PDF Upload & Text Extraction – Upload PDF files and extract readable text
  • πŸ€– AI-Powered Test Case Generation – Generate detailed test cases using AI21’s Jamba Large model
  • ⚑ Real-time Streaming – Character-by-character streaming for a natural conversation feel
  • πŸŒ“ Dark/Light Theme – Switch between dark and light modes for better UX
  • πŸ’Ύ Chat History – Persistent conversation storage with SQLite
  • πŸ“± Responsive Design – Works smoothly across desktop and mobile devices
  • πŸ“‹ One-click Copy – Copy generated test cases to clipboard easily

image

πŸ› οΈ Technology Stack

Frontend

  • React 18 (with Hooks)
  • ReactMarkdown + remark-gfm (render markdown responses)
  • CSS-in-JS (dynamic theming with light/dark support)

Backend

  • Flask (Python web framework)
  • AI21 SDK (Jamba model integration)
  • SQLAlchemy (SQLite ORM)
  • PyMuPDF & pdfplumber (PDF text extraction)
  • Flask-CORS (CORS support)

πŸ“¦ Prerequisites


πŸš€ Installation

1. Clone the Repository

git clone https://github.com/your-username/ai-qa-chatbot.git
cd ai-qa-chatbot

2. Frontend Setup

cd frontend
npm install
npm install react-markdown remark-gfm

3. Backend Setup

cd backend

# Create & activate virtual environment
python -m venv venv

# Windows
venv\Scripts\activate

# macOS/Linux
source venv/bin/activate

# Install dependencies
pip install flask flask-cors sqlalchemy pymupdf pdfplumber ai21 werkzeug

βš™οΈ Configuration

AI21 API Key

In backend/app.py, replace with your API key:

AI21_API_KEY = "your-ai21-api-key-here"

Frontend API Base URL

In frontend/src/App.js (or config file):

const API_BASE = 'http://localhost:5000';

▢️ Usage

Start Backend Server

cd backend
python app.py

Server runs at: http://localhost:5000

Start Frontend

cd frontend
npm start

Frontend runs at: http://localhost:3000


πŸ’¬ Using the Application

  1. Upload PDF – Select a PDF file
  2. Review Extracted Text – Verify extracted content
  3. Generate Test Cases – Ask chatbot to generate test cases
  4. Copy Results – Use "Copy Test Cases" button
  5. Switch Theme – Toggle between light/dark mode

πŸ”— API Endpoints

Method Endpoint Description
POST /upload_pdf Upload & extract text from PDF files
POST /chat_stream Generate streaming AI responses
GET /history Retrieve chat history

πŸ“‚ Project Structure

ai-qa-chatbot/
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.js         # Main React component
β”‚   β”‚   └── index.js       # Entry point
β”‚   β”œβ”€β”€ public/
β”‚   └── package.json
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app.py             # Flask backend
β”‚   β”œβ”€β”€ uploads/           # PDF upload directory
β”‚   └── chat_history.db    # SQLite database
└── README.md

πŸ” Features in Detail

PDF Processing

  • Multiple extraction methods (PyMuPDF, pdfplumber)
  • Handles various PDF layouts and formats
  • Validates minimum text length

AI Integration

  • Uses AI21 Jamba-large model
  • Context truncation for large docs
  • Structured prompting for consistent test case format

UX Enhancements

  • Typing animation (adjustable speed)
  • Responsive breakpoints (default: 980px)
  • Persistent theme preference

Backend Configurations

  • MAX_CONTEXT_CHARS = 8000 (default)
  • MIN_TEXT_LEN = 200 (default)
  • PRIMARY_MODEL = "jamba-large"

⚠️ Error Handling

  • PDF Upload – Max size 64MB, validates text extraction quality
  • AI Responses – Graceful handling of API errors
  • Network – Timeout handling & retries
  • File Processing – Fallback extraction methods

🀝 Contributing

  1. Fork this repo

  2. Create a new branch:

    git checkout -b feature/your-feature
  3. Commit changes:

    git commit -am "Add new feature"
  4. Push branch:

    git push origin feature/your-feature
  5. Open a Pull Request


πŸ™ Acknowledgments

About

This Project is an AI-driven web application that allows users to upload PDF Documents and automatically extract structured test cases from them. The extacted test cases can then be viewed, copied or integrated into testing workflows.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published