Skip to content

DevangM03/ai-chat-summarizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI-Powered Real-Time Chat & Conversation Analytics Pipeline

An enterprise-grade, secure multi-room chat application featuring an automated, schema-enforced conversation intelligence pipeline. The architecture leverages a high-speed inference engine to extract real-time behavioral insights, sentiment tracking, and conceptual themes from conversational state logs, archiving the results into a downstream cloud data sink.


🏗️ System Architecture Overview

[React Client App] <--- (Sub-second Real-time Sync) ---> [Cloud Firestore Database]
        |                                                           ^
        | (Secure Transcript Payloads)                              | (Validated Telemetry)
        v                                                           |
[Groq Inference Engine] ---- (Schema-Enforced Structured JSON) -----+
   [Llama 3.3 70B]

The system decouples real-time message transportation from deep text-mining assessment. When a chat summary is requested, client-side application memory transforms localized message states into a sequential conversational chunk, executing an atomic inference request against a decoupled inference layer. The structural payload is then simultaneously pushed to a presentation state layer and a database logging sink.

⚡ Key Engineering Features

1. High-Speed Inference Pipeline & Structured JSON Coercion

  • Decoupled API Layer: Re-architected the core LLM integration to pull directly from Groq's high-performance inference engine, optimizing computation latency down to sub-second runtimes.
  • Strict Schema Enforcement: Coerced raw text logs into highly deterministic data payloads via response_format: { type: "json_object" } controls. The system reliably guarantees compliance against a complex multi-nested analytics schema containing:
  • Conversation overview summaries
  • Theme/topic extractions (array format)
  • Sentiment tracking maps (polarity indexes ranging from -1.0 to 1.0)
  • Dynamic participant interaction maps (e.g., Driver, Passive Listener, Inquirer)

2. State Optimization & Defensive Cost-Control Mechanics

  • Query Truncation: Implemented optimized NoSQL query constraints with strict cursor bounds (orderBy("timestamp", "desc") coupled with limit(50)).
  • Scalability Protection: This guardrail caps unbounded document reads. Even if a chat room scales to $10,000+$ messages, client initialization cost models remain strictly flat, minimizing read-latency overhead and preventing database budget spikes.
  • Inverted Presentation Logic: Queries ingest data in descending chronological blocks to protect cache limits, which are then inverted smoothly within client-side local memory to preserve typical user conversational flow.

3. State Persistence & Network Perimeter Security

  • Granular Room Isolation: Implemented distinct, passcode-protected chat environments. Room keys are isolated away from compilation layers, evaluating access rules natively via system environment configurations.
  • Session Lifecycle Listeners: Managed connection persistence via Firebase Auth event loops (onAuthStateChanged), establishing token-validated state environments that persist across unexpected browser refreshes.

🛠️ Tech Stack & Ecosystem

Layer Technology Operational Purpose
Frontend Framework React.js (v18+) Declarative UI state and context rendering loops
UI Components Chakra UI Theme-driven, highly accessible modular design token layout
Database Gateway Cloud Firestore Distributed NoSQL multi-tenant real-time stream caching
Authentication Firebase Auth Identity management and state persistence layers
Inference Compute Groq Cloud API Sub-second Llama 3 completion execution endpoint

💾 Database Schema Design

The Firestore instance operates on a nested hierarchical data tree, ensuring clean document segmentation and performant indexing rules:

rooms/ (Collection)
  └── {roomId}/ (Document - Virtual Placeholder)
        ├── messages/ (Sub-collection)
        │     └── {messageId}/ (Document)
        │           ├── text: "String"
        │           ├── uid: "String"
        │           ├── email: "String"
        │           ├── nickname: "String"
        │           └── timestamp: ServerTimestamp
        └── analytics/ (Sub-collection)
              └── {analyticsId}/ (Document)
                    ├── overview: "String"
                    ├── topics: [ "Array", "of", "Strings" ]
                    ├── sentiment: { label: "String", score: Float }
                    └── dynamics: [ { nickname: "String", interactionStyle: "String" } ]

🚀 Local Deployment Setup

Prerequisites

  • Node.js v16 or higher
  • npm or yarn package manager
  • Active Firebase project instance
  • Active Groq Cloud developer key

Installation Steps

  1. Clone the repository:
git clone https://github.com/YourUsername/ai-chat-summarizer.git
cd ai-chat-summarizer
  1. Install dependencies:
npm install
  1. Initialize Environment Variables: Duplicate the exposed configuration template into a local workspace configuration:
cp .env.example .env

Open the newly created .env file and supply your valid infrastructure targets:

REACT_APP_SECRET_KEY=your_admin_registration_pass
REACT_APP_CHAT_PASSCODE_1=room_1_key
REACT_APP_CHAT_PASSCODE_2=room_2_key
REACT_APP_CHAT_PASSCODE_3=room_3_key
REACT_APP_GROQ_API_KEY=gsk_your_private_inbound_inference_token
REACT_APP_FIREBASE_API_KEY=AIzaSy_your_public_app_key
  1. Boot the Local Development Server:
npm start

The application will mount seamlessly at http://localhost:3000.

🔒 Security & Environment Architecture

  • Credentials Abstraction: Every cloud connector token is fully isolated out of the version control ecosystem using robust .gitignore manifests.
  • Database Rulesets: Guarded by robust firestore.rules structures (see root manifest) preventing anonymous client modification loops and enforcing room-level authentication boundaries.

About

Secure, real-time multi-room chat platform featuring high-speed structured conversation summarization and behavioral analytics powered by Groq (Llama 3) and Cloud Firestore.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages