# khaleelhabeeb/dialogai architecture

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

- Interactive diagram: https://gitdiagram.com/khaleelhabeeb/dialogai
- Repository: https://github.com/khaleelhabeeb/dialogai

## Overview

##### Main Components

a) User Interface Layer:
- GUI component (implemented in chat_app.py)
- User input/output interactions

b) Core Processing Components:
- Speech-to-Text Module (transcript_collector.py)
- LLM Integration Module (llm.py)
- Text-to-Speech Module (text_to_speech.py)
- Conversation Management System (conversation_manager.py)

c) External Services:
- Deepgram API (for speech-to-text and text-to-speech)
- Groq API (for LLM processing)

##### Detailed Component Descriptions

a) User Interface (chat_app.py):
- Input/output mechanisms
- Conversation history
- Control buttons/interfaces

b) Audio Processing:
- Real-time audio capture
- Integration with Deepgram's transcription
- Audio output handling

c) LLM Integration:
- Connection to Groq API
- Response processing
- Model configuration

d) Conversation Management:
- Context maintenance
- History tracking
- State management

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph User_Interaction
        UI[User Interface]:::ui
        Audio_In((Speech Input)):::io
        Audio_Out((Audio Output)):::io
    end

    subgraph Core_Processing
        TC[Transcript Collector]:::core
        LLM[LLM Integration]:::core
        TTS[Text to Speech]:::core
        CM[Conversation Manager]:::core
        AP[Audio Processing]:::utility
        Config[System Configuration]:::utility
    end

    subgraph External_Services
        Deepgram[Deepgram API]:::external
        Groq[Groq API]:::external
    end

    %% Data Flow
    Audio_In --> AP
    AP --> TC
    TC --> Deepgram
    Deepgram --> TC
    TC --> CM
    CM --> LLM
    LLM --> Groq
    Groq --> LLM
    LLM --> CM
    CM --> TTS
    TTS --> Deepgram
    Deepgram --> TTS
    TTS --> Audio_Out
    
    %% UI Interactions
    UI --> CM
    CM --> UI
    Config --> LLM

    %% Click Events
    click UI "https://github.com/Khaleelhabeeb/DialogAI/blob/main/app/chat_app.py"
    click TC "https://github.com/Khaleelhabeeb/DialogAI/blob/main/app/transcript_collector.py"
    click LLM "https://github.com/Khaleelhabeeb/DialogAI/blob/main/app/llm.py"
    click TTS "https://github.com/Khaleelhabeeb/DialogAI/blob/main/app/text_to_speech.py"
    click CM "https://github.com/Khaleelhabeeb/DialogAI/blob/main/app/conversation_manager.py"
    click AP "https://github.com/Khaleelhabeeb/DialogAI/blob/main/utils/audio_transcription.py"
    click Config "https://github.com/Khaleelhabeeb/DialogAI/blob/main/system_prompt.txt"

    %% Styling
    classDef core fill:#2b6cb0,stroke:#1a4971,color:white
    classDef external fill:#48bb78,stroke:#2f855a,color:white
    classDef ui fill:#ed8936,stroke:#c05621,color:white
    classDef utility fill:#718096,stroke:#4a5568,color:white
    classDef io fill:#9f7aea,stroke:#6b46c1,color:white

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[External Services]:::external
        L3[User Interface]:::ui
        L4[Utility Components]:::utility
        L5((I/O Components)):::io
    end
```
