# xiaotianfotos/opc architecture

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

- Interactive diagram: https://gitdiagram.com/xiaotianfotos/opc
- Repository: https://github.com/xiaotianfotos/opc

## Overview

OPC is a Python CLI and web dashboard for an AI-assisted personal toolchain, with capabilities spanning speech, audio, images, video, and media cutting. The clearest end-to-end workflow is the dashboard cut editor: a user submits media, the server runs ASR and saves metadata, the editor manages word-level cuts, and an export service produces downloadable video. Other CLI and dashboard capabilities are represented as distinct branches. Some links rely on SOURCE INDEX imports or documented routes; unsampled internals are not inferred.

Main entry points: [`opc-cli/scripts/opc.py`](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/opc.py) (OPC CLI), [`opc-cli/dashboard/server/src/main.js`](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/main.js) (Dashboard Views), [`opc-cli/dashboard/server/api/cut.js`](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/api/cut.js) (Cut API), [`opc-cli/dashboard/server/src/views/CutEditorView.vue`](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/views/CutEditorView.vue) (Cut Editor View)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_dashboard_ui["Dashboard UI<br/>[App.vue]"]
  node_dashboard_routes["Dashboard Views<br/>[main.js]"]
  node_docs["Docs<br/>[Docs.vue]"]
  node_landing["Landing<br/>[Landing.vue]"]
  node_model_compare["Model Compare<br/>[ModelCompare.vue]"]
  node_gallery["Gallery<br/>[Gallery.vue]"]
  node_kg_view["Knowledge Graph<br/>[KGView.vue]"]
  node_dashboard_server["Dashboard Server<br/>[server.js]"]
end

subgraph group_cut["Cut Editing"]
  node_cut_view["Cut Editor View<br/>[CutEditorView.vue]"]
  node_cut_components["Editor Components<br/>[CutEditor.vue]"]
  node_cut_store["Cut State<br/>[cut.js]"]
  node_cut_client["Cut API Client<br/>[cut.js]"]
  node_cut_server["Cut API<br/>[cut.js]"]
  node_file_service[("File Metadata<br/>[file.service.js]")]
  node_asr_service["Dashboard ASR<br/>[asr.service.js]"]
  node_valley_service["Valley Detection<br/>[valley.service.js]"]
  node_export_service["Video Export<br/>[export.service.js]"]
  node_cut_config["Workspace Config<br/>[config.js]"]
end

subgraph group_cli["CLI Media Tools"]
  node_opc_cli["OPC CLI<br/>[opc.py]"]
  node_image_tools["Image Generation<br/>[json_prompt.py]"]
  node_image_knowledge["Image Knowledge Graph<br/>[engine.py]"]
  node_video_tools["Video Generation<br/>[comfyui.py]"]
  node_video_h3["H3 Video Tools<br/>[h3.py]"]
  node_audio_tools["Audio Utilities<br/>[compressor.py]"]
  node_music_tools["Music Generation<br/>[music.py]"]
  node_cut_python["Cut Server<br/>[server.py]"]
  node_cut_analysis["Editing Analysis"]
end

subgraph group_speech["Speech"]
  node_asr_pipeline["ASR Pipeline<br/>[pipeline.py]"]
  node_qwen_asr["Qwen ASR Engine<br/>[qwen_asr_engine.py]"]
  node_subtitle_gen["Subtitle Generation<br/>[subtitle_gen.py]"]
  node_tts["Text to Speech<br/>[qwen_engine.py]"]
end

subgraph group_shared["Shared Runtime"]
  node_device_tools["Device Control<br/>[player.py]"]
end

node_user(("User"))
node_cli_user(("CLI User"))

node_user -->|"uses"| node_dashboard_ui
node_dashboard_ui -->|"renders routes"| node_dashboard_routes
node_dashboard_routes -->|"routes to"| node_docs
node_dashboard_routes -->|"routes to"| node_landing
node_dashboard_routes -->|"routes to"| node_model_compare
node_dashboard_routes -->|"routes to"| node_gallery
node_dashboard_routes -->|"routes to"| node_kg_view
node_dashboard_routes -->|"routes to"| node_cut_view
node_cut_view -->|"uses state"| node_cut_store
node_cut_view -->|"renders"| node_cut_components
node_cut_store -->|"calls"| node_cut_client
node_cut_client -->|"requests"| node_cut_server
node_dashboard_server -->|"mounts routes"| node_cut_server
node_cut_server -->|"stores metadata"| node_file_service
node_cut_server -->|"runs ASR"| node_asr_service
node_cut_server -->|"finds valleys"| node_valley_service
node_cut_server -->|"exports video"| node_export_service
node_asr_service -->|"uses workspace"| node_cut_config
node_valley_service -->|"uses workspace"| node_cut_config
node_export_service -->|"corrects cuts"| node_valley_service
node_export_service -->|"uses workspace"| node_cut_config
node_cli_user -->|"runs commands"| node_opc_cli
node_opc_cli -->|"dispatches ASR"| node_asr_pipeline
node_opc_cli -->|"uses engine"| node_qwen_asr
node_opc_cli -->|"uses subtitles"| node_subtitle_gen
node_opc_cli -->|"dispatches TTS"| node_tts
node_opc_cli -->|"dispatches image"| node_image_tools
node_opc_cli -->|"uses graph engine"| node_image_knowledge
node_opc_cli -->|"dispatches video"| node_video_tools
node_opc_cli -->|"uses video tools"| node_video_h3
node_opc_cli -->|"dispatches audio"| node_audio_tools
node_opc_cli -->|"dispatches music"| node_music_tools
node_opc_cli -->|"dispatches cutting"| node_cut_python
node_cut_python -.->|"serves cut API"| node_opc_cli
node_cut_python -.->|"analyzes media"| node_cut_analysis
node_asr_pipeline -->|"uses engine"| node_qwen_asr
node_asr_pipeline -->|"uses renderer"| node_subtitle_gen
node_opc_cli -.->|"controls devices"| node_device_tools

click node_dashboard_ui "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/App.vue"
click node_dashboard_routes "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/main.js"
click node_docs "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/views/Docs.vue"
click node_landing "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/views/Landing.vue"
click node_model_compare "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/views/ModelCompare.vue"
click node_gallery "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/views/Gallery.vue"
click node_kg_view "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/views/KGView.vue"
click node_cut_view "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/views/CutEditorView.vue"
click node_cut_components "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/components/cut/CutEditor.vue"
click node_cut_store "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/stores/cut.js"
click node_cut_client "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/api/cut.js"
click node_cut_server "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/api/cut.js"
click node_file_service "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/services/cut/file.service.js"
click node_asr_service "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/services/cut/asr.service.js"
click node_valley_service "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/services/cut/valley.service.js"
click node_export_service "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/services/cut/export.service.js"
click node_cut_config "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/services/cut/config.js"
click node_dashboard_server "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/server.js"
click node_opc_cli "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/opc.py"
click node_asr_pipeline "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/asr/pipeline.py"
click node_qwen_asr "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/asr/qwen_asr_engine.py"
click node_subtitle_gen "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/asr/subtitle_gen.py"
click node_tts "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/tts/qwen_engine.py"
click node_image_tools "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/image/json_prompt.py"
click node_image_knowledge "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/image/kg/engine.py"
click node_video_tools "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/video/comfyui.py"
click node_video_h3 "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/video/h3.py"
click node_audio_tools "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/audio/compressor.py"
click node_music_tools "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/audio/music.py"
click node_cut_python "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/cut/server.py"
click node_cut_analysis "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/cut/analyze_for_editing.py"
click node_device_tools "https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/shared/device/player.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_dashboard_ui,node_dashboard_routes,node_docs,node_landing,node_model_compare,node_gallery,node_kg_view,node_dashboard_server,node_user,node_cli_user toneBlue
class node_cut_view,node_cut_components,node_cut_store,node_cut_client,node_cut_server,node_file_service,node_asr_service,node_valley_service,node_export_service,node_cut_config toneAmber
class node_opc_cli,node_image_tools,node_image_knowledge,node_video_tools,node_video_h3,node_audio_tools,node_music_tools,node_cut_python,node_cut_analysis toneMint
class node_asr_pipeline,node_qwen_asr,node_subtitle_gen,node_tts toneRose
class node_device_tools toneIndigo
```

## Components

### Dashboard

- [Dashboard UI](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/App.vue): `opc-cli/dashboard/server/src/App.vue`
- [Dashboard Views](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/main.js): `opc-cli/dashboard/server/src/main.js`
- [Docs](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/views/Docs.vue): `opc-cli/dashboard/server/src/views/Docs.vue`
- [Landing](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/views/Landing.vue): `opc-cli/dashboard/server/src/views/Landing.vue`
- [Model Compare](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/views/ModelCompare.vue): `opc-cli/dashboard/server/src/views/ModelCompare.vue`
- [Gallery](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/views/Gallery.vue): `opc-cli/dashboard/server/src/views/Gallery.vue`
- [Knowledge Graph](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/views/KGView.vue): `opc-cli/dashboard/server/src/views/KGView.vue`
- [Dashboard Server](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/server.js): `opc-cli/dashboard/server/server.js`

### Cut Editing

- [Cut Editor View](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/views/CutEditorView.vue): `opc-cli/dashboard/server/src/views/CutEditorView.vue`
- [Editor Components](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/components/cut/CutEditor.vue): `opc-cli/dashboard/server/src/components/cut/CutEditor.vue`
- [Cut State](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/stores/cut.js): `opc-cli/dashboard/server/src/stores/cut.js`
- [Cut API Client](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/src/api/cut.js): `opc-cli/dashboard/server/src/api/cut.js`
- [Cut API](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/api/cut.js): `opc-cli/dashboard/server/api/cut.js`
- [File Metadata](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/services/cut/file.service.js): `opc-cli/dashboard/server/services/cut/file.service.js`
- [Dashboard ASR](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/services/cut/asr.service.js): `opc-cli/dashboard/server/services/cut/asr.service.js`
- [Valley Detection](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/services/cut/valley.service.js): `opc-cli/dashboard/server/services/cut/valley.service.js`
- [Video Export](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/services/cut/export.service.js): `opc-cli/dashboard/server/services/cut/export.service.js`
- [Workspace Config](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/dashboard/server/services/cut/config.js): `opc-cli/dashboard/server/services/cut/config.js`

### CLI Media Tools

- [OPC CLI](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/opc.py): `opc-cli/scripts/opc.py`
- [Image Generation](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/image/json_prompt.py): `opc-cli/scripts/image/json_prompt.py`
- [Image Knowledge Graph](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/image/kg/engine.py): `opc-cli/scripts/image/kg/engine.py`
- [Video Generation](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/video/comfyui.py): `opc-cli/scripts/video/comfyui.py`
- [H3 Video Tools](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/video/h3.py): `opc-cli/scripts/video/h3.py`
- [Audio Utilities](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/audio/compressor.py): `opc-cli/scripts/audio/compressor.py`
- [Music Generation](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/audio/music.py): `opc-cli/scripts/audio/music.py`
- [Cut Server](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/cut/server.py): `opc-cli/scripts/cut/server.py`
- [Editing Analysis](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/cut/analyze_for_editing.py): `opc-cli/scripts/cut/analyze_for_editing.py`

### Speech

- [ASR Pipeline](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/asr/pipeline.py): `opc-cli/scripts/asr/pipeline.py`
- [Qwen ASR Engine](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/asr/qwen_asr_engine.py): `opc-cli/scripts/asr/qwen_asr_engine.py`
- [Subtitle Generation](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/asr/subtitle_gen.py): `opc-cli/scripts/asr/subtitle_gen.py`
- [Text to Speech](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/tts/qwen_engine.py): `opc-cli/scripts/tts/qwen_engine.py`

### Shared Runtime

- [Device Control](https://github.com/xiaotianfotos/opc/blob/main/opc-cli/scripts/shared/device/player.py): `opc-cli/scripts/shared/device/player.py`

### Other components

- **User**
- **CLI User**

## Connections

- User → Dashboard UI: uses (evidence: `opc-cli/dashboard/server/src/App.vue`)
- Dashboard UI → Dashboard Views: renders routes (evidence: `opc-cli/dashboard/server/src/main.js`)
- Dashboard Views → Docs: routes to (evidence: `opc-cli/dashboard/server/src/main.js`)
- Dashboard Views → Landing: routes to (evidence: `opc-cli/dashboard/server/src/main.js`)
- Dashboard Views → Model Compare: routes to (evidence: `opc-cli/dashboard/server/src/main.js`)
- Dashboard Views → Gallery: routes to (evidence: `opc-cli/dashboard/server/src/main.js`)
- Dashboard Views → Knowledge Graph: routes to (evidence: `opc-cli/dashboard/server/src/main.js`)
- Dashboard Views → Cut Editor View: routes to (evidence: `opc-cli/dashboard/server/src/main.js`)
- Cut Editor View → Cut State: uses state (evidence: `opc-cli/dashboard/server/src/views/CutEditorView.vue`)
- Cut Editor View → Editor Components: renders (evidence: `opc-cli/dashboard/server/src/views/CutEditorView.vue`)
- Cut State → Cut API Client: calls (evidence: `opc-cli/dashboard/server/src/stores/cut.js`)
- Cut API Client → Cut API: requests (evidence: `opc-cli/dashboard/server/src/api/cut.js`)
- Dashboard Server → Cut API: mounts routes (evidence: `opc-cli/dashboard/server/server.js`)
- Cut API → File Metadata: stores metadata (evidence: `opc-cli/dashboard/server/api/cut.js`)
- Cut API → Dashboard ASR: runs ASR (evidence: `opc-cli/dashboard/server/api/cut.js`)
- Cut API → Valley Detection: finds valleys (evidence: `opc-cli/dashboard/server/api/cut.js`)
- Cut API → Video Export: exports video (evidence: `opc-cli/dashboard/server/api/cut.js`)
- Dashboard ASR → Workspace Config: uses workspace (evidence: `opc-cli/dashboard/server/services/cut/asr.service.js`)
- Valley Detection → Workspace Config: uses workspace (evidence: `opc-cli/dashboard/server/services/cut/valley.service.js`)
- Video Export → Valley Detection: corrects cuts (evidence: `opc-cli/dashboard/server/services/cut/export.service.js`)
- Video Export → Workspace Config: uses workspace (evidence: `opc-cli/dashboard/server/services/cut/export.service.js`)
- CLI User → OPC CLI: runs commands (evidence: `opc-cli/scripts/opc.py`)
- OPC CLI → ASR Pipeline: dispatches ASR (evidence: `opc-cli/scripts/opc.py`)
- OPC CLI → Qwen ASR Engine: uses engine (evidence: `opc-cli/scripts/opc.py`)
- OPC CLI → Subtitle Generation: uses subtitles (evidence: `opc-cli/scripts/opc.py`)
- OPC CLI → Text to Speech: dispatches TTS (evidence: `opc-cli/scripts/opc.py`)
- OPC CLI → Image Generation: dispatches image (evidence: `opc-cli/scripts/opc.py`)
- OPC CLI → Image Knowledge Graph: uses graph engine (evidence: `opc-cli/scripts/opc.py`)
- OPC CLI → Video Generation: dispatches video (evidence: `opc-cli/scripts/opc.py`)
- OPC CLI → H3 Video Tools: uses video tools (evidence: `opc-cli/scripts/opc.py`)
- OPC CLI → Audio Utilities: dispatches audio (evidence: `opc-cli/scripts/opc.py`)
- OPC CLI → Music Generation: dispatches music (evidence: `opc-cli/scripts/opc.py`)
- OPC CLI → Cut Server: dispatches cutting (evidence: `opc-cli/scripts/opc.py`)
- Cut Server → OPC CLI: serves cut API
- Cut Server → Editing Analysis: analyzes media
- ASR Pipeline → Qwen ASR Engine: uses engine (evidence: `opc-cli/scripts/asr/pipeline.py`)
- ASR Pipeline → Subtitle Generation: uses renderer (evidence: `opc-cli/scripts/asr/pipeline.py`)
- OPC CLI → Device Control: controls devices (evidence: `opc-cli/scripts/opc.py`)
