# arqamansari23/chatbot-crewai architecture

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

- Interactive diagram: https://gitdiagram.com/arqamansari23/chatbot-crewai
- Repository: https://github.com/arqamansari23/chatbot-crewai

## Overview

##### Project type and purpose
- This is a lightweight full-stack web application that exposes a chatbot interface via HTML templates, integrates with an LLM (e.g., OpenAI API), persists conversation vectors in a FAISS store, logs leads in a SQLite database, and can send emails via the Mail_Agent module.
- Key indicators:
- Presence of “templates/” and “static/” directories → a server-rendered web UI (likely Flask or similar).
- “Chatbot.py” and “Mail_Agent.py” at root → separate modules for chat logic and mail logic.
- “data/vectorStores/store/index.*” → FAISS vector store for semantic search.
- “leads.db” → SQLite leads storage.

##### File structure
- Top level:
- Chatbot.py: main chat-server entrypoint
- Mail_Agent.py: email-sending service
- pyproject.toml / requirements.txt: Python dependencies & build config
- leads.db: embedded SQLite for lead data
- Directories:
- data/vectorStores/store: FAISS index files (.faiss, .pkl) for vector embeddings
- static/: CSS/JS assets for the web UI
- templates/: Jinja HTML templates (interface.html, index_MAIL.html)

##### README
- In this case the README is empty; we infer architecture from code and file layout.

##### Elements
- Clear labels: “Browser UI,” “Chatbot Server,” “FAISS Store,” “SQLite Leads DB,” “Mail Agent,” “LLM API,” “SMTP”
– Browser → Server (HTTP requests)
– Server → LLM API (HTTP/HTTPS)
– Server ↔ FAISS (local filesystem I/O)
– Server ↔ SQLite (SQL I/O)
– Server → Mail Agent → SMTP (network)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        TemplatesInterface["templates/interface.html"]:::client
        TemplatesMail["templates/index_MAIL.html"]:::client
        StaticAssets["static/"]:::client
    end

    %% Server Layer
    subgraph "Server Layer"
        direction TB
        Chatbot["Chatbot Service<br/>(Chatbot.py)"]:::service
        Legacy["Legacy Chatbot (v1)<br/>(Chatbot_Version_1.py)"]:::service
        MailAgent["Mail Agent Service<br/>(Mail_Agent.py)"]:::service
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        VectorStore["Vector Store<br/>(index.faiss, index.pkl)"]:::db
        LeadsDB["SQLite Leads DB<br/>(leads.db)"]:::db
    end

    %% External Services
    subgraph "External Services"
        direction TB
        LLMAPI["LLM API"]:::external
        SMTP["SMTP/Email API"]:::external
    end

    %% Connections
    TemplatesInterface -->|HTTP Request| Chatbot
    TemplatesMail -->|HTTP Request| Chatbot
    StaticAssets -->|HTTP Request| Chatbot

    Chatbot -->|"calls LLM"| LLMAPI
    Chatbot -->|"reads/writes"| VectorStore
    Chatbot -->|"reads/writes"| LeadsDB
    Chatbot -->|"invokes"| MailAgent
    Chatbot -->|"legacy fallback"| Legacy

    MailAgent -->|"sends email via"| SMTP

    %% Click Events
    click TemplatesInterface "https://github.com/arqamansari23/chatbot-crewai/blob/main/templates/interface.html"
    click TemplatesMail "https://github.com/arqamansari23/chatbot-crewai/blob/main/templates/index_MAIL.html"
    click StaticAssets "https://github.com/arqamansari23/chatbot-crewai/tree/main/static/"
    click Chatbot "https://github.com/arqamansari23/chatbot-crewai/blob/main/Chatbot.py"
    click Legacy "https://github.com/arqamansari23/chatbot-crewai/blob/main/Chatbot_Version_1.py"
    click MailAgent "https://github.com/arqamansari23/chatbot-crewai/blob/main/Mail_Agent.py"
    click VectorStore "https://github.com/arqamansari23/chatbot-crewai/tree/main/data/vectorStores/store/"
    click LeadsDB "https://github.com/arqamansari23/chatbot-crewai/blob/main/leads.db"

    %% Styles
    classDef client fill:#E0F7FA,stroke:#006064;
    classDef service fill:#BBDEFB,stroke:#0D47A1;
    classDef db fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef external fill:#FFE0B2,stroke:#E65100;
```
