# ngan-a11y/genie architecture

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

- Interactive diagram: https://gitdiagram.com/ngan-a11y/genie
- Repository: https://github.com/ngan-a11y/genie

## Overview

Genie is a Flask-backed conversational assistant with browser chat, account access, voice features, and an analytics dashboard. The main workflow is a user sending a message from the chat UI to Flask, which applies text processing and intent handling before producing a reply and serving conversation history; the dashboard requests chat statistics and history. Model setup and training utilities are separate supporting capabilities. The README is empty, and excerpts omit much of main.py, so several implementation details and links among supporting utilities cannot be verified.

Main entry points: [`main.py`](https://github.com/ngan-a11y/genie/blob/main/main.py) (Flask API), [`model.py`](https://github.com/ngan-a11y/genie/blob/main/model.py) (ChatterBot setup), [`js/chat.js`](https://github.com/ngan-a11y/genie/blob/main/js/chat.js) (Chat UI), [`js/dashboard.js`](https://github.com/ngan-a11y/genie/blob/main/js/dashboard.js) (Analytics UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_chatui["Chat UI<br/>[chat.js]"]
  node_dashboard["Analytics UI<br/>[dashboard.js]"]
  node_loginui["Login UI<br/>[login.js]"]
end

subgraph group_backend["Chat service"]
  node_api["Flask API<br/>[main.py]"]
  node_text["Text analysis<br/>[text_processing.py]"]
  node_database[("Conversation database<br/>[genie_db.sqlite3]")]
end

subgraph group_models["Conversation models"]
  node_intent["Intent classifier<br/>[intent_model.py]"]
  node_chatbot["ChatterBot setup<br/>[model.py]"]
  node_adapters["Chat adapters<br/>[adapters.py]"]
end

subgraph group_ops["Model tools"]
  node_training["Chatbot training<br/>[training.py]"]
  node_intenttraining["Intent training<br/>[train_intent_nn.py]"]
  node_fine["Fine-tuning<br/>[finetune.py]"]
  node_export["Ollama export"]
  node_download["Model download<br/>[download_models.py]"]
  node_switch["Model switching<br/>[switch_model.py]"]
end

node_user(("User"))
node_ollama["Ollama service"]

node_user -->|"sends message"| node_chatui
node_chatui -->|"posts chat"| node_api
node_api -->|"processes text"| node_text
node_api -->|"classifies intent"| node_intent
node_api -->|"requests reply"| node_chatbot
node_api -.->|"reads and writes"| node_database
node_chatbot -->|"configures adapters"| node_adapters
node_api -->|"uses model service"| node_ollama
node_user -->|"signs in"| node_loginui
node_loginui -->|"posts credentials"| node_api
node_user -->|"views analytics"| node_dashboard
node_dashboard -->|"requests stats"| node_api
node_training -->|"gets chatbot"| node_chatbot
node_intenttraining -->|"builds classifier"| node_intent

click node_chatui "https://github.com/ngan-a11y/genie/blob/main/js/chat.js"
click node_dashboard "https://github.com/ngan-a11y/genie/blob/main/js/dashboard.js"
click node_loginui "https://github.com/ngan-a11y/genie/blob/main/js/login.js"
click node_api "https://github.com/ngan-a11y/genie/blob/main/main.py"
click node_text "https://github.com/ngan-a11y/genie/blob/main/text_processing.py"
click node_intent "https://github.com/ngan-a11y/genie/blob/main/intent_model.py"
click node_chatbot "https://github.com/ngan-a11y/genie/blob/main/model.py"
click node_adapters "https://github.com/ngan-a11y/genie/blob/main/adapters.py"
click node_database "https://github.com/ngan-a11y/genie/blob/main/genie_db.sqlite3"
click node_training "https://github.com/ngan-a11y/genie/blob/main/training.py"
click node_intenttraining "https://github.com/ngan-a11y/genie/blob/main/train_intent_nn.py"
click node_fine "https://github.com/ngan-a11y/genie/blob/main/finetune.py"
click node_export "https://github.com/ngan-a11y/genie/blob/main/export_to_ollama.py"
click node_download "https://github.com/ngan-a11y/genie/blob/main/download_models.py"
click node_switch "https://github.com/ngan-a11y/genie/blob/main/switch_model.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_chatui,node_dashboard,node_loginui,node_user toneBlue
class node_api,node_text,node_database toneAmber
class node_intent,node_chatbot,node_adapters toneMint
class node_training,node_intenttraining,node_fine,node_export,node_download,node_switch toneRose
class node_ollama toneIndigo
```

## Components

### Web experience

- [Chat UI](https://github.com/ngan-a11y/genie/blob/main/js/chat.js): `js/chat.js`
- [Analytics UI](https://github.com/ngan-a11y/genie/blob/main/js/dashboard.js): `js/dashboard.js`
- [Login UI](https://github.com/ngan-a11y/genie/blob/main/js/login.js): `js/login.js`

### Chat service

- [Flask API](https://github.com/ngan-a11y/genie/blob/main/main.py): `main.py`
- [Text analysis](https://github.com/ngan-a11y/genie/blob/main/text_processing.py): `text_processing.py`
- [Conversation database](https://github.com/ngan-a11y/genie/blob/main/genie_db.sqlite3): `genie_db.sqlite3`

### Conversation models

- [Intent classifier](https://github.com/ngan-a11y/genie/blob/main/intent_model.py): `intent_model.py`
- [ChatterBot setup](https://github.com/ngan-a11y/genie/blob/main/model.py): `model.py`
- [Chat adapters](https://github.com/ngan-a11y/genie/blob/main/adapters.py): `adapters.py`

### Model tools

- [Chatbot training](https://github.com/ngan-a11y/genie/blob/main/training.py): `training.py`
- [Intent training](https://github.com/ngan-a11y/genie/blob/main/train_intent_nn.py): `train_intent_nn.py`
- [Fine-tuning](https://github.com/ngan-a11y/genie/blob/main/finetune.py): `finetune.py`
- [Ollama export](https://github.com/ngan-a11y/genie/blob/main/export_to_ollama.py): `export_to_ollama.py`
- [Model download](https://github.com/ngan-a11y/genie/blob/main/download_models.py): `download_models.py`
- [Model switching](https://github.com/ngan-a11y/genie/blob/main/switch_model.py): `switch_model.py`

### Other components

- **User**
- **Ollama service**

## Connections

- User → Chat UI: sends message (evidence: `js/chat.js`)
- Chat UI → Flask API: posts chat (evidence: `js/chat.js`)
- Flask API → Text analysis: processes text (evidence: `main.py`)
- Flask API → Intent classifier: classifies intent (evidence: `main.py`)
- Flask API → ChatterBot setup: requests reply (evidence: `main.py`)
- Flask API → Conversation database: reads and writes
- ChatterBot setup → Chat adapters: configures adapters (evidence: `model.py`)
- Flask API → Ollama service: uses model service (evidence: `main.py`)
- User → Login UI: signs in (evidence: `js/login.js`)
- Login UI → Flask API: posts credentials (evidence: `js/login.js`)
- User → Analytics UI: views analytics (evidence: `js/dashboard.js`)
- Analytics UI → Flask API: requests stats (evidence: `js/dashboard.js`)
- Chatbot training → ChatterBot setup: gets chatbot (evidence: `training.py`)
- Intent training → Intent classifier: builds classifier (evidence: `train_intent_nn.py`)
