# minhthinhh/chatbot_work_ai architecture

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

- Interactive diagram: https://gitdiagram.com/minhthinhh/chatbot_work_ai
- Repository: https://github.com/minhthinhh/chatbot_work_ai

## Overview

##### Project type and purpose
- This is a single‐page web “chatbot” application built in Python with Streamlit.
- It ingests a corpus of PDF documents, processes them into a vector store, and answers user chat queries by retrieving relevant chunks and calling the OpenAI API.

##### File structure
- Top‐level files:
- chat_app.py – Streamlit entry point (UI + controller)
- Dockerfile & docker-compose.yml – containerization and orchestration
- requirements.txt – Python dependencies
- data/ – raw PDF documents
- utils/ – core pipeline modules:
– doc_handler.py (PDF parsing & chunking)
– build_graph.py (optional graph or chunk indexing)
– retriever_pipeline.py (vectorization, retrieval logic)
##### README for additional insights
- Three run modes: direct Streamlit, docker-compose, or raw Docker CLI.
- Expects an OPENAI_API_KEY.
- Exposes UI on port 8501.

##### Diagramming recommendations
- Frontend/UI (blue)
- Application logic (green)
- Data storage (yellow)
- External service (orange)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend/UI
    subgraph "Frontend/UI"
        direction TB
        Browser["User Browser"]:::frontend
    end

    %% Deployment / Container
    subgraph "Deployment / Container"
        direction TB
        Container["Docker Container\n(port 8501:8501)\nvolumes: data/, chroma_store"]:::deployment
        Streamlit["Streamlit App"]:::app
        Container --> Streamlit
        subgraph "Retrieval Pipeline"
            direction TB
            DocHandler["Document Handler"]:::app
            GraphBuilder["Graph/Index Builder"]:::app
            Retriever["Retriever Pipeline"]:::app
        end
        Streamlit -->|startup ingest| DocHandler
        DocHandler -->|chunks| GraphBuilder
        GraphBuilder -->|build index| Retriever
        Streamlit -->|on user query| Retriever
    end

    %% Data Storage
    subgraph "Data Storage"
        direction TB
        PDFData["Raw PDFs"]:::storage
        ChromaStore["Chroma Store"]:::storage
    end

    %% External Service
    External["OpenAI API"]:::external

    %% Project Files
    subgraph "Project Files"
        direction TB
        DockerfileNode["Dockerfile"]:::docs
        Compose["docker-compose.yml"]:::docs
        Requirements["requirements.txt"]:::docs
        Readme["README.md"]:::docs
    end

    %% Connections
    Browser -->|HTTP request/response| Streamlit
    Retriever -->|vector search| ChromaStore
    Retriever -->|OpenAI API call| External
    External -->|response| Streamlit
    Streamlit -->|render UI| Browser

    %% Click Events
    click Streamlit "https://github.com/minhthinhh/chatbot_work_ai/blob/master/chat_app.py"
    click DockerfileNode "https://github.com/minhthinhh/chatbot_work_ai/tree/master/Dockerfile"
    click Compose "https://github.com/minhthinhh/chatbot_work_ai/blob/master/docker-compose.yml"
    click Requirements "https://github.com/minhthinhh/chatbot_work_ai/blob/master/requirements.txt"
    click Readme "https://github.com/minhthinhh/chatbot_work_ai/blob/master/README.md"
    click PDFData "https://github.com/minhthinhh/chatbot_work_ai/tree/master/data/"
    click DocHandler "https://github.com/minhthinhh/chatbot_work_ai/blob/master/utils/doc_handler.py"
    click GraphBuilder "https://github.com/minhthinhh/chatbot_work_ai/blob/master/utils/build_graph.py"
    click Retriever "https://github.com/minhthinhh/chatbot_work_ai/blob/master/utils/retriever_pipeline.py"

    %% Styles
    classDef frontend fill:#D0E7FF,stroke:#333,stroke-width:1px
    classDef app fill:#D6F5D6,stroke:#333,stroke-width:1px
    classDef storage fill:#FFF5BA,stroke:#333,stroke-width:1px
    classDef external fill:#FFE0B2,stroke:#333,stroke-width:1px
    classDef deployment fill:#E0E0E0,stroke:#333,stroke-width:1px
    classDef docs fill:#F0F0F0,stroke:#333,stroke-width:1px
```
