# wu-mao-chia/ai_tset_platfrom architecture

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

- Interactive diagram: https://gitdiagram.com/wu-mao-chia/ai_tset_platfrom
- Repository: https://github.com/wu-mao-chia/ai_tset_platfrom

## Overview

這是供團隊管理自動化測試的平台：使用者建立案例、組成清單，再試跑或排程執行 Robot Framework，最後查看進度與報告。主要功能還包括 AI 輔助案例編寫、頁面探索、資料庫連線、帳號權限及 runner 管理。圖中以 API、服務與持久化層呈現主要責任；未抽樣的子系統以 README 描述為依據，未確認的內部呼叫不予推定。

Main entry points: [`backend/src/services/execution_service.py`](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/services/execution_service.py) (執行服務), [`backend/src/execution/worker.py`](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/execution/worker.py) (執行佇列 Worker), [`backend/src/api/cases.py`](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/api/cases.py) (案例與清單 API), [`frontend/src/pages/CaseDetailPage.vue`](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/frontend/src/pages/CaseDetailPage.vue) (案例工作區)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web 應用"]
  node_frontend["Web 介面<br/>[App.vue]"]
  node_case_ui["案例工作區<br/>[CaseDetailPage.vue]"]
  node_case_api_client["案例 API 客戶端<br/>[caseApi.ts]"]
end

subgraph group_domain["案例與管理"]
  node_backend_api["FastAPI 路由<br/>[main.py]"]
  node_case_routes["案例與清單 API<br/>[cases.py]"]
  node_case_service["案例 AI 服務<br/>[ai_service.py]"]
  node_page_explorer["頁面探索"]
  node_db_connections["資料庫連線<br/>[db_connections.py]"]
end

subgraph group_execution["執行與排程"]
  node_scheduling["排程管理<br/>[runner.py]"]
  node_execution_service["執行服務"]
  node_worker["執行佇列 Worker<br/>[worker.py]"]
  node_runner_client["Runner 客戶端<br/>[runner_client.py]"]
  node_environment_service["Runner 環境管理"]
  node_events["執行事件<br/>[events.py]"]
end

subgraph group_integrations["外部整合"]
  node_runner["隔離 Runner<br/>[agent.py]"]
  node_llm["LLM 服務<br/>[llm_provider.py]"]
  node_captcha["CAPTCHA 辨識"]
end

subgraph group_platform["平台底層"]
  node_auth["登入與權限<br/>[auth.py]"]
  node_database[("應用資料庫<br/>[database.py]")]
end

node_user(("使用者"))

node_user -->|"操作"| node_frontend
node_frontend -->|"呼叫 API"| node_backend_api
node_case_ui -->|"提交案例操作"| node_case_api_client
node_case_api_client -->|"呼叫案例端點"| node_case_routes
node_backend_api -->|"提供登入"| node_auth
node_case_routes -.->|"AI 輔助"| node_case_service
node_case_ui -->|"探索頁面"| node_page_explorer
node_user -->|"設定連線"| node_db_connections
node_user -->|"設定排程"| node_scheduling
node_scheduling -->|"排入執行佇列"| node_worker
node_case_routes -.->|"發起試跑"| node_execution_service
node_execution_service -->|"通知佇列"| node_worker
node_worker -->|"執行工作"| node_execution_service
node_worker -->|"讀寫佇列"| node_database
node_execution_service -->|"委派遠端執行"| node_runner_client
node_runner_client -.->|"傳送測試工作"| node_runner
node_execution_service -->|"解析執行環境"| node_environment_service
node_worker -->|"發布執行事件"| node_events
node_events -->|"寫入事件"| node_database
node_captcha -.->|"辨識驗證碼"| node_llm

click node_frontend "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/frontend/src/App.vue"
click node_case_ui "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/frontend/src/pages/CaseDetailPage.vue"
click node_case_api_client "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/frontend/src/services/caseApi.ts"
click node_backend_api "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/main.py"
click node_case_routes "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/api/cases.py"
click node_auth "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/api/auth.py"
click node_case_service "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/services/ai_service.py"
click node_page_explorer "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/services/page_explorer_service.py"
click node_db_connections "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/api/db_connections.py"
click node_scheduling "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/scheduling/runner.py"
click node_execution_service "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/services/execution_service.py"
click node_worker "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/execution/worker.py"
click node_runner_client "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/execution/runner_client.py"
click node_runner "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/runner/agent.py"
click node_environment_service "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/services/runner_environment_service.py"
click node_llm "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/core/llm_provider.py"
click node_captcha "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/libs/CaptchaSolverLibrary.py"
click node_database "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/core/database.py"
click node_events "https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/execution/events.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_frontend,node_case_ui,node_case_api_client toneBlue
class node_backend_api,node_case_routes,node_case_service,node_page_explorer,node_db_connections toneAmber
class node_scheduling,node_execution_service,node_worker,node_runner_client,node_environment_service,node_events toneMint
class node_runner,node_llm,node_captcha toneRose
class node_auth,node_database,node_user toneIndigo
```

## Components

### Web 應用

- [Web 介面](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/frontend/src/App.vue): `frontend/src/App.vue`
- [案例工作區](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/frontend/src/pages/CaseDetailPage.vue): `frontend/src/pages/CaseDetailPage.vue`
- [案例 API 客戶端](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/frontend/src/services/caseApi.ts): `frontend/src/services/caseApi.ts`

### 案例與管理

- [FastAPI 路由](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/main.py): `backend/src/main.py`
- [案例與清單 API](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/api/cases.py): `backend/src/api/cases.py`
- [案例 AI 服務](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/services/ai_service.py): `backend/src/services/ai_service.py`
- [頁面探索](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/services/page_explorer_service.py): `backend/src/services/page_explorer_service.py`
- [資料庫連線](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/api/db_connections.py): `backend/src/api/db_connections.py`

### 執行與排程

- [排程管理](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/scheduling/runner.py): `backend/src/scheduling/runner.py`
- [執行服務](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/services/execution_service.py): `backend/src/services/execution_service.py`
- [執行佇列 Worker](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/execution/worker.py): `backend/src/execution/worker.py`
- [Runner 客戶端](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/execution/runner_client.py): `backend/src/execution/runner_client.py`
- [Runner 環境管理](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/services/runner_environment_service.py): `backend/src/services/runner_environment_service.py`
- [執行事件](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/execution/events.py): `backend/src/execution/events.py`

### 外部整合

- [隔離 Runner](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/runner/agent.py): `runner/agent.py`
- [LLM 服務](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/core/llm_provider.py): `backend/src/core/llm_provider.py`
- [CAPTCHA 辨識](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/libs/CaptchaSolverLibrary.py): `backend/libs/CaptchaSolverLibrary.py`

### 平台底層

- [登入與權限](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/api/auth.py): `backend/src/api/auth.py`
- [應用資料庫](https://github.com/wu-mao-chia/ai_tset_platfrom/blob/master/backend/src/core/database.py): `backend/src/core/database.py`

### Other components

- **使用者**

## Connections

- 使用者 → Web 介面: 操作 (evidence: `README.md`)
- Web 介面 → FastAPI 路由: 呼叫 API (evidence: `README.md`)
- 案例工作區 → 案例 API 客戶端: 提交案例操作 (evidence: `frontend/src/pages/CaseDetailPage.vue`)
- 案例 API 客戶端 → 案例與清單 API: 呼叫案例端點 (evidence: `frontend/src/services/caseApi.ts`)
- FastAPI 路由 → 登入與權限: 提供登入 (evidence: `backend/src/main.py`)
- 案例與清單 API → 案例 AI 服務: AI 輔助
- 案例工作區 → 頁面探索: 探索頁面 (evidence: `frontend/src/pages/CaseDetailPage.vue`)
- 使用者 → 資料庫連線: 設定連線 (evidence: `README.md`)
- 使用者 → 排程管理: 設定排程 (evidence: `README.md`)
- 排程管理 → 執行佇列 Worker: 排入執行佇列 (evidence: `README.md`)
- 案例與清單 API → 執行服務: 發起試跑
- 執行服務 → 執行佇列 Worker: 通知佇列 (evidence: `backend/src/services/execution_service.py`)
- 執行佇列 Worker → 執行服務: 執行工作 (evidence: `backend/src/execution/worker.py`)
- 執行佇列 Worker → 應用資料庫: 讀寫佇列 (evidence: `backend/src/execution/worker.py`)
- 執行服務 → Runner 客戶端: 委派遠端執行 (evidence: `backend/src/services/execution_service.py`)
- Runner 客戶端 → 隔離 Runner: 傳送測試工作
- 執行服務 → Runner 環境管理: 解析執行環境 (evidence: `backend/src/services/execution_service.py`)
- 執行佇列 Worker → 執行事件: 發布執行事件 (evidence: `backend/src/execution/worker.py`)
- 執行事件 → 應用資料庫: 寫入事件 (evidence: `backend/src/execution/events.py`)
- CAPTCHA 辨識 → LLM 服務: 辨識驗證碼 (evidence: `README.md`)
