# aboriginal-armadillo/coe-webui architecture

> Architecture diagram of the GitHub repository aboriginal-armadillo/coe-webui, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aboriginal-armadillo/coe-webui
- Repository: https://github.com/aboriginal-armadillo/coe-webui

## Overview

##### High-Level Architecture Components

a) Frontend Layer (React Application)
- Main React components structure under /src/components
- Key features: Chat interface, Workflow builder, Bot management, RAG (Retrieval-Augmented Generation)
- User authentication and account management

b) Backend Layer (Firebase & Cloud Functions)
- Firebase services (Authentication, Hosting, Firestore)
- Python-based Cloud Functions
- Workflow execution engine
- Document summarization service

c) External Services Layer
- OpenAI integration
- Pinecone vector database
- External data sources (ArXiv, PubMed)

##### Component Relationships

a) Frontend Components:
- MessagesView → SendMessage → ContextLoaders
- Workflows → WorkflowBuilder → RunViewer
- Bots → BotZoo & BuildABot
- RAG → DataLoaders & ManagePinecone

b) Backend Workflows:
- Cloud Functions → Workflow Nodes
- Document Summarization Pipeline
- RAG Implementation

##### Data Flow Visualization

- User interactions → Frontend Components
- API Calls → Cloud Functions
- Document Processing Flow
- Workflow Execution Path

##### Technical Stack Indicators

Clearly label:
- React (Frontend framework)
- Firebase (Backend services)
- Python (Cloud Functions)
- OpenAI (AI/ML services)
- Pinecone (Vector database)

##### Component Details

For each major component, include:
- Purpose/responsibility
- Key dependencies
- Integration points
- Data flow direction

Key Architectural Patterns to Highlight:
- Microservices architecture for cloud functions
- Event-driven workflow execution
- Component-based frontend architecture
- RAG pattern for document processing

Remember to include deployment-related elements (Firebase hosting, Cloud Functions deployment) and security boundaries between different services.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI[User Interface]
        MV["Messages View"]:::component
        SM["Send Message"]:::component
        CL["Context Loaders"]:::component
        WB["Workflow Builder"]:::component
        WL["Workflow List"]:::component
        RV["Run Viewer"]
        BZ["Bot Zoo"]:::component
        BAB["Build A Bot"]:::component
        MP["Manage Pinecone"]:::component
        DL["Data Loaders"]
        ADL["ArXiv Data Loader"]:::component
        PDL["PubMed Data Loader"]:::component
        Login["Login Component"]:::component
    end

    subgraph Backend
        FS[("Firestore")]
        Auth["Firebase Auth"]
        Host["Firebase Hosting"]
        
        subgraph "Cloud Functions"
            WE["Workflow Engine"]:::component
            DS["Document Summarization"]:::component
            RAG["RAG System"]:::component
            OAI["OpenAI Integration"]:::component
            Nodes["Workflow Nodes"]:::component
        end
    end

    subgraph "External Services"
        OpenAI["OpenAI API"]
        Pinecone[("Pinecone DB")]
        ArXiv["ArXiv API"]
        PubMed["PubMed API"]
    end

    %% Frontend Relationships
    UI --> MV
    MV --> SM
    SM --> CL
    UI --> WB
    WB --> RV
    UI --> BZ
    UI --> BAB
    UI --> MP
    DL --> ADL
    DL --> PDL
    UI --> Login

    %% Backend Relationships
    WB --> WE
    DS --> RAG
    RAG --> Pinecone
    WE --> Nodes
    Nodes --> OAI

    %% External Service Connections
    OAI --> OpenAI
    ADL --> ArXiv
    PDL --> PubMed
    
    %% Auth Flow
    Login --> Auth
    Auth --> FS

    %% Click Events
    click MV "https://github.com/aboriginal-armadillo/coe-webui/blob/main/src/components/MessagesView/MessagesView.jsx"
    click SM "https://github.com/aboriginal-armadillo/coe-webui/blob/main/src/components/MessagesView/SendMessage/SendMessage.jsx"
    click WB "https://github.com/aboriginal-armadillo/coe-webui/blob/main/src/components/Workflows/WorkflowBuilder/WorkflowBuilder.js"
    click WE "https://github.com/aboriginal-armadillo/coe-webui/blob/main/functions/workflows/nodes/execute_node_fn.py"
    click BZ "https://github.com/aboriginal-armadillo/coe-webui/blob/main/src/components/Bots/BotZoo/BotZoo.jsx"
    click BAB "https://github.com/aboriginal-armadillo/coe-webui/blob/main/src/components/Bots/BuildABot/BuildABot.jsx"
    click RAG "https://github.com/aboriginal-armadillo/coe-webui/blob/main/functions/utils/rag.py"
    click MP "https://github.com/aboriginal-armadillo/coe-webui/blob/main/src/components/rag/ManagePinecone/ManagePinecone.jsx"
    click DS "https://github.com/aboriginal-armadillo/coe-webui/tree/main/functions/summarize_document/"
    click Login "https://github.com/aboriginal-armadillo/coe-webui/blob/main/src/components/Login/Login.jsx"
    click ADL "https://github.com/aboriginal-armadillo/coe-webui/blob/main/src/components/rag/DataLoaders/ArxivDataLoader/ArxivDataLoader.js"
    click PDL "https://github.com/aboriginal-armadillo/coe-webui/blob/main/src/components/rag/DataLoaders/PubMedDataLoader/PubMedDataLoader.js"
    click OAI "https://github.com/aboriginal-armadillo/coe-webui/blob/main/functions/workflows/samples/openai.py"
    click CL "https://github.com/aboriginal-armadillo/coe-webui/tree/main/src/components/MessagesView/SendMessage/ContextLoaders/"
    click WL "https://github.com/aboriginal-armadillo/coe-webui/blob/main/src/components/Workflows/WorkflowsList/WorkflowsList.js"

    classDef component fill:#f9f,stroke:#333,stroke-width:2px
    classDef external fill:#fcf,stroke:#333,stroke-width:2px
    classDef storage fill:#ff9,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[Frontend Component]:::component
        L2[External Service]:::external
        L3[(Storage)]:::storage
    end
```
