# 23swccp/dgut-bot architecture

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

- Interactive diagram: https://gitdiagram.com/23swccp/dgut-bot
- Repository: https://github.com/23swccp/dgut-bot

## Overview

莞工小皮卡 is a Windows desktop assistant for Youxueyuan courses. The main workflow is to launch its managed Chromium browser, restore or complete login, then monitor course sign-ins or scan/select and assist with courseware; separate workflows cover homework reviews and independent identity verification. The local web UI sends commands through the backend, which coordinates platform requests and browser actions. The README documents more capabilities than the sampled excerpts expose; connections for those branches are included only where the README or indexed references support them.

Main entry points: [`backend/src/dgutbot/app/commands.py`](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/app/commands.py) (Command dispatcher), [`backend/src/dgutbot/course/yxy_course.py`](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/course/yxy_course.py) (Courseware controls), [`backend/src/dgutbot/domain/yxy_backend.py`](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/domain/yxy_backend.py) (Platform backend), [`frontend/src/App.tsx`](https://github.com/23swccp/dgut-bot/blob/main/frontend/src/App.tsx) (Web interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["App runtime"]
  node_webui["Web interface<br/>[App.tsx]"]
  node_localapi["Local command API<br/>[server.py]"]
  node_commands["Command dispatcher<br/>[commands.py]"]
  node_launcher["Browser launcher"]
  node_updates["Update interface<br/>[updateClient.ts]"]
  node_updater["Update manager<br/>[updater.py]"]
end

subgraph group_sign["Sign-in"]
  node_signbackend["Platform backend<br/>[yxy_backend.py]"]
  node_monitor["Sign monitor<br/>[sign_monitor.py]"]
end

subgraph group_learning["Course learning"]
  node_courseui["Courseware controls<br/>[yxy_course.py]"]
  node_quiz["Quiz handling<br/>[yxy_quiz.py]"]
  node_slides["Slide handling<br/>[slides.py]"]
  node_courseai["Course AI<br/>[ulearning_ai.py]"]
end

subgraph group_homework["Homework"]
  node_homeworkscan["Homework scanning<br/>[homework_scan.py]"]
  node_reviews["Peer review<br/>[homework_review.py]"]
  node_homeworkinput["Homework input<br/>[homework_input.py]"]
end

subgraph group_identity["Identity and AI"]
  node_independent["Independent login"]
  node_aiworkspace["AI workspace<br/>[AiWorkspace.tsx]"]
end

node_user(("User"))
node_browser["Managed Chromium"]
node_school["Youxueyuan services"]

node_user -->|"uses"| node_webui
node_webui -.->|"sends commands"| node_localapi
node_localapi -->|"dispatches"| node_commands
node_launcher -->|"starts service"| node_localapi
node_launcher -->|"launches"| node_browser
node_webui -->|"shows status"| node_updates
node_updates -.->|"requests updates"| node_updater
node_commands -->|"dispatches sign-in"| node_signbackend
node_signbackend -->|"starts monitoring"| node_monitor
node_signbackend -->|"queries and submits"| node_school
node_signbackend -->|"queries via pages"| node_browser
node_commands -->|"starts course helper"| node_courseui
node_courseui -->|"delegates quiz work"| node_quiz
node_courseui -->|"handles slide tasks"| node_slides
node_courseui -->|"controls course page"| node_browser
node_courseui -->|"reads courseware"| node_school
node_quiz -.->|"requests answers"| node_courseai
node_commands -->|"starts scans"| node_homeworkscan
node_commands -->|"requests review"| node_reviews
node_homeworkscan -->|"reads assignments"| node_school
node_reviews -->|"reads and submits"| node_school
node_commands -->|"sends homework text"| node_homeworkinput
node_homeworkinput -->|"writes editor text"| node_browser
node_commands -->|"handles login"| node_independent
node_independent -->|"authenticates identity"| node_school
node_user -->|"uses"| node_aiworkspace
node_aiworkspace -.->|"requests course AI"| node_courseai

click node_webui "https://github.com/23swccp/dgut-bot/blob/main/frontend/src/App.tsx"
click node_localapi "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/app/server.py"
click node_commands "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/app/commands.py"
click node_launcher "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/app/browser_launcher.py"
click node_updates "https://github.com/23swccp/dgut-bot/blob/main/frontend/src/updateClient.ts"
click node_updater "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/app/updater.py"
click node_signbackend "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/domain/yxy_backend.py"
click node_monitor "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/domain/sign_monitor.py"
click node_courseui "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/course/yxy_course.py"
click node_quiz "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/course/yxy_quiz.py"
click node_slides "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/course/slides.py"
click node_courseai "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/experimental/ulearning_ai.py"
click node_homeworkscan "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/domain/homework_scan.py"
click node_reviews "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/domain/homework_review.py"
click node_homeworkinput "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/app/homework_input.py"
click node_independent "https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/domain/independent_login.py"
click node_aiworkspace "https://github.com/23swccp/dgut-bot/blob/main/frontend/src/AiWorkspace.tsx"

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_webui,node_localapi,node_commands,node_launcher,node_updates,node_updater,node_user toneBlue
class node_signbackend,node_monitor toneAmber
class node_courseui,node_quiz,node_slides,node_courseai toneMint
class node_homeworkscan,node_reviews,node_homeworkinput toneRose
class node_independent,node_aiworkspace,node_browser,node_school toneIndigo
```

## Components

### App runtime

- [Web interface](https://github.com/23swccp/dgut-bot/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Local command API](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/app/server.py): `backend/src/dgutbot/app/server.py`
- [Command dispatcher](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/app/commands.py): `backend/src/dgutbot/app/commands.py`
- [Browser launcher](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/app/browser_launcher.py): `backend/src/dgutbot/app/browser_launcher.py`
- [Update interface](https://github.com/23swccp/dgut-bot/blob/main/frontend/src/updateClient.ts): `frontend/src/updateClient.ts`
- [Update manager](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/app/updater.py): `backend/src/dgutbot/app/updater.py`

### Sign-in

- [Platform backend](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/domain/yxy_backend.py): `backend/src/dgutbot/domain/yxy_backend.py`
- [Sign monitor](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/domain/sign_monitor.py): `backend/src/dgutbot/domain/sign_monitor.py`

### Course learning

- [Courseware controls](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/course/yxy_course.py): `backend/src/dgutbot/course/yxy_course.py`
- [Quiz handling](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/course/yxy_quiz.py): `backend/src/dgutbot/course/yxy_quiz.py`
- [Slide handling](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/course/slides.py): `backend/src/dgutbot/course/slides.py`
- [Course AI](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/experimental/ulearning_ai.py): `backend/src/dgutbot/experimental/ulearning_ai.py`

### Homework

- [Homework scanning](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/domain/homework_scan.py): `backend/src/dgutbot/domain/homework_scan.py`
- [Peer review](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/domain/homework_review.py): `backend/src/dgutbot/domain/homework_review.py`
- [Homework input](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/app/homework_input.py): `backend/src/dgutbot/app/homework_input.py`

### Identity and AI

- [Independent login](https://github.com/23swccp/dgut-bot/blob/main/backend/src/dgutbot/domain/independent_login.py): `backend/src/dgutbot/domain/independent_login.py`
- [AI workspace](https://github.com/23swccp/dgut-bot/blob/main/frontend/src/AiWorkspace.tsx): `frontend/src/AiWorkspace.tsx`

### Other components

- **User**
- **Managed Chromium**
- **Youxueyuan services**

## Connections

- User → Web interface: uses
- Web interface → Local command API: sends commands
- Local command API → Command dispatcher: dispatches (evidence: `backend/src/dgutbot/app/server.py`)
- Browser launcher → Local command API: starts service (evidence: `backend/src/dgutbot/app/browser_launcher.py`)
- Browser launcher → Managed Chromium: launches
- Web interface → Update interface: shows status (evidence: `frontend/src/App.tsx`)
- Update interface → Update manager: requests updates
- Command dispatcher → Platform backend: dispatches sign-in (evidence: `backend/src/dgutbot/app/commands.py`)
- Platform backend → Sign monitor: starts monitoring (evidence: `backend/src/dgutbot/domain/yxy_backend.py`)
- Platform backend → Youxueyuan services: queries and submits
- Platform backend → Managed Chromium: queries via pages
- Command dispatcher → Courseware controls: starts course helper (evidence: `backend/src/dgutbot/app/commands.py`)
- Courseware controls → Quiz handling: delegates quiz work (evidence: `backend/src/dgutbot/course/yxy_course.py`)
- Courseware controls → Slide handling: handles slide tasks (evidence: `backend/src/dgutbot/course/yxy_course.py`)
- Courseware controls → Managed Chromium: controls course page
- Courseware controls → Youxueyuan services: reads courseware
- Quiz handling → Course AI: requests answers
- Command dispatcher → Homework scanning: starts scans (evidence: `backend/src/dgutbot/app/commands.py`)
- Command dispatcher → Peer review: requests review (evidence: `backend/src/dgutbot/app/commands.py`)
- Homework scanning → Youxueyuan services: reads assignments
- Peer review → Youxueyuan services: reads and submits
- Command dispatcher → Homework input: sends homework text (evidence: `backend/src/dgutbot/app/commands.py`)
- Homework input → Managed Chromium: writes editor text
- Command dispatcher → Independent login: handles login (evidence: `backend/src/dgutbot/app/commands.py`)
- Independent login → Youxueyuan services: authenticates identity
- User → AI workspace: uses
- AI workspace → Course AI: requests course AI
