# huanpeng69-cmyk/gongkao-ai architecture

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

- Interactive diagram: https://gitdiagram.com/huanpeng69-cmyk/gongkao-ai
- Repository: https://github.com/huanpeng69-cmyk/gongkao-ai
- Video tour (about a minute): https://gitdiagram.com/huanpeng69-cmyk/gongkao-ai/video

## Overview

公考私教是一体化备考应用，核心流程是学员练习真题、记录作答并复习错题；也提供学习统计、备考工具和 AI 文字／漫画讲解。图中区分题库、学习记录、客户端 AI 请求与服务端代理等主要层次。README 说明了产品能力；部分页面和接口源码未完整展示，因此未推断题库 API 等未证实的调用关系。

Main entry points: [`app/quiz/page.tsx`](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/quiz/page.tsx) (真题练习), [`lib/client-ai.ts`](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/client-ai.ts) (文字讲解客户端), [`lib/store.ts`](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/store.ts) (学习记录), [`app/page.tsx`](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/page.tsx) (学习首页)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_study["学习流程"]
  node_home["学习首页<br/>[page.tsx]"]
  node_quiz["真题练习<br/>[page.tsx]"]
  node_review["错题复习<br/>[page.tsx]"]
  node_stats["学习统计<br/>[page.tsx]"]
end

subgraph group_content["题库与工具"]
  node_question_api["真题接口<br/>[route.ts]"]
  node_question_client["题库客户端"]
  node_question_data["题目样例与类型<br/>[mock-data.ts]"]
  node_question_utils["题目处理<br/>[question-utils.ts]"]
  node_toolbox["备考百宝箱<br/>[page.tsx]"]
  node_toolbox_tools["空间训练工具"]
  node_toolbox_content["工具内容<br/>[toolbox-content.ts]"]
end

subgraph group_ai["AI 讲解"]
  node_ai_client["文字讲解客户端<br/>[client-ai.ts]"]
  node_ai_api["文字讲解 API<br/>[route.ts]"]
  node_image_client["漫画生图客户端<br/>[client-image.ts]"]
  node_image_api["生图 API<br/>[route.ts]"]
  node_ai_service{{"Agnes AI"}}
  node_ai_history[("讲解历史<br/>[ai-history.ts]")]
  node_settings["AI 设置<br/>[page.tsx]"]
  node_ai_config["设备 AI 配置"]
end

subgraph group_platform["用户与记录"]
  node_auth[("本地账号<br/>[auth.ts]")]
  node_store[("学习记录<br/>[store.ts]")]
end

node_learner(("备考学员"))

node_learner -->|"查看计划"| node_home
node_learner -->|"练习真题"| node_quiz
node_learner -->|"复习错题"| node_review
node_learner -->|"使用工具"| node_toolbox
node_home -->|"读取记录"| node_store
node_home -->|"请求讲解"| node_ai_client
node_home -->|"保存结果"| node_ai_history
node_quiz -->|"加载题库"| node_question_client
node_quiz -->|"使用题目样例"| node_question_data
node_quiz -->|"读取题目文本"| node_question_utils
node_quiz -->|"读取作答记录"| node_store
node_quiz -->|"请求错因讲解"| node_ai_client
node_quiz -->|"请求漫画讲解"| node_image_client
node_quiz -->|"保存讲解"| node_ai_history
node_question_client -.->|"读取真题"| node_question_api
node_review -->|"读取复习计划"| node_store
node_review -->|"请求错因讲解"| node_ai_client
node_review -->|"保存讲解"| node_ai_history
node_stats -->|"读取统计数据"| node_store
node_toolbox -->|"呈现训练"| node_toolbox_tools
node_toolbox -->|"读取工具内容"| node_toolbox_content
node_ai_client -->|"请求代理"| node_ai_api
node_ai_client -->|"直连讲解服务"| node_ai_service
node_ai_api -->|"请求文字讲解"| node_ai_service
node_image_client -->|"请求生图代理"| node_image_api
node_image_client -->|"读取生图配置"| node_ai_config
node_image_api -.->|"请求图片生成"| node_ai_service
node_settings -->|"配置接口"| node_ai_config
node_settings -->|"使用账号"| node_auth
node_store -->|"读取当前用户"| node_auth

click node_home "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/page.tsx"
click node_quiz "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/quiz/page.tsx"
click node_review "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/review/page.tsx"
click node_stats "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/stats/page.tsx"
click node_question_api "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/api/gkzhenti/route.ts"
click node_question_client "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/question-bank-client.ts"
click node_question_data "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/mock-data.ts"
click node_question_utils "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/question-utils.ts"
click node_toolbox "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/toolbox/page.tsx"
click node_toolbox_tools "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/components/ToolboxThreeTools.tsx"
click node_toolbox_content "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/toolbox-content.ts"
click node_ai_client "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/client-ai.ts"
click node_ai_api "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/api/ai/route.ts"
click node_image_client "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/client-image.ts"
click node_image_api "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/api/image/route.ts"
click node_ai_history "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/ai-history.ts"
click node_settings "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/settings/page.tsx"
click node_ai_config "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/default-ai-config.ts"
click node_auth "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/auth.ts"
click node_store "https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/store.ts"

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_home,node_quiz,node_review,node_stats toneBlue
class node_question_api,node_question_client,node_question_data,node_question_utils,node_toolbox,node_toolbox_tools,node_toolbox_content toneAmber
class node_ai_client,node_ai_api,node_image_client,node_image_api,node_ai_service,node_ai_history,node_settings,node_ai_config toneMint
class node_auth,node_store toneRose
class node_learner toneIndigo
```

## Components

### 学习流程

- [学习首页](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/page.tsx): `app/page.tsx`
- [真题练习](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/quiz/page.tsx): `app/quiz/page.tsx`
- [错题复习](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/review/page.tsx): `app/review/page.tsx`
- [学习统计](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/stats/page.tsx): `app/stats/page.tsx`

### 题库与工具

- [真题接口](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/api/gkzhenti/route.ts): `app/api/gkzhenti/route.ts`
- [题库客户端](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/question-bank-client.ts): `lib/question-bank-client.ts`
- [题目样例与类型](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/mock-data.ts): `lib/mock-data.ts`
- [题目处理](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/question-utils.ts): `lib/question-utils.ts`
- [备考百宝箱](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/toolbox/page.tsx): `app/toolbox/page.tsx`
- [空间训练工具](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/components/ToolboxThreeTools.tsx): `components/ToolboxThreeTools.tsx`
- [工具内容](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/toolbox-content.ts): `lib/toolbox-content.ts`

### AI 讲解

- [文字讲解客户端](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/client-ai.ts): `lib/client-ai.ts`
- [文字讲解 API](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/api/ai/route.ts): `app/api/ai/route.ts`
- [漫画生图客户端](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/client-image.ts): `lib/client-image.ts`
- [生图 API](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/api/image/route.ts): `app/api/image/route.ts`
- **Agnes AI**
- [讲解历史](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/ai-history.ts): `lib/ai-history.ts`
- [AI 设置](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/app/settings/page.tsx): `app/settings/page.tsx`
- [设备 AI 配置](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/default-ai-config.ts): `lib/default-ai-config.ts`

### 用户与记录

- [本地账号](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/auth.ts): `lib/auth.ts`
- [学习记录](https://github.com/huanpeng69-cmyk/gongkao-ai/blob/main/lib/store.ts): `lib/store.ts`

### Other components

- **备考学员**

## Connections

- 备考学员 → 学习首页: 查看计划 (evidence: `README.md`)
- 备考学员 → 真题练习: 练习真题 (evidence: `README.md`)
- 备考学员 → 错题复习: 复习错题 (evidence: `README.md`)
- 备考学员 → 备考百宝箱: 使用工具 (evidence: `README.md`)
- 学习首页 → 学习记录: 读取记录 (evidence: `app/page.tsx`)
- 学习首页 → 文字讲解客户端: 请求讲解 (evidence: `app/page.tsx`)
- 学习首页 → 讲解历史: 保存结果 (evidence: `app/page.tsx`)
- 真题练习 → 题库客户端: 加载题库 (evidence: `app/quiz/page.tsx`)
- 真题练习 → 题目样例与类型: 使用题目样例 (evidence: `app/quiz/page.tsx`)
- 真题练习 → 题目处理: 读取题目文本 (evidence: `app/quiz/page.tsx`)
- 真题练习 → 学习记录: 读取作答记录 (evidence: `app/quiz/page.tsx`)
- 真题练习 → 文字讲解客户端: 请求错因讲解 (evidence: `app/quiz/page.tsx`)
- 真题练习 → 漫画生图客户端: 请求漫画讲解 (evidence: `app/quiz/page.tsx`)
- 真题练习 → 讲解历史: 保存讲解 (evidence: `app/quiz/page.tsx`)
- 题库客户端 → 真题接口: 读取真题
- 错题复习 → 学习记录: 读取复习计划 (evidence: `app/review/page.tsx`)
- 错题复习 → 文字讲解客户端: 请求错因讲解 (evidence: `app/review/page.tsx`)
- 错题复习 → 讲解历史: 保存讲解 (evidence: `app/review/page.tsx`)
- 学习统计 → 学习记录: 读取统计数据 (evidence: `app/stats/page.tsx`)
- 备考百宝箱 → 空间训练工具: 呈现训练 (evidence: `app/toolbox/page.tsx`)
- 备考百宝箱 → 工具内容: 读取工具内容 (evidence: `app/toolbox/page.tsx`)
- 文字讲解客户端 → 文字讲解 API: 请求代理 (evidence: `lib/client-ai.ts`)
- 文字讲解客户端 → Agnes AI: 直连讲解服务 (evidence: `lib/client-ai.ts`)
- 文字讲解 API → Agnes AI: 请求文字讲解 (evidence: `app/api/ai/route.ts`)
- 漫画生图客户端 → 生图 API: 请求生图代理 (evidence: `lib/client-image.ts`)
- 漫画生图客户端 → 设备 AI 配置: 读取生图配置 (evidence: `lib/client-image.ts`)
- 生图 API → Agnes AI: 请求图片生成 (evidence: `README.md`)
- AI 设置 → 设备 AI 配置: 配置接口 (evidence: `app/settings/page.tsx`)
- AI 设置 → 本地账号: 使用账号 (evidence: `app/settings/page.tsx`)
- 学习记录 → 本地账号: 读取当前用户 (evidence: `lib/store.ts`)
