Skip to content

UbaidullahWaheed/CodeAlpha_FAQ_Chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– AI Assistant Pro

A feature-rich, multilingual AI chatbot desktop application built with JavaFX and powered by the Groq API. Designed for students, educators, and professionals who need a fast, intelligent assistant with a polished native UI.


πŸ“Έ Overview

AI Assistant Pro is a fully-featured desktop chatbot that combines a local FAQ engine (TF-IDF based) with live Groq LLM responses β€” giving you instant answers for known topics and deep AI reasoning for everything else. It ships with 10 distinct features including voice input/output, multi-language support, session persistence, message pinning, and much more.


✨ Features

# Feature Description
1 πŸŽ™ Voice Input Speak your questions β€” mic input transcribed in real time
2 πŸ”Š Text-to-Speech AI responses read aloud with per-message speak/stop controls
3 πŸ” Chat Search Full-text search across all sessions with highlighted snippets
4 πŸ“Œ Pin Messages Pin any message from any chat; view all pins in one panel
5 πŸ’Ύ Session Persistence All chat sessions saved to disk and restored on next launch
6 πŸ”” Notification Sound Synthesised ping tone when AI finishes responding (no audio file needed)
7 πŸ“Š Word Count & Reading Time Every message shows word count and estimated reading time
8 πŸ“€ Export Chats Save conversations as .txt or styled .html files
9 🌐 Multi-Language UI Full UI in English, Arabic (RTL), Urdu (RTL), and French
10 ⌨️ Keyboard Shortcuts 20+ shortcuts for power users with a dedicated shortcut reference panel

Additional Highlights

  • Dual AI Engine β€” Local FAQ matching (TF-IDF + cosine similarity) for university queries; Groq LLM for open-ended questions
  • Multiple AI Models β€” Switch between llama-3.3-70b-versatile, llama-3.1-8b-instant, mixtral-8x7b-32768, and gemma2-9b-it
  • AI Personas β€” 10 built-in roles: General Assistant, Coding Expert, Science Teacher, Math Tutor, Creative Writer, Language Translator, Doctor Advisor, Legal Advisor, Career Coach, Fitness Trainer
  • Dark / Light Theme β€” Toggle themes live from Settings
  • Markdown Rendering β€” Bot responses rendered with full Markdown support (code blocks, tables, bold, italic, lists)
  • Animated Chat Bubbles β€” Smooth fade-in and slide-up animations on every message
  • File Upload β€” Attach .txt, .md, .java, .py, .json, or .csv files as context
  • Regenerate Response β€” Re-ask the last prompt with one click or Ctrl+R
  • Adjustable Font Size β€” Slider from 11 px to 20 px
  • Splash Screen β€” Branded loading screen on launch

πŸ—οΈ Project Structure

src/
└── main/
    └── java/
        └── com/faqchatbot/
            β”œβ”€β”€ Main.java                    # JavaFX entry point & window bootstrap
            β”œβ”€β”€ ChatController.java          # Central UI controller (input, send, history)
            β”œβ”€β”€ ChatBubble.java              # Message bubble component (pin, copy, TTS, stats)
            β”œβ”€β”€ ChatSession.java             # Session data model (messages, metadata, JSON I/O)
            β”œβ”€β”€ ChatSearchPanel.java         # Feature 3 β€” cross-session search modal
            β”œβ”€β”€ FAQData.java                 # Hardcoded FAQ dataset (university Q&A)
            β”œβ”€β”€ FAQEngine.java               # TF-IDF + cosine similarity search engine
            β”œβ”€β”€ GroqClient.java              # Groq REST API client (multi-model, multi-persona)
            β”œβ”€β”€ SessionManager.java          # Disk-based session load / save / delete
            β”œβ”€β”€ Sidebar.java                 # Session list sidebar with delete support
            β”œβ”€β”€ SettingsPanel.java           # Settings modal (API key, model, persona, theme…)
            β”œβ”€β”€ PinManager.java              # Feature 4 β€” in-memory pin store with listeners
            β”œβ”€β”€ PinnedPanel.java             # Feature 4 β€” pinned messages modal
            β”œβ”€β”€ FileHandler.java             # TXT/HTML export + file upload reader
            β”œβ”€β”€ MarkdownRenderer.java        # Flexmark-based Markdown β†’ HTML renderer
            β”œβ”€β”€ NotificationSoundManager.java# Feature 6 β€” PCM sine-wave ping generator
            β”œβ”€β”€ I18nManager.java             # Feature 9 β€” i18n string table (en/ar/ur/fr)
            β”œβ”€β”€ KeyboardShortcutsPanel.java  # Feature 10 β€” shortcuts reference modal
            β”œβ”€β”€ SpeechManager.java           # TTS engine wrapper
            └── VoiceInputManager.java       # Feature 1 β€” microphone input manager
resources/
    β”œβ”€β”€ style.css                            # Full dark/light theme stylesheet
    └── assets/
        └── icon.png                         # App icon

πŸ› οΈ Tech Stack

Layer Technology
Language Java 17+
UI Framework JavaFX 21
AI API Groq Cloud
HTTP Client Java java.net.http.HttpClient
JSON Google Gson + org.json
Markdown Flexmark-Java
Audio javax.sound.sampled (PCM synthesis, no external files)
Persistence JSON files in ~/AIAssistantPro/sessions/
Build Tool Maven (recommended)

πŸš€ Getting Started

Prerequisites

Clone & Build

git clone https://github.com/YOUR_USERNAME/ai-assistant-pro.git
cd ai-assistant-pro
mvn clean package

Run

mvn javafx:run

Or run the packaged JAR:

java -jar target/ai-assistant-pro-1.0.jar

Set Your API Key

  1. Launch the app
  2. Click βš™οΈ Settings in the header (or press Ctrl+,)
  3. Paste your Groq API key in the API Configuration field
  4. Click βœ“ Save & Close

Your key is stored in the settings panel for the current session. To persist it across launches, add it to GroqClient.java:

private static String API_KEY = "gsk_your_key_here";

⌨️ Keyboard Shortcuts

Shortcut Action
Enter Send message
Shift + Enter New line in input
Ctrl + R Regenerate last response
Ctrl + L Clear chat
Ctrl + N New chat session
Ctrl + F Search all chats
Ctrl + P Open pinned messages
Ctrl + , Open settings
Ctrl + ? Show keyboard shortcuts
Ctrl + E Export chat
Ctrl + M Start / stop mic recording
Ctrl + S Toggle notification sound
Ctrl + 1–4 Switch language (EN / AR / UR / FR)
Escape Close any open dialog

🌐 Multi-Language Support

The UI is fully translated into four languages. Switch instantly from Settings β†’ Language or via Ctrl+1 through Ctrl+4.

Code Language Direction
en English LTR
ar Ψ§Ω„ΨΉΨ±Ψ¨ΩŠΨ© (Arabic) RTL
ur اردو (Urdu) RTL
fr FranΓ§ais (French) LTR

RTL layouts are automatically applied to input fields, result lists, and message snippets.


🧠 FAQ Engine

The built-in FAQ engine answers common university-related questions without an internet connection, including topics like:

  • Admission requirements & deadlines
  • Tuition fees & scholarships
  • Exam schedules & attendance rules
  • Hostel, library, transport, and campus facilities
  • Transcripts, GPA calculation, and results

It uses a TF-IDF vectoriser with cosine similarity scoring. If the best match scores below the confidence threshold (0.1), the query is automatically escalated to the Groq LLM.

To add your own FAQs, edit FAQData.java:

faqs.put("Your question here?", "Your answer here.");

πŸ“€ Export Formats

Format What you get
TXT Plain-text transcript with timestamps and a decorative header
HTML Styled dark-theme page with coloured user/bot bubbles, ready to open in any browser

πŸ”§ Configuration Reference

All runtime settings are accessible via the Settings panel (Ctrl+,):

Setting Options
API Key Groq key (gsk_…)
AI Model llama-3.3-70b Β· llama-3.1-8b Β· mixtral-8x7b Β· gemma2-9b
AI Persona 10 built-in roles
Theme πŸŒ™ Dark / β˜€οΈ Light
Text-to-Speech On / Off
Notification Sound On / Off + live test
Font Size 11 px – 20 px slider
Language EN / AR / UR / FR

πŸ“‹ Maven Dependencies (pom.xml snippet)

<dependencies>
    <!-- JavaFX -->
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>21</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-web</artifactId>
        <version>21</version>
    </dependency>

    <!-- Groq / JSON -->
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.10.1</version>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20231013</version>
    </dependency>

    <!-- Markdown -->
    <dependency>
        <groupId>com.vladsch.flexmark</groupId>
        <artifactId>flexmark-all</artifactId>
        <version>0.64.8</version>
    </dependency>
</dependencies>

🀝 Contributing

Contributions are welcome! Here's how:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature-name
  3. Commit your changes: git commit -m "Add: your feature description"
  4. Push to the branch: git push origin feature/your-feature-name
  5. Open a Pull Request

Please keep code style consistent with existing files (JavaFX conventions, descriptive comments, feature-tagged sections).


πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


πŸ‘€ Author

UBAIDULLAH WAHEED πŸ“§ ubaidullahwaheed685@gmail.com
πŸ”— GitHub Β· LinkedIn


πŸ™ Acknowledgements

  • Groq β€” blazing-fast LLM inference API
  • Flexmark-Java β€” Markdown parsing & rendering
  • JavaFX β€” modern Java UI toolkit
  • University FAQ dataset compiled for academic use

⭐ If you find this project useful, please give it a star!

Made with β˜• and Java

About

πŸ€– AI Assistant Pro β€” A feature-rich JavaFX desktop chatbot powered by Groq LLM. Includes a local TF-IDF FAQ engine, voice I/O, multilingual UI (EN/AR/UR/FR), session history, message pinning, chat search, and export to TXT/HTML.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors