Skip to content

Vishalpawar13git/Ai-Chat-Application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 AI Document Q&A System

(Spring Boot 2.7.14 • Java 8 • MySQL • HTML UI)

An AI-powered web application that allows users to upload PDF, Audio, or Video files and interact with them using natural language questions.

The system extracts text from documents, converts speech to text for audio/video files, generates summaries, and answers questions using an AI model.


🚀 Features

✅ Upload PDF, Audio, Video files ✅ Automatic text extraction ✅ Speech-to-Text using Vosk (offline) ✅ AI Question Answering ✅ Document Summarization ✅ Timestamp extraction for media ✅ Media streaming support ✅ JWT Authentication ✅ Chat history saved in database


🏗 Tech Stack

Backend

  • Java 8
  • Spring Boot 2.7.14
  • Spring Security + JWT
  • Hibernate / JPA
  • MySQL

Frontend

  • HTML
  • CSS
  • JavaScript

AI / Processing

  • Groq / OpenAI API
  • Vosk Speech Recognition
  • JAVE Audio Converter

⚡ Quick Start

1️⃣ Create MySQL Database

CREATE DATABASE Ai_chat;

2️⃣ Configure application.yml

Edit:

src/main/resources/application.yml

Update:

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/Ai_chat
    username: root
    password: YOUR_PASSWORD

openai:
  api:
    key: sk-YOUR_API_KEY

3️⃣ Run Application

From STS / IntelliJ

Run:

AiChatApplication.java → Run as Spring Boot App

OR terminal

mvn spring-boot:run

🌐 Open Application

http://localhost:8080

📡 API Endpoints

Authentication (No token)

Method Endpoint Body
POST /api/auth/register { "username":"","email":"","password":"" }
POST /api/auth/login { "username":"","password":"" }

Documents (Bearer Token Required)

Method Endpoint Description
POST /api/documents/upload Upload file
GET /api/documents List documents
GET /api/documents/{id} Get document
GET /api/documents/{id}/summary Get summary
GET /api/documents/{id}/timestamps Get timestamps
GET /api/documents/{id}/stream Stream media
DELETE /api/documents/{id} Delete document

Chat

Method Endpoint Body
POST /api/chat/ask { "documentId":1, "question":"What is this about?" }
GET /api/chat/history/{documentId} Chat history

📘 Swagger UI

Open:

http://localhost:8080/swagger-ui.html

🧪 Run Tests

mvn clean test
mvn jacoco:report

Coverage:

target/site/jacoco/index.html

🐳 Docker (Optional)

docker-compose up --build

📂 Project Structure

src/main/java/com/aichat
 ├── controller
 ├── service
 ├── repository
 ├── entity
 ├── security

src/main/resources
 ├── static (HTML frontend)
 ├── application.yml

🧠 How It Works

  1. User uploads file
  2. Backend detects file type
  3. PDF → text extracted
  4. Audio/Video → converted → speech-to-text
  5. Transcript saved in MySQL
  6. User asks question
  7. Transcript + question sent to AI
  8. AI response returned

📸 Application Screenshots

🔹 Swagger API

Swagger Swagger Swagger

🔹 Docker Running

Docker


👨‍💻 Author

Vishal Pawar Java Full-Stack Developer


⭐ Notes

  • MySQL must be running
  • Vosk model must be placed in project root
  • Requires valid AI API key

📜 License

For educational / assessment submission.

About

Spring Boot AI Chat Application with Docker support and REST API backend

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors