# chandanswain9/personalized-ai architecture

> Architecture diagram of the GitHub repository chandanswain9/personalized-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chandanswain9/personalized-ai
- Repository: https://github.com/chandanswain9/personalized-ai

## Overview

##### Project type and purpose
- This is a hybrid full-stack “desktop” web-view application (using Python + Eel to host an HTML/JS frontend) that functions as a voice-activated AI assistant.
- Purpose: capture microphone input, run speech recognition → parse commands → invoke backend features (e.g., open apps, search YouTube, send WhatsApp) → return responses via text + animation + speech synthesis.

##### File structure
- Top level:
- run.py / main.py / test.py – entrypoints and smoke tests
- contacts.csv – simple datastore for WhatsApp contacts
- engine/ – Python backend modules
- engine/auth/ – face-recognition (haar cascade, trainer, sample code) for optional user authentication
- engine/command.py – central command dispatcher
- engine/features.py – implementations for each assistant feature (open apps, search, messaging)
- engine/db.py – lightweight data access (contacts)
- engine/config.py – configuration parameters (API keys, hotword settings)
- engine/helper.py – shared utilities
- www/ – frontend served by Eel
- index.html + style.css – UI skeleton and styles
- main.js / controller.js / script.js – frontend logic, event handlers, Eel bindings
- www/assets/ – CSS/JS libraries (Textillate, Animate.css) and media (audio wave animation)

##### README for additional insights
- Tech stack highlights:
- Frontend: HTML/CSS/JS + jQuery + Textillate.js + Animate.css
- Backend: Python3 + pyttsx3 (TTS) + speech_recognition + eel + gevent + whisper (optional)
- Key features: hotword detection, animated chat UI, voice I/O, app integration

##### Elements
– Blue rectangles for internal modules

## Diagram (Mermaid)

```mermaid
flowchart TD
    MIC["Microphone (User)"]:::external
    SPKR["Speaker (User)"]:::external

    subgraph Frontend
        UI_HTML["index.html"]:::frontend
        UI_CSS["style.css"]:::frontend
        UI_MAIN["main.js"]:::frontend
        UI_CTRL["controller.js"]:::frontend
        UI_SCRIPT["script.js"]:::frontend
        UI_ASSETS["assets/"]:::frontend
    end

    subgraph "Eel Bridge"
        RUN["run.py"]:::internal
        MAIN["main.py"]:::internal
    end

    subgraph Backend
        SR["Speech Recognition Service"]:::internal
        TTS["Text-to-Speech Service"]:::internal
        CMD["Command Dispatcher"]:::internal
        FEAT["Feature Modules"]:::internal
        AUTH["Authentication Module"]:::internal
        DB["Data Store"]:::data
        CFG["Configuration"]:::internal
        UTIL["Shared Utilities"]:::internal
        ENTRY["Entry Points / Smoke Tests"]:::internal
    end

    subgraph External
        YT["YouTube API"]:::cloud
        WA["WhatsApp API"]:::cloud
        OS["OS Shell"]:::cloud
    end

    MIC -->|"audio stream"| SR
    SR -->|"transcribed text"| RUN
    RUN --> MAIN
    MAIN -->|"invoke command"| CMD
    CMD -->|"route to feature"| FEAT
    CMD -.->|"optional face auth"| AUTH
    CMD -->|"fetch contacts"| DB
    CMD -->|"read config"| CFG
    CMD -->|"use utilities"| UTIL
    FEAT --> YT
    FEAT --> WA
    FEAT --> OS
    CMD -->|"response text"| RUN
    RUN --> UI_HTML
    CMD --> TTS
    TTS -->|"synthesized speech"| SPKR

    classDef frontend fill:#D0E6A5,stroke:#333,stroke-width:1px
    classDef internal fill:#A0C4FF,stroke:#333,stroke-width:1px
    classDef data fill:#BDB2FF,stroke:#333,stroke-width:1px
    classDef cloud fill:#FFADAD,stroke:#333,stroke-width:1px
    classDef external fill:#FFD6A5,stroke:#333,stroke-width:1px

    click UI_HTML "https://github.com/chandanswain9/personalized-ai/blob/main/www/index.html"
    click UI_CSS "https://github.com/chandanswain9/personalized-ai/blob/main/www/style.css"
    click UI_MAIN "https://github.com/chandanswain9/personalized-ai/blob/main/www/main.js"
    click UI_CTRL "https://github.com/chandanswain9/personalized-ai/blob/main/www/controller.js"
    click UI_SCRIPT "https://github.com/chandanswain9/personalized-ai/blob/main/www/script.js"
    click UI_ASSETS "https://github.com/chandanswain9/personalized-ai/tree/main/www/assets/"
    click RUN "https://github.com/chandanswain9/personalized-ai/blob/main/run.py"
    click MAIN "https://github.com/chandanswain9/personalized-ai/blob/main/main.py"
    click SR "https://github.com/chandanswain9/personalized-ai/blob/main/engine/features.py"
    click SR "https://github.com/chandanswain9/personalized-ai/blob/main/engine/helper.py"
    click TTS "https://github.com/chandanswain9/personalized-ai/blob/main/engine/features.py"
    click CMD "https://github.com/chandanswain9/personalized-ai/blob/main/engine/command.py"
    click FEAT "https://github.com/chandanswain9/personalized-ai/blob/main/engine/features.py"
    click AUTH "https://github.com/chandanswain9/personalized-ai/tree/main/engine/auth/"
    click DB "https://github.com/chandanswain9/personalized-ai/blob/main/engine/db.py"
    click DB "https://github.com/chandanswain9/personalized-ai/blob/main/contacts.csv"
    click CFG "https://github.com/chandanswain9/personalized-ai/blob/main/engine/config.py"
    click UTIL "https://github.com/chandanswain9/personalized-ai/blob/main/engine/helper.py"
    click ENTRY "https://github.com/chandanswain9/personalized-ai/blob/main/test.py"
```
