# hasanpp/aivoiceboat architecture

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

- Interactive diagram: https://gitdiagram.com/hasanpp/aivoiceboat
- Repository: https://github.com/hasanpp/aivoiceboat

## Overview

AI Voice Bot is a Django voice assistant: users record or submit text in a browser, the WebSocket consumer handles the interaction, and the response is returned as text and audio. Audio input is transcribed through AssemblyAI, responses are generated with Groq, and speech output currently uses gTTS; conversation messages are persisted in SQLite. The README also documents ElevenLabs as a TTS option, but the sampled consumer does not invoke it. UI behavior and some subsystem wiring are documented rather than fully shown in source.

Main entry points: [`voice_bot/consumers.py`](https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/consumers.py) (Voice consumer), [`voice_bot/templates/voice_bot/index.html`](https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/templates/voice_bot/index.html) (Voice chat page), [`voice_bot/views.py`](https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/views.py) (Page view), [`voice_bot/urls.py`](https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/urls.py) (HTTP routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_webpage["Voice chat page<br/>[index.html]"]
  node_page_view["Page view<br/>[views.py]"]
  node_http_routes["HTTP routes<br/>[urls.py]"]
end

subgraph group_realtime["Realtime handling"]
  node_asgi["ASGI router<br/>[asgi.py]"]
  node_ws_routes["WebSocket route<br/>[routing.py]"]
  node_consumer["Voice consumer<br/>[consumers.py]"]
  node_settings["App settings<br/>[settings.py]"]
end

subgraph group_conversation["Conversation services"]
  node_transcription["Speech transcription<br/>[consumers.py]"]
  node_ai_generation["AI response<br/>[consumers.py]"]
  node_speech_output["Speech output<br/>[consumers.py]"]
end

subgraph group_state["Conversation state"]
  node_models["Conversation models<br/>[models.py]"]
  node_sqlite[("SQLite database<br/>[db.sqlite3]")]
end

node_user(("Browser user"))
node_assemblyai["AssemblyAI"]
node_groq["Groq AI"]
node_gtts["gTTS"]
node_elevenlabs["ElevenLabs TTS"]

node_user -->|"uses"| node_webpage
node_webpage -->|"requests page"| node_http_routes
node_http_routes -->|"routes to"| node_page_view
node_page_view -->|"renders"| node_webpage
node_webpage -->|"opens WebSocket"| node_asgi
node_asgi -->|"dispatches to"| node_ws_routes
node_ws_routes -->|"routes to"| node_consumer
node_consumer -->|"transcribes audio"| node_transcription
node_transcription -->|"uploads and polls"| node_assemblyai
node_consumer -->|"requests response"| node_ai_generation
node_ai_generation -->|"generates reply"| node_groq
node_consumer -->|"converts reply"| node_speech_output
node_speech_output -->|"generates audio"| node_gtts
node_speech_output -.->|"optional TTS"| node_elevenlabs
node_consumer -->|"reads and writes"| node_models
node_models -.->|"persists records"| node_sqlite
node_settings -->|"configures database"| node_sqlite

click node_webpage "https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/templates/voice_bot/index.html"
click node_page_view "https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/views.py"
click node_http_routes "https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/urls.py"
click node_asgi "https://github.com/hasanpp/aivoiceboat/blob/main/AiVoiceBot/asgi.py"
click node_ws_routes "https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/routing.py"
click node_consumer "https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/consumers.py"
click node_transcription "https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/consumers.py"
click node_ai_generation "https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/consumers.py"
click node_speech_output "https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/consumers.py"
click node_models "https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/models.py"
click node_sqlite "https://github.com/hasanpp/aivoiceboat/blob/main/db.sqlite3"
click node_settings "https://github.com/hasanpp/aivoiceboat/blob/main/AiVoiceBot/settings.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_webpage,node_page_view,node_http_routes,node_user toneBlue
class node_asgi,node_ws_routes,node_consumer,node_settings toneAmber
class node_transcription,node_ai_generation,node_speech_output toneMint
class node_models,node_sqlite toneRose
class node_assemblyai,node_groq,node_gtts,node_elevenlabs toneIndigo
```

## Components

### User interface

- [Voice chat page](https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/templates/voice_bot/index.html): `voice_bot/templates/voice_bot/index.html`
- [Page view](https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/views.py): `voice_bot/views.py`
- [HTTP routes](https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/urls.py): `voice_bot/urls.py`

### Realtime handling

- [ASGI router](https://github.com/hasanpp/aivoiceboat/blob/main/AiVoiceBot/asgi.py): `AiVoiceBot/asgi.py`
- [WebSocket route](https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/routing.py): `voice_bot/routing.py`
- [Voice consumer](https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/consumers.py): `voice_bot/consumers.py`
- [App settings](https://github.com/hasanpp/aivoiceboat/blob/main/AiVoiceBot/settings.py): `AiVoiceBot/settings.py`

### Conversation services

- [Speech transcription](https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/consumers.py): `voice_bot/consumers.py`
- [AI response](https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/consumers.py): `voice_bot/consumers.py`
- [Speech output](https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/consumers.py): `voice_bot/consumers.py`

### Conversation state

- [Conversation models](https://github.com/hasanpp/aivoiceboat/blob/main/voice_bot/models.py): `voice_bot/models.py`
- [SQLite database](https://github.com/hasanpp/aivoiceboat/blob/main/db.sqlite3): `db.sqlite3`

### Other components

- **Browser user**
- **AssemblyAI**
- **Groq AI**
- **gTTS**
- **ElevenLabs TTS**

## Connections

- Browser user → Voice chat page: uses (evidence: `Readme.md`)
- Voice chat page → HTTP routes: requests page (evidence: `Readme.md`)
- HTTP routes → Page view: routes to (evidence: `voice_bot/urls.py`)
- Page view → Voice chat page: renders (evidence: `voice_bot/views.py`)
- Voice chat page → ASGI router: opens WebSocket (evidence: `Readme.md`)
- ASGI router → WebSocket route: dispatches to (evidence: `AiVoiceBot/asgi.py`)
- WebSocket route → Voice consumer: routes to (evidence: `voice_bot/routing.py`)
- Voice consumer → Speech transcription: transcribes audio (evidence: `voice_bot/consumers.py`)
- Speech transcription → AssemblyAI: uploads and polls (evidence: `voice_bot/consumers.py`)
- Voice consumer → AI response: requests response (evidence: `voice_bot/consumers.py`)
- AI response → Groq AI: generates reply (evidence: `voice_bot/consumers.py`)
- Voice consumer → Speech output: converts reply (evidence: `voice_bot/consumers.py`)
- Speech output → gTTS: generates audio (evidence: `voice_bot/consumers.py`)
- Speech output → ElevenLabs TTS: optional TTS (evidence: `Readme.md`)
- Voice consumer → Conversation models: reads and writes (evidence: `voice_bot/consumers.py`)
- Conversation models → SQLite database: persists records
- App settings → SQLite database: configures database (evidence: `AiVoiceBot/settings.py`)
