# victoromoboye/ai-powered-customer-care-chatbot architecture

> Architecture diagram of the GitHub repository victoromoboye/ai-powered-customer-care-chatbot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/victoromoboye/ai-powered-customer-care-chatbot
- Repository: https://github.com/victoromoboye/ai-powered-customer-care-chatbot

## Overview

##### Project Type and Purpose
- VicaBot is a lightweight, Streamlit-based full-stack chatbot application.
- Purpose: Receive user messages via a web UI, apply rule-based logic, or defer to an external NLP model (BlenderBot via HuggingFace), then display responses and maintain conversation context.

##### File Structure
- Top-level files only:
- README.md – Project description and methodology
- VicBot.py – Contains all code: Streamlit UI, rule engine, model API calls, and conversation state
- No separate folders for “frontend” or “backend,” but conceptually it’s a single-module monolith.

##### README for Key Components
- Streamlit – Web UI layer for chat interface
- Rule-Based Intent Engine – Python logic in VicBot.py
- BlenderBot 400M (via HuggingFace) – External AI service for fallback replies
- In-memory Conversation Log – Stored in Python runtime as session state

##### Main Components
a. Frontend (Streamlit App)
- Chat Window Display

b. Backend Logic (VicBot.py)
- Intent Recognition Module (rule-based keyword matching)
- Conversation State Manager (stores history in session state)
- AI Router (decides rule-based vs. NLP fallback)

c. External NLP Service
- HuggingFace API endpoint hosting BlenderBot 400M

d. (Optional future) Data Store / Authentication Service

##### Relationships & Data Flows
- If match → Rule Response → Conversation State → UI Response
- If no match → API Request → BlenderBot Service → API Response → Conversation State → UI Response

##### Architectural Patterns
- Monolithic single-process but logically layered (UI / Business Logic / External Service)
- “Router” pattern deciding between rule engine and AI model
- Session-based state management for context

##### Relevant Technologies
- Python (VicBot.py)
- Streamlit (UI Layer)
- HuggingFace Transformers API (BlenderBot)
- (Future) SQL/NoSQL Database, Auth0/OIDC, Speech-to-Text & TTS

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User
    User["User"]:::user

    %% Frontend Layer
    subgraph "Streamlit App"
        direction TB
        InputComponent["Input Component"]:::frontend
        DisplayComponent["Display Component"]:::frontend
    end

    %% Backend Logic in VicBot.py
    subgraph "VicBot.py"
        direction TB
        IntentEngine["Intent Recognition Module"]:::logic
        AIRouter["AI Router"]:::logic
        StateManager["Conversation State Manager"]:::logic
    end

    %% External Service
    ExternalNLP["HuggingFace BlenderBot 400M"]:::external

    %% Future Optional Components
    Database[(Future Database)]:::optional
    Docs["Project Documentation"]:::optional

    %% Connections
    User -->|user_input| InputComponent
    InputComponent -->|user_input| IntentEngine
    IntentEngine -->|intent_match| StateManager
    IntentEngine -->|no_match| AIRouter
    AIRouter -->|api_request| ExternalNLP
    ExternalNLP -->|api_response| AIRouter
    AIRouter -->|bot_response| StateManager
    StateManager -->|context_update| DisplayComponent
    StateManager -->|context_retrieval| DisplayComponent
    DisplayComponent -->|display| User

    %% Future and Docs
    Database -.->|future extension| AIRouter
    Docs -.->|see details| User

    %% Click Events
    click InputComponent "https://github.com/victoromoboye/ai-powered-customer-care-chatbot/blob/main/VicBot.py"
    click DisplayComponent "https://github.com/victoromoboye/ai-powered-customer-care-chatbot/blob/main/VicBot.py"
    click IntentEngine "https://github.com/victoromoboye/ai-powered-customer-care-chatbot/blob/main/VicBot.py"
    click StateManager "https://github.com/victoromoboye/ai-powered-customer-care-chatbot/blob/main/VicBot.py"
    click AIRouter "https://github.com/victoromoboye/ai-powered-customer-care-chatbot/blob/main/VicBot.py"
    click ExternalNLP "https://github.com/victoromoboye/ai-powered-customer-care-chatbot/blob/main/VicBot.py"
    click Docs "https://github.com/victoromoboye/ai-powered-customer-care-chatbot/blob/main/README.md"

    %% Styles
    classDef frontend fill:#D6E9F8,stroke:#4A90E2;
    classDef logic fill:#DFF0D8,stroke:#3C763D;
    classDef external fill:#FCF8E3,stroke:#8A6D3B;
    classDef optional fill:#EEEEEE,stroke:#AAAAAA;
    classDef user fill:#FFFFFF,stroke:#000000;
```
