# yvann-ba/robby-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/yvann-ba/robby-chatbot
- Repository: https://github.com/yvann-ba/robby-chatbot

## Overview

##### Project Type and Purpose
- Type: An interactive web application using Streamlit for the frontend.
- Purpose: To provide an AI chatbot with conversational memory that can understand and query various document formats and YouTube videos.
- Key functionality includes data embedding (using the “embedder” module), conversation management (via the “chatbot” and “history” modules), and specialized components for handling tabular data (“robby_sheet”) and YouTube integration.

##### File Structure for Architectural Components
- Top-level directories and files:
- README.md, requirements.txt, LICENSE, setup.sh, etc.
- .streamlit directory indicating UI configuration.
- The src folder holds the core code.
- Within src:
- Home.py serves as the main entry point for the Streamlit app.
- The “pages” directory contains separate Python files for different pages (Robby-Chat, Robby-Sheet, Robby-YouTube), representing separate UI modules or functionalities.
- The “modules” directory includes:
- chatbot.py (handling conversation logic)
- embedder.py (handling data embeddings)
- history.py (managing conversational memory)
- layout.py and sidebar.py (defining UI layout elements)
- robby_sheet submodule (with table_tool.py) specifically for spreadsheet-like interactions.
- utils.py and possibly other helper modules.
- Presence of configuration files and deployment-related scripts (e.g., setup.sh) indicates instructions for local deployment.

##### Detailed Steps for the Principal Software Engineer
- Branch out to the three key pages (Chat, Sheet, YouTube) that users interact with.
- How shared components (layout and sidebar) support the entire UI.
- External integrations: show a connection for uploading data files and consuming YouTube video data – indicate any potential external API services.
- Line with a brief description of the data flow (e.g., “User Input → Chatbot Logic”, “Embedding Generation → Chatbot Response”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        UI_CONFIG["Streamlit Config"]:::ui
        UI_ENTRY["Entry Point (Home)"]:::ui
        subgraph "Pages"
            UI_CHAT["Robby-Chat Page"]:::ui
            UI_SHEET["Robby-Sheet (beta) Page"]:::ui
            UI_YT["Robby-YouTube Page"]:::ui
        end
    end

    %% Business Logic Layer
    subgraph "Business Logic"
        BL_CHAT["Chatbot Module"]:::logic
        BL_EMBED["Embedder Module"]:::logic
        BL_HISTORY["History Module"]:::logic
        BL_LAYOUT["Layout Module"]:::logic
        BL_SIDEBAR["Sidebar Module"]:::logic
        BL_SHEET["Robby_Sheet Module"]:::logic
        BL_UTILS["Utility Functions"]:::logic
    end

    %% External Data Sources
    subgraph "External Data Sources"
        EXT_FILES["Uploaded Files (CSV, PDF, TXT)"]:::data
        EXT_YT["YouTube Videos/API"]:::data
    end

    %% User Node
    User("User"):::user

    %% Connections from User to UI Entry
    User -->|"initiates"| UI_ENTRY

    %% UI Entry initializes Pages
    UI_ENTRY -->|"loads"| UI_CHAT
    UI_ENTRY -->|"loads"| UI_SHEET
    UI_ENTRY -->|"loads"| UI_YT

    %% Connections from UI Pages to Business Logic Modules
    UI_CHAT -->|"handles conversation"| BL_CHAT
    UI_CHAT -->|"generates embedding"| BL_EMBED
    UI_CHAT -->|"updates memory"| BL_HISTORY

    UI_SHEET -->|"processes tabular data"| BL_SHEET
    UI_SHEET -->|"renders layout"| BL_LAYOUT
    UI_SHEET -->|"renders sidebar"| BL_SIDEBAR
    UI_SHEET -->|"invokes conversation"| BL_CHAT

    UI_YT -->|"requests YouTube data"| EXT_YT
    UI_YT -->|"invokes conversation"| BL_CHAT

    %% Internal Business Logic interactions
    BL_CHAT -->|"uses embedding"| BL_EMBED
    BL_CHAT -->|"uses memory"| BL_HISTORY
    BL_CHAT -->|"utilizes utilities"| BL_UTILS
    BL_EMBED -->|"processes file data"| EXT_FILES

    %% Styles
    classDef ui fill:#AED6F1,stroke:#1F618D,stroke-width:2px
    classDef logic fill:#D5F5E3,stroke:#27AE60,stroke-width:2px
    classDef data fill:#FADBD8,stroke:#C0392B,stroke-width:2px
    classDef user fill:#FCF3CF,stroke:#B7950B,stroke-width:2px

    %% Click Events
    click UI_CONFIG "https://github.com/yvann-ba/robby-chatbot/blob/main/.streamlit/config.toml"
    click UI_ENTRY "https://github.com/yvann-ba/robby-chatbot/blob/main/src/Home.py"
    click UI_CHAT "https://github.com/yvann-ba/robby-chatbot/blob/main/src/pages/1_📄Robby-Chat.py"
    click UI_SHEET "https://github.com/yvann-ba/robby-chatbot/blob/main/src/pages/2_📊 Robby-Sheet (beta).py"
    click UI_YT "https://github.com/yvann-ba/robby-chatbot/blob/main/src/pages/3_🎬 Robby-Youtube.py"
    click BL_CHAT "https://github.com/yvann-ba/robby-chatbot/blob/main/src/modules/chatbot.py"
    click BL_EMBED "https://github.com/yvann-ba/robby-chatbot/blob/main/src/modules/embedder.py"
    click BL_HISTORY "https://github.com/yvann-ba/robby-chatbot/blob/main/src/modules/history.py"
    click BL_LAYOUT "https://github.com/yvann-ba/robby-chatbot/blob/main/src/modules/layout.py"
    click BL_SIDEBAR "https://github.com/yvann-ba/robby-chatbot/blob/main/src/modules/sidebar.py"
    click BL_SHEET "https://github.com/yvann-ba/robby-chatbot/blob/main/src/modules/robby_sheet/table_tool.py"
    click BL_UTILS "https://github.com/yvann-ba/robby-chatbot/blob/main/src/modules/utils.py"
```
