# bdeekshith066/chatbot_hub architecture

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

- Interactive diagram: https://gitdiagram.com/bdeekshith066/chatbot_hub
- Repository: https://github.com/bdeekshith066/chatbot_hub

## Overview

##### Main Components
- Frontend/UI: Since the project runs using Streamlit (via main.py and home.py), think of the UI layer as the entry point where users select and interact with different chatbot demos.
- Chatbot Modules: Each chatbot type is implemented as its own Python script (e.g., api_based_chatbot.py, rule_based_chatbot.py, keyword_based_chatbot.py, etc.). They are individual components responsible for their distinct conversational logic.
- Assets/Data: The assets directory holds various JSON files (like api_animation.json, multilingual.json, etc.) that contain configuration data, training data, or other resources required by the chatbots.
- Supporting Components: The requirements.txt indicates dependencies and perhaps third-party libraries that glue everything together.

##### Relationships and Interactions
- The Streamlit front end (main.py/home.py) acts as the user interface, where user interactions (text, voice commands, file uploads) are received.
- Each chatbot module performs its required processing by loading specific asset files from the assets directory. For example, keyword_based_chatbot.py likely accesses keyword.json files, while data_analysis_chatbot.py may work with a set of dataanalysis*.json files.
- The results from each chatbot module are then returned to the UI, which renders responses or visualizations back to the user.

##### Architectural Patterns and Design Principles
- Modular Design: With separate scripts for each chatbot, the design follows a modular approach where each module is isolated. This increases maintainability and scalability.
- Single Responsibility: Each chatbot script is focused on a specific approach or type of conversation logic.
- Separation of Concerns: The UI layer (managed by Streamlit) is decoupled from the business logic (chatbot modules) and resource management (assets).
- Integration via configuration: The assets folder acts as a repository for resources that the individual modules use without hard-coding data into the logic.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation Layer (UI)
    subgraph "Presentation Layer"
        UI1["main.py"]:::ui
        UI2["home.py"]:::ui
    end

    %% Business Logic (Chatbot Modules)
    subgraph "Chatbot Modules"
        M1["Rule-Based Chatbot"]:::module
        M2["Keyword-Based Chatbot"]:::module
        M3["API-Based Chatbot"]:::module
        M4["Multilingual Chatbot"]:::module
        M5["RAG-Based Chatbot"]:::module
        M6["Data Analysis Chatbot"]:::module
        M7["Voice Chatbot"]:::module
    end

    %% Resources
    subgraph "Resources"
        A["Assets (JSON)"]:::assets
        D["Dependencies"]:::dependency
    end

    %% UI sends input to each Chatbot Module
    UI1 -->|"sendsInput"| M1
    UI1 -->|"sendsInput"| M2
    UI1 -->|"sendsInput"| M3
    UI1 -->|"sendsInput"| M4
    UI1 -->|"sendsInput"| M5
    UI1 -->|"sendsInput"| M6
    UI1 -->|"sendsInput"| M7

    %% Chatbot Modules return responses to UI
    M1 -->|"returnsResponse"| UI2
    M2 -->|"returnsResponse"| UI2
    M3 -->|"returnsResponse"| UI2
    M4 -->|"returnsResponse"| UI2
    M5 -->|"returnsResponse"| UI2
    M6 -->|"returnsResponse"| UI2
    M7 -->|"returnsResponse"| UI2

    %% Chatbot Modules load configuration/data from Assets (dotted arrows)
    M1 -.->|"loadsConfig"| A
    M2 -.->|"loadsConfig"| A
    M3 -.->|"loadsConfig"| A
    M4 -.->|"loadsConfig"| A
    M5 -.->|"loadsConfig"| A
    M6 -.->|"loadsConfig"| A
    M7 -.->|"loadsConfig"| A

    %% Dependencies support Chatbot Modules and UI
    D -->|"supports"| M1
    D -->|"supports"| M2
    D -->|"supports"| M3
    D -->|"supports"| M4
    D -->|"supports"| M5
    D -->|"supports"| M6
    D -->|"supports"| M7
    D -->|"supports"| UI1

    %% Click Events for component mapping
    click UI1 "https://github.com/bdeekshith066/chatbot_hub/blob/main/main.py"
    click UI2 "https://github.com/bdeekshith066/chatbot_hub/blob/main/home.py"
    click M1 "https://github.com/bdeekshith066/chatbot_hub/blob/main/rule_based_chatbot.py"
    click M2 "https://github.com/bdeekshith066/chatbot_hub/blob/main/keyword_based_chatbot.py"
    click M3 "https://github.com/bdeekshith066/chatbot_hub/blob/main/api_based_chatbot.py"
    click M4 "https://github.com/bdeekshith066/chatbot_hub/blob/main/multi_lingual_chatbot.py"
    click M5 "https://github.com/bdeekshith066/chatbot_hub/blob/main/rag_chatbot.py"
    click M6 "https://github.com/bdeekshith066/chatbot_hub/blob/main/data_analysis_chatbot.py"
    click M7 "https://github.com/bdeekshith066/chatbot_hub/blob/main/voice_chatbot.py"
    click A "https://github.com/bdeekshith066/chatbot_hub/tree/main/assets/"
    click D "https://github.com/bdeekshith066/chatbot_hub/blob/main/requirements.txt"

    %% Styles
    classDef ui fill:#f9c74f,stroke:#333,stroke-width:2px;
    classDef module fill:#90be6d,stroke:#333,stroke-width:2px;
    classDef assets fill:#f94144,stroke:#333,stroke-width:2px;
    classDef dependency fill:#577590,stroke:#333,stroke-width:2px;
```
