# vinitsarang77/ai-chatbot-doc-analyzer architecture

> Architecture diagram of the GitHub repository vinitsarang77/ai-chatbot-doc-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vinitsarang77/ai-chatbot-doc-analyzer
- Repository: https://github.com/vinitsarang77/ai-chatbot-doc-analyzer

## Overview

This is a Flask personal-assistant and document-analysis web app. Users interact through a browser with standard chat, knowledge-grounded chat, email summarization, and PDF/spreadsheet analysis. The backend routes these requests to the Groq-hosted LLM; RAG features additionally retrieve relevant chunks from a local knowledge base or uploaded document. The graph separates those product stages while keeping PDF and spreadsheet parsing as internal capabilities. Relationships are limited to calls and UI requests shown in the excerpts or documented in the README; the HTML template and stylesheet were not sampled.

Main entry points: [`main.py`](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py) (Flask routes), [`static/script.js`](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/static/script.js) (Browser UI), [`templates/index.html`](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/templates/index.html) (Assistant page), [`rag.py`](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/rag.py) (RAG pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web interface"]
  node_browser["Browser UI<br/>[script.js]"]
  node_page["Assistant page<br/>[index.html]"]
  node_styles["Responsive styles<br/>[style.css]"]
end

subgraph group_assistant["Assistant services"]
  node_flask["Flask routes<br/>[main.py]"]
  node_standard["Standard chat<br/>[main.py]"]
  node_ragchat["Grounded chat<br/>[main.py]"]
  node_email["Email summarizer<br/>[main.py]"]
end

subgraph group_rag["RAG pipeline"]
  node_pipeline["RAG pipeline<br/>[rag.py]"]
  node_knowledge["Local knowledge base<br/>[knowledge.txt]"]
end

subgraph group_documents["Document analysis"]
  node_extract["Document analyzer<br/>[main.py]"]
  node_pdf["PDF extraction<br/>[main.py]"]
  node_spreadsheets["Spreadsheet extraction<br/>[main.py]"]
  node_docrag["Document retrieval<br/>[main.py]"]
end

node_user(("User"))
node_llm{{"Groq LLM API"}}

node_user -->|"uses"| node_browser
node_browser -->|"renders in"| node_page
node_page -->|"styled by"| node_styles
node_page -->|"loads"| node_browser
node_browser -->|"submits requests"| node_flask
node_flask -->|"routes chat"| node_standard
node_flask -->|"routes grounded chat"| node_ragchat
node_flask -->|"routes summaries"| node_email
node_flask -->|"routes uploads"| node_extract
node_standard -->|"generates response"| node_llm
node_ragchat -->|"retrieves chunks"| node_pipeline
node_pipeline -->|"indexes text"| node_knowledge
node_ragchat -->|"generates response"| node_llm
node_email -->|"generates summary"| node_llm
node_extract -->|"parses PDF"| node_pdf
node_extract -->|"parses sheets"| node_spreadsheets
node_extract -->|"builds and retrieves"| node_docrag
node_extract -->|"generates analysis"| node_llm

click node_browser "https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/static/script.js"
click node_page "https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/templates/index.html"
click node_styles "https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/static/style.css"
click node_flask "https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py"
click node_standard "https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py"
click node_ragchat "https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py"
click node_email "https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py"
click node_pipeline "https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/rag.py"
click node_knowledge "https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/knowledge.txt"
click node_extract "https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py"
click node_pdf "https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py"
click node_spreadsheets "https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py"
click node_docrag "https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser,node_page,node_styles,node_user toneBlue
class node_flask,node_standard,node_ragchat,node_email toneAmber
class node_pipeline,node_knowledge,node_llm toneMint
class node_extract,node_pdf,node_spreadsheets,node_docrag toneRose
```

## Components

### Web interface

- [Browser UI](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/static/script.js): `static/script.js`
- [Assistant page](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/templates/index.html): `templates/index.html`
- [Responsive styles](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/static/style.css): `static/style.css`

### Assistant services

- [Flask routes](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py): `main.py`
- [Standard chat](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py): `main.py`
- [Grounded chat](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py): `main.py`
- [Email summarizer](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py): `main.py`

### RAG pipeline

- [RAG pipeline](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/rag.py): `rag.py`
- [Local knowledge base](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/knowledge.txt): `knowledge.txt`

### Document analysis

- [Document analyzer](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py): `main.py`
- [PDF extraction](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py): `main.py`
- [Spreadsheet extraction](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py): `main.py`
- [Document retrieval](https://github.com/vinitsarang77/ai-chatbot-doc-analyzer/blob/main/main.py): `main.py`

### Other components

- **User**
- **Groq LLM API**

## Connections

- User → Browser UI: uses (evidence: `README.md`)
- Browser UI → Assistant page: renders in (evidence: `README.md`)
- Assistant page → Responsive styles: styled by (evidence: `README.md`)
- Assistant page → Browser UI: loads (evidence: `README.md`)
- Browser UI → Flask routes: submits requests (evidence: `static/script.js`)
- Flask routes → Standard chat: routes chat (evidence: `main.py`)
- Flask routes → Grounded chat: routes grounded chat (evidence: `main.py`)
- Flask routes → Email summarizer: routes summaries (evidence: `main.py`)
- Flask routes → Document analyzer: routes uploads (evidence: `main.py`)
- Standard chat → Groq LLM API: generates response (evidence: `main.py`)
- Grounded chat → RAG pipeline: retrieves chunks (evidence: `main.py`)
- RAG pipeline → Local knowledge base: indexes text (evidence: `README.md`)
- Grounded chat → Groq LLM API: generates response (evidence: `main.py`)
- Email summarizer → Groq LLM API: generates summary (evidence: `main.py`)
- Document analyzer → PDF extraction: parses PDF (evidence: `main.py`)
- Document analyzer → Spreadsheet extraction: parses sheets (evidence: `main.py`)
- Document analyzer → Document retrieval: builds and retrieves (evidence: `main.py`)
- Document analyzer → Groq LLM API: generates analysis (evidence: `main.py`)
