# pingakshgaur/desktop-assistant-scai architecture

> Architecture diagram of the GitHub repository pingakshgaur/desktop-assistant-scai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pingakshgaur/desktop-assistant-scai
- Repository: https://github.com/pingakshgaur/desktop-assistant-scai

## Overview

##### Project Type and Purpose
- Type: Stand-alone desktop utility (monolithic Python application).
- Purpose: Voice-controlled assistant that listens for user commands and automates tasks—web searches, app launches, system cleanup, email, music playback, etc.

##### File Structure
- Top-level script: scai-d.py – orchestrates all features.
- SFX/ – WAV files for interaction sounds (system ready, exit, etc.).
- Config files: REQUIREMENTS.md implied dependencies; no separate module directories.

##### Key Architectural Components
From the README and code references, these logical modules emerge:
a. Input Layer
– Microphone → speech_recognition library
b. Pre-Processing & Command Parser
– Text normalization, “Hey SCAI” wake-word detection
c. Core Engine (Dispatcher)
– Maps parsed commands to actions
d. Action Modules
1. Text-to-Speech (pyttsx3)
2. Sound Effects Player (winsound or winsound wrapper)
3. Web Automator (webbrowser + pyautogui for clicks/scrolls)
4. Application Controller (pyautogui + os.startfile)
5. System Manager (os, shutil for temp files; send2trash)
6. Email Sender (smtplib, email)
7. Wikipedia Fetcher (wikipedia API)
8. Date/Time/Weather (datetime + external weather API if any)
e. External Services
– Gmail SMTP
– Wikipedia API
– Web search engines (Google, YouTube)
f. Data Store
– None persistent; configuration constants (file paths, voice settings) in code

##### Relationships & Data Flow
- Microphone audio → Speech Recognition → Text
- Text → Command Parser → Action Identification
- Action → One of Action Modules → System or External Service
- Action Module → Output → TTS + Sound Effects → Speaker

##### Architectural Patterns & Principles
- Single-process, event‐driven dispatcher
- Modular separation: Input, Parser, Dispatcher, Action Handlers
- External integration via standard Python libraries
- Configuration through constants at top of script

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Layer
    Mic["Microphone"]:::input
    Input["Input Layer<br/>(speech_recognition)"]:::input
    Mic -->|"audio stream"| Input
    click Input "https://github.com/pingakshgaur/desktop-assistant-scai/blob/main/da-SCAI.py"

    %% Core Logic
    Parser["Parser & Dispatcher<br/>(wake-word, command parsing)"]:::core
    Input -->|"text"| Parser
    click Parser "https://github.com/pingakshgaur/desktop-assistant-scai/blob/main/da-SCAI.py"

    %% Configuration and Documentation
    subgraph "Resources & Config"
        Config["Configuration Constants"]:::config
        Dependencies["Dependencies"]:::resource
        Overview["Project Overview"]:::resource
    end
    Config -.->|controls| Parser
    Config -.->|controls| TTS
    Config -.->|controls| SFX
    click Config "https://github.com/pingakshgaur/desktop-assistant-scai/blob/main/da-SCAI.py"
    click Dependencies "https://github.com/pingakshgaur/desktop-assistant-scai/blob/main/REQUIREMENTS.md"
    click Overview "https://github.com/pingakshgaur/desktop-assistant-scai/blob/main/README.md"

    %% Action Modules
    subgraph "Features"    
        TTS["Text-to-Speech Engine<br/>(pyttsx3)"]:::action
        SFX["Sound Effects Player<br/>(winsound)"]:::action
        SFXRes["SFX/ (WAV files)"]:::resource
        WebAuto["Web Automation<br/>(webbrowser, pyautogui)"]:::action
        AppCtrl["Application Controller<br/>(os.startfile, pyautogui)"]:::action
        SysMgr["System Manager<br/>(os, shutil, send2trash)"]:::action
        Email["Email Service<br/>(smtplib, email)"]:::action
        Wiki["Wikipedia Client<br/>(wikipedia API)"]:::action
        DateWeather["Date/Time/Weather<br/>(datetime, weather API)"]:::action
    end

    %% Connections from Parser to Modules
    Parser -->|dispatch| TTS
    Parser -->|dispatch| SFX
    Parser -->|dispatch| WebAuto
    Parser -->|dispatch| AppCtrl
    Parser -->|dispatch| SysMgr
    Parser -->|dispatch| Email
    Parser -->|dispatch| Wiki
    Parser -->|dispatch| DateWeather

    %% Resource click events
    click TTS "https://github.com/pingakshgaur/desktop-assistant-scai/blob/main/da-SCAI.py"
    click SFX "https://github.com/pingakshgaur/desktop-assistant-scai/blob/main/da-SCAI.py"
    click SFXRes "https://github.com/pingakshgaur/desktop-assistant-scai/tree/main/SFX/"
    click WebAuto "https://github.com/pingakshgaur/desktop-assistant-scai/blob/main/da-SCAI.py"
    click AppCtrl "https://github.com/pingakshgaur/desktop-assistant-scai/blob/main/da-SCAI.py"
    click SysMgr "https://github.com/pingakshgaur/desktop-assistant-scai/blob/main/da-SCAI.py"
    click Email "https://github.com/pingakshgaur/desktop-assistant-scai/blob/main/da-SCAI.py"
    click Wiki "https://github.com/pingakshgaur/desktop-assistant-scai/blob/main/da-SCAI.py"
    click DateWeather "https://github.com/pingakshgaur/desktop-assistant-scai/blob/main/da-SCAI.py"

    %% Outputs and External
    subgraph "Outputs"
        Speaker["Speaker<br/>(Audio Output)"]:::output
    end
    TTS -->|"speech"| Speaker
    SFX -->|"sound effects"| Speaker

    subgraph "External Services"
        GmailSMTP["Gmail SMTP"]:::external
        WikiAPI["Wikipedia API"]:::external
        Internet["Web / Search Engines"]:::external
        OS["Operating System"]:::external
    end

    Email -->|SMTP| GmailSMTP
    Wiki -->|API call| WikiAPI
    WebAuto -->|HTTP| Internet
    DateWeather -->|HTTP| Internet
    AppCtrl -->|OS call| OS
    SysMgr -->|OS call| OS

    %% Styles
    classDef input fill:#9f6,stroke:#333,stroke-width:1px
    classDef core fill:#6cf,stroke:#333,stroke-width:1px
    classDef action fill:#fc9,stroke:#333,stroke-width:1px
    classDef external fill:#c9f,stroke:#333,stroke-width:1px
    classDef output fill:#9cf,stroke:#333,stroke-width:1px
    classDef config fill:#ccf,stroke-dasharray: 5 5,stroke:#333
    classDef resource fill:#eee,stroke-dasharray: 5 5,stroke:#333
```
