# abhinandan151142/documind-rag-based-faq architecture

> Architecture diagram of the GitHub repository abhinandan151142/documind-rag-based-faq, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abhinandan151142/documind-rag-based-faq
- Repository: https://github.com/abhinandan151142/documind-rag-based-faq

## Overview

DocuMind is a document-grounded FAQ assistant. A user uploads a UTF-8 .txt file, which the API saves and indexes; the user then asks a question, the API retrieves relevant chunks, requests an answer grounded in those chunks, logs the interaction, and returns the answer with its sources. The UI also shows knowledge status and recent conversation/upload history. The source excerpts support the API, retrieval, model, database, and main UI links shown; other README capabilities are represented where their implementation is not sampled only when the tree supports a path.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web_ui["Chat and upload UI"]
end

subgraph group_api["API workflows"]
  node_api_app["FastAPI routes"]
  node_upload_flow["Document upload"]
  node_ask_flow["Question answering"]
  node_history_flow["History and status"]
end

subgraph group_rag["Retrieval and answers"]
  node_rag_index["RAG index"]
  node_chunking["Text chunking"]
  node_embedding_search["Embedding and search"]
  node_answer_model["Grounded generation"]
  node_vector_index["FAISS or NumPy search"]
end

subgraph group_persistence["Knowledge and history"]
  node_upload_storage[("Active text file")]
  node_postgres[("PostgreSQL")]
  node_db_helpers["Database operations"]
end

node_user(("User"))
node_groq["Groq LLaMA API"]
node_sentence_transformer["Sentence Transformer"]

node_user -->|"asks or uploads"| node_web_ui
node_web_ui -->|"calls API"| node_api_app
node_api_app -->|"dispatches upload"| node_upload_flow
node_api_app -->|"dispatches question"| node_ask_flow
node_api_app -->|"serves status and history"| node_history_flow
node_upload_flow -->|"saves and rebuilds"| node_rag_index
node_rag_index -->|"reads active file"| node_upload_storage
node_upload_flow -->|"writes uploaded text"| node_upload_storage
node_rag_index -->|"chunks documents"| node_chunking
node_rag_index -->|"builds and queries"| node_embedding_search
node_embedding_search -->|"encodes text"| node_sentence_transformer
node_embedding_search -->|"searches vectors"| node_vector_index
node_ask_flow -->|"retrieves top chunks"| node_rag_index
node_ask_flow -->|"passes question and sources"| node_answer_model
node_answer_model -->|"requests grounded answer"| node_groq
node_groq -->|"returns answer"| node_answer_model
node_ask_flow -->|"logs interaction"| node_db_helpers
node_upload_flow -->|"logs document"| node_db_helpers
node_history_flow -->|"fetches records"| node_db_helpers
node_db_helpers -->|"reads and writes"| node_postgres
node_ask_flow -->|"returns answer and sources"| node_web_ui
node_history_flow -->|"returns status and history"| node_web_ui

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_web_ui,node_user toneBlue
class node_api_app,node_upload_flow,node_ask_flow,node_history_flow toneAmber
class node_rag_index,node_chunking,node_embedding_search,node_answer_model,node_vector_index,node_groq toneMint
class node_upload_storage,node_postgres,node_db_helpers toneRose
class node_sentence_transformer toneIndigo
```

## Components

### Web client

- **Chat and upload UI**

### API workflows

- **FastAPI routes**
- **Document upload**
- **Question answering**
- **History and status**

### Retrieval and answers

- **RAG index**
- **Text chunking**
- **Embedding and search**
- **Grounded generation**
- **FAISS or NumPy search**

### Knowledge and history

- **Active text file**
- **PostgreSQL**
- **Database operations**

### Other components

- **User**
- **Groq LLaMA API**
- **Sentence Transformer**

## Connections

- User → Chat and upload UI: asks or uploads
- Chat and upload UI → FastAPI routes: calls API
- FastAPI routes → Document upload: dispatches upload
- FastAPI routes → Question answering: dispatches question
- FastAPI routes → History and status: serves status and history
- Document upload → RAG index: saves and rebuilds
- RAG index → Active text file: reads active file
- Document upload → Active text file: writes uploaded text
- RAG index → Text chunking: chunks documents
- RAG index → Embedding and search: builds and queries
- Embedding and search → Sentence Transformer: encodes text
- Embedding and search → FAISS or NumPy search: searches vectors
- Question answering → RAG index: retrieves top chunks
- Question answering → Grounded generation: passes question and sources
- Grounded generation → Groq LLaMA API: requests grounded answer
- Groq LLaMA API → Grounded generation: returns answer
- Question answering → Database operations: logs interaction
- Document upload → Database operations: logs document
- History and status → Database operations: fetches records
- Database operations → PostgreSQL: reads and writes
- Question answering → Chat and upload UI: returns answer and sources
- History and status → Chat and upload UI: returns status and history
