# manyacpmanya/ai_assistent architecture

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

- Interactive diagram: https://gitdiagram.com/manyacpmanya/ai_assistent
- Repository: https://github.com/manyacpmanya/ai_assistent

## Overview

AI_ASSISTENT is a Flask-based college information assistant. A user submits a question through the browser; the Flask route reads student data from MySQL, uses the RAG utilities to retrieve relevant context, and sends that context and question to Ollama before returning an answer to the UI. The README also describes chat-log persistence, but the sampled backend does not show it; that relationship is included as documented. The graph reflects the sampled implementation and README; other source files were not inspected.

Main entry points: [`main.py`](https://github.com/manyacpmanya/ai_assistent/blob/main/main.py) (Flask routes), [`templates/index.html`](https://github.com/manyacpmanya/ai_assistent/blob/main/templates/index.html) (Assistant UI), [`sample_db.sql`](https://github.com/manyacpmanya/ai_assistent/blob/main/sample_db.sql) (Chat logs), [`rag_utils.py`](https://github.com/manyacpmanya/ai_assistent/blob/main/rag_utils.py) (Chunking and retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_ui["Assistant UI<br/>[index.html]"]
end

subgraph group_backend["Flask application"]
  node_api["Flask routes<br/>[main.py]"]
  node_student_data[("Student records")]
  node_chat_logs[("Chat logs<br/>[sample_db.sql]")]
end

subgraph group_retrieval["RAG retrieval"]
  node_rag["Chunking and retrieval<br/>[rag_utils.py]"]
end

subgraph group_generation["Answer generation"]
  node_ollama["Ollama model API"]
end

node_user(("Question asker"))

node_user -->|"asks question"| node_ui
node_ui -->|"posts question"| node_api
node_api -->|"reads records"| node_student_data
node_api -->|"runs retrieval"| node_rag
node_api -->|"requests answer"| node_ollama
node_api -.->|"saves conversation"| node_chat_logs
node_api -->|"returns answer"| node_ui

click node_ui "https://github.com/manyacpmanya/ai_assistent/blob/main/templates/index.html"
click node_api "https://github.com/manyacpmanya/ai_assistent/blob/main/main.py"
click node_rag "https://github.com/manyacpmanya/ai_assistent/blob/main/rag_utils.py"
click node_chat_logs "https://github.com/manyacpmanya/ai_assistent/blob/main/sample_db.sql"

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_ui toneBlue
class node_api,node_student_data,node_chat_logs toneAmber
class node_rag toneMint
class node_ollama toneRose
class node_user toneIndigo
```

## Components

### Web interface

- [Assistant UI](https://github.com/manyacpmanya/ai_assistent/blob/main/templates/index.html): `templates/index.html`

### Flask application

- [Flask routes](https://github.com/manyacpmanya/ai_assistent/blob/main/main.py): `main.py`
- **Student records**
- [Chat logs](https://github.com/manyacpmanya/ai_assistent/blob/main/sample_db.sql): `sample_db.sql`

### RAG retrieval

- [Chunking and retrieval](https://github.com/manyacpmanya/ai_assistent/blob/main/rag_utils.py): `rag_utils.py`

### Answer generation

- **Ollama model API**

### Other components

- **Question asker**

## Connections

- Question asker → Assistant UI: asks question (evidence: `README.md`)
- Assistant UI → Flask routes: posts question (evidence: `README.md`)
- Flask routes → Student records: reads records (evidence: `main.py`)
- Flask routes → Chunking and retrieval: runs retrieval (evidence: `main.py`)
- Flask routes → Ollama model API: requests answer (evidence: `main.py`)
- Flask routes → Chat logs: saves conversation (evidence: `README.md`)
- Flask routes → Assistant UI: returns answer (evidence: `main.py`)
