# huankechong/qwenlivetranslate architecture

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

- Interactive diagram: https://gitdiagram.com/huankechong/qwenlivetranslate
- Repository: https://github.com/huankechong/qwenlivetranslate

## Overview

Qwen LiveTranslate is a Windows desktop live-caption translator. The main flow is console configuration and start → microphone or system-loopback capture → session controller and engine → streamed or separated ASR/translation → bilingual overlay, with completed sentences also available in local history. The graph includes the documented provider choices, vocabulary, appearance, and persistence features. Relationships for unsampled UI and storage details rely on README or SOURCE INDEX references; uncertain implementation links are omitted.

Main entry points: [`console.py`](https://github.com/huankechong/qwenlivetranslate/blob/master/console.py) (Control Console), [`controller.py`](https://github.com/huankechong/qwenlivetranslate/blob/master/controller.py) (Session Controller), [`providers/__init__.py`](https://github.com/huankechong/qwenlivetranslate/blob/master/providers/__init__.py) (Engine Factory), [`providers/asr/http_batch.py`](https://github.com/huankechong/qwenlivetranslate/blob/master/providers/asr/http_batch.py) (Batch ASR)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop UI"]
  node_console["Control Console<br/>[console.py]"]
  node_overlay["Caption Overlay<br/>[overlay.py]"]
  node_theme["Theme Engine<br/>[theme.py]"]
  node_history_view["History Window<br/>[history_view.py]"]
  node_vocab_view["Vocabulary Window<br/>[vocab_view.py]"]
end

subgraph group_session["Audio Session"]
  node_controller["Session Controller<br/>[controller.py]"]
  node_capture["Audio Capture<br/>[capture.py]"]
  node_engine_io["Audio Push Loop<br/>[engine_io.py]"]
end

subgraph group_engines["Speech Engines"]
  node_engine_factory["Engine Factory<br/>[__init__.py]"]
  node_registry["Provider Registry<br/>[registry.py]"]
  node_engine_api["Engine Interface<br/>[base.py]"]
  node_qwen["Qwen Engine"]
  node_realtime["Realtime Client<br/>[realtime_client.py]"]
  node_vad["VAD Segmenter<br/>[vad.py]"]
  node_asr["Batch ASR<br/>[http_batch.py]"]
  node_pipeline["Separated Pipeline<br/>[pipeline.py]"]
  node_worker["Translation Worker"]
  node_translator["Chat Translator<br/>[openai_compat.py]"]
end

subgraph group_data["Local Features"]
  node_settings[("User Settings<br/>[settings.py]")]
  node_history[("Translation History<br/>[history.py]")]
  node_vocabulary[("Vocabulary Store<br/>[vocabulary.py]")]
end

node_user(("User"))
node_audio_sources(("Mic / Loopback"))
node_dashscope{{"DashScope API"}}
node_provider_apis{{"ASR / MT APIs"}}

node_user -->|"configures and starts"| node_console
node_console -->|"starts session"| node_controller
node_console -->|"controls captions"| node_overlay
node_console -->|"opens history"| node_history_view
node_console -->|"opens vocabulary"| node_vocab_view
node_console -->|"saves preferences"| node_settings
node_console -->|"uses styling"| node_theme
node_overlay -->|"uses styling"| node_theme
node_audio_sources -->|"provides audio"| node_capture
node_controller -->|"starts and stops"| node_capture
node_controller -->|"builds engine"| node_engine_factory
node_controller -->|"starts push loop"| node_engine_io
node_capture -->|"provides audio frames"| node_engine_io
node_engine_io -->|"pushes audio"| node_engine_api
node_engine_factory -->|"resolves providers"| node_registry
node_engine_factory -->|"builds integrated engine"| node_qwen
node_engine_factory -->|"builds separated engine"| node_pipeline
node_qwen -->|"uses protocol client"| node_realtime
node_realtime -->|"streams audio and text"| node_dashscope
node_pipeline -->|"connects and pushes audio"| node_asr
node_asr -->|"segments speech"| node_vad
node_asr -->|"requests transcription"| node_provider_apis
node_pipeline -->|"submits recognized text"| node_worker
node_worker -->|"translates queued text"| node_translator
node_translator -->|"requests translation"| node_provider_apis
node_engine_api -.->|"delivers caption callbacks"| node_overlay
node_history_view -->|"reads and exports"| node_history
node_console -->|"records final sentences"| node_history
node_vocab_view -->|"reads and edits"| node_vocabulary
node_settings -.->|"provides storage settings"| node_history

click node_console "https://github.com/huankechong/qwenlivetranslate/blob/master/console.py"
click node_overlay "https://github.com/huankechong/qwenlivetranslate/blob/master/overlay.py"
click node_theme "https://github.com/huankechong/qwenlivetranslate/blob/master/theme.py"
click node_controller "https://github.com/huankechong/qwenlivetranslate/blob/master/controller.py"
click node_capture "https://github.com/huankechong/qwenlivetranslate/blob/master/capture.py"
click node_engine_io "https://github.com/huankechong/qwenlivetranslate/blob/master/providers/engine_io.py"
click node_engine_factory "https://github.com/huankechong/qwenlivetranslate/blob/master/providers/__init__.py"
click node_registry "https://github.com/huankechong/qwenlivetranslate/blob/master/providers/registry.py"
click node_engine_api "https://github.com/huankechong/qwenlivetranslate/blob/master/providers/base.py"
click node_qwen "https://github.com/huankechong/qwenlivetranslate/blob/master/providers/qwen_livetranslate.py"
click node_realtime "https://github.com/huankechong/qwenlivetranslate/blob/master/realtime_client.py"
click node_vad "https://github.com/huankechong/qwenlivetranslate/blob/master/providers/vad.py"
click node_asr "https://github.com/huankechong/qwenlivetranslate/blob/master/providers/asr/http_batch.py"
click node_pipeline "https://github.com/huankechong/qwenlivetranslate/blob/master/providers/pipeline.py"
click node_worker "https://github.com/huankechong/qwenlivetranslate/blob/master/providers/translation_worker.py"
click node_translator "https://github.com/huankechong/qwenlivetranslate/blob/master/providers/mt/openai_compat.py"
click node_settings "https://github.com/huankechong/qwenlivetranslate/blob/master/settings.py"
click node_history "https://github.com/huankechong/qwenlivetranslate/blob/master/history.py"
click node_history_view "https://github.com/huankechong/qwenlivetranslate/blob/master/history_view.py"
click node_vocabulary "https://github.com/huankechong/qwenlivetranslate/blob/master/vocabulary.py"
click node_vocab_view "https://github.com/huankechong/qwenlivetranslate/blob/master/vocab_view.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_console,node_overlay,node_theme,node_history_view,node_vocab_view,node_user toneBlue
class node_controller,node_capture,node_engine_io toneAmber
class node_engine_factory,node_registry,node_engine_api,node_qwen,node_realtime,node_vad,node_asr,node_pipeline,node_worker,node_translator,node_dashscope,node_provider_apis toneMint
class node_settings,node_history,node_vocabulary toneRose
class node_audio_sources toneIndigo
```

## Components

### Desktop UI

- [Control Console](https://github.com/huankechong/qwenlivetranslate/blob/master/console.py): `console.py`
- [Caption Overlay](https://github.com/huankechong/qwenlivetranslate/blob/master/overlay.py): `overlay.py`
- [Theme Engine](https://github.com/huankechong/qwenlivetranslate/blob/master/theme.py): `theme.py`
- [History Window](https://github.com/huankechong/qwenlivetranslate/blob/master/history_view.py): `history_view.py`
- [Vocabulary Window](https://github.com/huankechong/qwenlivetranslate/blob/master/vocab_view.py): `vocab_view.py`

### Audio Session

- [Session Controller](https://github.com/huankechong/qwenlivetranslate/blob/master/controller.py): `controller.py`
- [Audio Capture](https://github.com/huankechong/qwenlivetranslate/blob/master/capture.py): `capture.py`
- [Audio Push Loop](https://github.com/huankechong/qwenlivetranslate/blob/master/providers/engine_io.py): `providers/engine_io.py`

### Speech Engines

- [Engine Factory](https://github.com/huankechong/qwenlivetranslate/blob/master/providers/__init__.py): `providers/__init__.py`
- [Provider Registry](https://github.com/huankechong/qwenlivetranslate/blob/master/providers/registry.py): `providers/registry.py`
- [Engine Interface](https://github.com/huankechong/qwenlivetranslate/blob/master/providers/base.py): `providers/base.py`
- [Qwen Engine](https://github.com/huankechong/qwenlivetranslate/blob/master/providers/qwen_livetranslate.py): `providers/qwen_livetranslate.py`
- [Realtime Client](https://github.com/huankechong/qwenlivetranslate/blob/master/realtime_client.py): `realtime_client.py`
- [VAD Segmenter](https://github.com/huankechong/qwenlivetranslate/blob/master/providers/vad.py): `providers/vad.py`
- [Batch ASR](https://github.com/huankechong/qwenlivetranslate/blob/master/providers/asr/http_batch.py): `providers/asr/http_batch.py`
- [Separated Pipeline](https://github.com/huankechong/qwenlivetranslate/blob/master/providers/pipeline.py): `providers/pipeline.py`
- [Translation Worker](https://github.com/huankechong/qwenlivetranslate/blob/master/providers/translation_worker.py): `providers/translation_worker.py`
- [Chat Translator](https://github.com/huankechong/qwenlivetranslate/blob/master/providers/mt/openai_compat.py): `providers/mt/openai_compat.py`

### Local Features

- [User Settings](https://github.com/huankechong/qwenlivetranslate/blob/master/settings.py): `settings.py`
- [Translation History](https://github.com/huankechong/qwenlivetranslate/blob/master/history.py): `history.py`
- [Vocabulary Store](https://github.com/huankechong/qwenlivetranslate/blob/master/vocabulary.py): `vocabulary.py`

### Other components

- **User**
- **Mic / Loopback**
- **DashScope API**
- **ASR / MT APIs**

## Connections

- User → Control Console: configures and starts (evidence: `README.md`)
- Control Console → Session Controller: starts session (evidence: `console.py`)
- Control Console → Caption Overlay: controls captions (evidence: `console.py`)
- Control Console → History Window: opens history (evidence: `README.md`)
- Control Console → Vocabulary Window: opens vocabulary (evidence: `console.py`)
- Control Console → User Settings: saves preferences (evidence: `README.md`)
- Control Console → Theme Engine: uses styling (evidence: `console.py`)
- Caption Overlay → Theme Engine: uses styling (evidence: `overlay.py`)
- Mic / Loopback → Audio Capture: provides audio (evidence: `README.md`)
- Session Controller → Audio Capture: starts and stops (evidence: `controller.py`)
- Session Controller → Engine Factory: builds engine (evidence: `controller.py`)
- Session Controller → Audio Push Loop: starts push loop (evidence: `controller.py`)
- Audio Capture → Audio Push Loop: provides audio frames (evidence: `providers/engine_io.py`)
- Audio Push Loop → Engine Interface: pushes audio (evidence: `providers/engine_io.py`)
- Engine Factory → Provider Registry: resolves providers (evidence: `providers/__init__.py`)
- Engine Factory → Qwen Engine: builds integrated engine (evidence: `providers/__init__.py`)
- Engine Factory → Separated Pipeline: builds separated engine (evidence: `providers/__init__.py`)
- Qwen Engine → Realtime Client: uses protocol client (evidence: `providers/qwen_livetranslate.py`)
- Realtime Client → DashScope API: streams audio and text (evidence: `README.md`)
- Separated Pipeline → Batch ASR: connects and pushes audio (evidence: `providers/pipeline.py`)
- Batch ASR → VAD Segmenter: segments speech (evidence: `providers/asr/http_batch.py`)
- Batch ASR → ASR / MT APIs: requests transcription (evidence: `providers/asr/http_batch.py`)
- Separated Pipeline → Translation Worker: submits recognized text (evidence: `providers/pipeline.py`)
- Translation Worker → Chat Translator: translates queued text (evidence: `providers/translation_worker.py`)
- Chat Translator → ASR / MT APIs: requests translation (evidence: `providers/mt/openai_compat.py`)
- Engine Interface → Caption Overlay: delivers caption callbacks
- History Window → Translation History: reads and exports (evidence: `history_view.py`)
- Control Console → Translation History: records final sentences (evidence: `README.md`)
- Vocabulary Window → Vocabulary Store: reads and edits (evidence: `vocab_view.py`)
- User Settings → Translation History: provides storage settings (evidence: `history.py`)
