# jwchoikr/ai_builder_cup_uh architecture

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

- Interactive diagram: https://gitdiagram.com/jwchoikr/ai_builder_cup_uh
- Repository: https://github.com/jwchoikr/ai_builder_cup_uh

## Overview

Live Studio is a real-time live-commerce compliance and fact-checking copilot. Before a show, an operator uploads product and regulation documents and approves the extracted product information. During the show, host audio is transcribed and judged for regulatory claims, product facts, context and prompter progress; the host sees correction guidance, while comments can be screened, triaged and answered or sent to an operator. Afterward, the system produces an AI recap. The graph preserves the documented operator, host and viewer surfaces and runtime state services. Several backend subsystems are represented at directory level because their implementations were not excerpted; arrows reflect README statements, not inferred calls.

Main entry points: [`backend/app/pipelines/utterances.py`](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/pipelines/utterances.py) (Utterance judging), [`backend/app/pipelines/runtime.py`](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/pipelines/runtime.py) (Session runtime), [`backend/app/api`](https://github.com/jwchoikr/ai_builder_cup_uh/tree/main/backend/app/api) (API and events), [`backend/app/agents`](https://github.com/jwchoikr/ai_builder_cup_uh/tree/main/backend/app/agents) (Compliance and fact judges)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Show preparation"]
  node_onboarding_ui["Document onboarding<br/>[Onboarding.tsx]"]
  node_onboarding_api["Onboarding processing"]
  node_release_storage[("Approved releases<br/>[storage.py]")]
  node_session_setup["Session setup<br/>[sessions.py]"]
end

subgraph group_runtime["Live show runtime"]
  node_host_audio["Host audio<br/>[audio_ws.py]"]
  node_speech["Speech recognition<br/>[stt.py]"]
  node_utterance_flow["Utterance judging<br/>[utterances.py]"]
  node_judges["Compliance and fact judges"]
  node_catalog["Product and rule catalog<br/>[catalog.py]"]
  node_show_runtime["Session runtime<br/>[runtime.py]"]
  node_comments["Comment handling<br/>[comments.py]"]
  node_recap["Show recap<br/>[summary.py]"]
end

subgraph group_interfaces["Show interfaces"]
  node_host_ui["Host screen<br/>[HostScreen.tsx]"]
  node_operator_ui["Operator console<br/>[OperatorScreen.tsx]"]
  node_viewer_ui["Viewer screen<br/>[ViewerView.tsx]"]
  node_summary_ui["Summary screen<br/>[SummaryView.tsx]"]
end

subgraph group_services["Runtime services"]
  node_api["API and events"]
  node_store[("Show state store")]
  node_llm["Gemini provider<br/>[llm.py]"]
  node_retriever["Document retrieval<br/>[retriever.py]"]
end

node_operator(("Operator"))
node_host(("Host"))
node_viewers(("Viewers"))

node_operator -->|"uploads documents"| node_onboarding_ui
node_onboarding_ui -->|"submits documents"| node_onboarding_api
node_onboarding_api -->|"stores approvals"| node_release_storage
node_operator -->|"starts show"| node_session_setup
node_session_setup -->|"creates session"| node_show_runtime
node_host -->|"speaks into mic"| node_host_audio
node_host_audio -->|"streams audio"| node_speech
node_speech -->|"transcribes lines"| node_utterance_flow
node_utterance_flow -->|"judges in parallel"| node_judges
node_utterance_flow -->|"checks product facts"| node_catalog
node_judges -->|"requests judgments"| node_llm
node_judges -.->|"retrieves documents"| node_retriever
node_utterance_flow -.->|"updates show state"| node_show_runtime
node_show_runtime -->|"reads and writes state"| node_store
node_show_runtime -.->|"publishes show state"| node_api
node_utterance_flow -->|"sends correction guidance"| node_host_ui
node_utterance_flow -->|"ticks prompter"| node_host_ui
node_viewers -->|"send comments"| node_comments
node_comments -->|"routes questions"| node_operator_ui
node_comments -->|"answers comments"| node_viewers
node_operator -->|"monitors show"| node_operator_ui
node_viewers -.->|"watch show"| node_viewer_ui
node_show_runtime -->|"builds recap"| node_recap
node_recap -.->|"provides recap"| node_summary_ui
node_host_ui -.->|"uses show API"| node_api
node_operator_ui -.->|"uses show API"| node_api
node_viewer_ui -.->|"uses show API"| node_api

click node_onboarding_ui "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/frontend/src/screens/Onboarding.tsx"
click node_onboarding_api "https://github.com/jwchoikr/ai_builder_cup_uh/tree/main/backend/app/onboarding"
click node_release_storage "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/onboarding/storage.py"
click node_session_setup "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/api/sessions.py"
click node_host_audio "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/api/audio_ws.py"
click node_speech "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/providers/stt.py"
click node_utterance_flow "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/pipelines/utterances.py"
click node_judges "https://github.com/jwchoikr/ai_builder_cup_uh/tree/main/backend/app/agents"
click node_catalog "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/logic/catalog.py"
click node_show_runtime "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/pipelines/runtime.py"
click node_comments "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/pipelines/comments.py"
click node_recap "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/pipelines/summary.py"
click node_host_ui "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/frontend/src/screens/host/HostScreen.tsx"
click node_operator_ui "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/frontend/src/screens/operator/OperatorScreen.tsx"
click node_viewer_ui "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/frontend/src/screens/viewer/ViewerView.tsx"
click node_summary_ui "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/frontend/src/screens/summary/SummaryView.tsx"
click node_api "https://github.com/jwchoikr/ai_builder_cup_uh/tree/main/backend/app/api"
click node_store "https://github.com/jwchoikr/ai_builder_cup_uh/tree/main/backend/app/store"
click node_llm "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/providers/llm.py"
click node_retriever "https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/providers/retriever.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_onboarding_ui,node_onboarding_api,node_release_storage,node_session_setup,node_viewers toneBlue
class node_host_audio,node_speech,node_utterance_flow,node_judges,node_catalog,node_show_runtime,node_comments,node_recap toneAmber
class node_host_ui,node_operator_ui,node_viewer_ui,node_summary_ui toneMint
class node_api,node_store,node_llm,node_retriever toneRose
class node_operator,node_host toneIndigo
```

## Components

### Show preparation

- [Document onboarding](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/frontend/src/screens/Onboarding.tsx): `frontend/src/screens/Onboarding.tsx`
- [Onboarding processing](https://github.com/jwchoikr/ai_builder_cup_uh/tree/main/backend/app/onboarding): `backend/app/onboarding`
- [Approved releases](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/onboarding/storage.py): `backend/app/onboarding/storage.py`
- [Session setup](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/api/sessions.py): `backend/app/api/sessions.py`

### Live show runtime

- [Host audio](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/api/audio_ws.py): `backend/app/api/audio_ws.py`
- [Speech recognition](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/providers/stt.py): `backend/app/providers/stt.py`
- [Utterance judging](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/pipelines/utterances.py): `backend/app/pipelines/utterances.py`
- [Compliance and fact judges](https://github.com/jwchoikr/ai_builder_cup_uh/tree/main/backend/app/agents): `backend/app/agents`
- [Product and rule catalog](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/logic/catalog.py): `backend/app/logic/catalog.py`
- [Session runtime](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/pipelines/runtime.py): `backend/app/pipelines/runtime.py`
- [Comment handling](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/pipelines/comments.py): `backend/app/pipelines/comments.py`
- [Show recap](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/pipelines/summary.py): `backend/app/pipelines/summary.py`

### Show interfaces

- [Host screen](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/frontend/src/screens/host/HostScreen.tsx): `frontend/src/screens/host/HostScreen.tsx`
- [Operator console](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/frontend/src/screens/operator/OperatorScreen.tsx): `frontend/src/screens/operator/OperatorScreen.tsx`
- [Viewer screen](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/frontend/src/screens/viewer/ViewerView.tsx): `frontend/src/screens/viewer/ViewerView.tsx`
- [Summary screen](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/frontend/src/screens/summary/SummaryView.tsx): `frontend/src/screens/summary/SummaryView.tsx`

### Runtime services

- [API and events](https://github.com/jwchoikr/ai_builder_cup_uh/tree/main/backend/app/api): `backend/app/api`
- [Show state store](https://github.com/jwchoikr/ai_builder_cup_uh/tree/main/backend/app/store): `backend/app/store`
- [Gemini provider](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/providers/llm.py): `backend/app/providers/llm.py`
- [Document retrieval](https://github.com/jwchoikr/ai_builder_cup_uh/blob/main/backend/app/providers/retriever.py): `backend/app/providers/retriever.py`

### Other components

- **Operator**
- **Host**
- **Viewers**

## Connections

- Operator → Document onboarding: uploads documents (evidence: `README.md`)
- Document onboarding → Onboarding processing: submits documents (evidence: `frontend/src/screens/Onboarding.tsx`)
- Onboarding processing → Approved releases: stores approvals (evidence: `backend/app/onboarding/storage.py`)
- Operator → Session setup: starts show (evidence: `README.md`)
- Session setup → Session runtime: creates session (evidence: `backend/app/api/sessions.py`)
- Host → Host audio: speaks into mic (evidence: `README.md`)
- Host audio → Speech recognition: streams audio (evidence: `README.md`)
- Speech recognition → Utterance judging: transcribes lines (evidence: `README.md`)
- Utterance judging → Compliance and fact judges: judges in parallel (evidence: `README.md`)
- Utterance judging → Product and rule catalog: checks product facts (evidence: `README.md`)
- Compliance and fact judges → Gemini provider: requests judgments (evidence: `backend/app/agents/utterance_judge.py`)
- Compliance and fact judges → Document retrieval: retrieves documents
- Utterance judging → Session runtime: updates show state (evidence: `backend/app/pipelines/runtime.py`)
- Session runtime → Show state store: reads and writes state (evidence: `backend/app/pipelines/runtime.py`)
- Session runtime → API and events: publishes show state (evidence: `backend/app/api/sessions.py`)
- Utterance judging → Host screen: sends correction guidance (evidence: `README.md`)
- Utterance judging → Host screen: ticks prompter (evidence: `README.md`)
- Viewers → Comment handling: send comments (evidence: `README.md`)
- Comment handling → Operator console: routes questions (evidence: `README.md`)
- Comment handling → Viewers: answers comments (evidence: `README.md`)
- Operator → Operator console: monitors show (evidence: `README.md`)
- Viewers → Viewer screen: watch show
- Session runtime → Show recap: builds recap (evidence: `backend/app/pipelines/runtime.py`)
- Show recap → Summary screen: provides recap
- Host screen → API and events: uses show API
- Operator console → API and events: uses show API
- Viewer screen → API and events: uses show API
