# 0llrayll0/luna-ml-chatter architecture

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

- Interactive diagram: https://gitdiagram.com/0llrayll0/luna-ml-chatter
- Repository: https://github.com/0llrayll0/luna-ml-chatter

## Overview

Luna is a Portuguese voice-controlled desktop assistant. Its main loop listens for commands, dispatches recognized commands to desktop actions or a conversation loop, and exits on a spoken request. The conversation loop translates Portuguese input to English, generates a response, translates it back, and speaks it. Other documented-in-code capabilities include screen OCR and launching desktop applications. The repository exposes only luna.py as runtime source; edges are limited to calls visible in that excerpt.

Main entry points: [`luna.py`](https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py) (Conversation loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Voice control"]
  node_main_loop["Main loop<br/>[luna.py]"]
  node_voice_input["Voice input<br/>[luna.py]"]
  node_command_router["Command router<br/>[luna.py]"]
end

subgraph group_conversation["Conversation"]
  node_conversation_loop["Conversation loop<br/>[luna.py]"]
  node_translation["Translation<br/>[luna.py]"]
  node_text_generator["Text generator<br/>[luna.py]"]
  node_speech_output["Speech output<br/>[luna.py]"]
end

subgraph group_desktop["Desktop actions"]
  node_desktop_apps["Desktop applications"]
  node_screen_capture["Screen capture<br/>[luna.py]"]
  node_ocr["Tesseract OCR"]
end

node_user(("User"))
node_speech_service["Google speech"]

node_user -->|"speaks commands"| node_main_loop
node_main_loop -->|"calls"| node_voice_input
node_voice_input -->|"recognizes speech"| node_speech_service
node_main_loop -->|"dispatches command"| node_command_router
node_command_router -->|"starts conversation"| node_conversation_loop
node_conversation_loop -->|"listens again"| node_voice_input
node_conversation_loop -->|"translates input"| node_translation
node_conversation_loop -->|"generates response"| node_text_generator
node_conversation_loop -->|"translates response"| node_translation
node_conversation_loop -->|"speaks response"| node_speech_output
node_command_router -->|"speaks prompt"| node_speech_output
node_command_router -->|"opens applications"| node_desktop_apps
node_command_router -->|"reads screen"| node_screen_capture
node_screen_capture -->|"extracts text"| node_ocr
node_screen_capture -->|"speaks extracted text"| node_speech_output

click node_main_loop "https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py"
click node_voice_input "https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py"
click node_command_router "https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py"
click node_conversation_loop "https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py"
click node_translation "https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py"
click node_text_generator "https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py"
click node_speech_output "https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py"
click node_screen_capture "https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.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_main_loop,node_voice_input,node_command_router,node_user toneBlue
class node_conversation_loop,node_translation,node_text_generator,node_speech_output toneAmber
class node_desktop_apps,node_screen_capture,node_ocr toneMint
class node_speech_service toneIndigo
```

## Components

### Voice control

- [Main loop](https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py): `luna.py`
- [Voice input](https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py): `luna.py`
- [Command router](https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py): `luna.py`

### Conversation

- [Conversation loop](https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py): `luna.py`
- [Translation](https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py): `luna.py`
- [Text generator](https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py): `luna.py`
- [Speech output](https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py): `luna.py`

### Desktop actions

- **Desktop applications**
- [Screen capture](https://github.com/0llrayll0/luna-ml-chatter/blob/main/luna.py): `luna.py`
- **Tesseract OCR**

### Other components

- **User**
- **Google speech**

## Connections

- User → Main loop: speaks commands (evidence: `luna.py`)
- Main loop → Voice input: calls (evidence: `luna.py`)
- Voice input → Google speech: recognizes speech (evidence: `luna.py`)
- Main loop → Command router: dispatches command (evidence: `luna.py`)
- Command router → Conversation loop: starts conversation (evidence: `luna.py`)
- Conversation loop → Voice input: listens again (evidence: `luna.py`)
- Conversation loop → Translation: translates input (evidence: `luna.py`)
- Conversation loop → Text generator: generates response (evidence: `luna.py`)
- Conversation loop → Translation: translates response (evidence: `luna.py`)
- Conversation loop → Speech output: speaks response (evidence: `luna.py`)
- Command router → Speech output: speaks prompt (evidence: `luna.py`)
- Command router → Desktop applications: opens applications (evidence: `luna.py`)
- Command router → Screen capture: reads screen (evidence: `luna.py`)
- Screen capture → Tesseract OCR: extracts text (evidence: `luna.py`)
- Screen capture → Speech output: speaks extracted text (evidence: `luna.py`)
