课程简介
先做一套能跑的实验室预约系统:学生约实验室 / 设备、管理员审核;再逐步接入大模型,做出能查规则、查库存、辅助提交预约的 AI 助手。
开发路线:业务系统 → AI 对话 → RAG → Tool Calling → LangGraph Agent → SSE 过程可见。
%%{init: {
"theme": "base",
"themeVariables": {
"fontFamily": "inherit",
"primaryTextColor": "#1f2328",
"lineColor": "#59636e",
"secondaryColor": "#ddf4ff",
"tertiaryColor": "#dafbe1"
}
}}%%
flowchart LR
A[业务系统] --> B[AI 对话]
B --> C[RAG 知识库]
C --> D[Tool Calling]
D --> E[LangGraph Agent]
E --> F[SSE 过程可见]
classDef c1 fill:#ddf4ff,stroke:#0969da,color:#1f2328,stroke-width:1.5px
classDef c2 fill:#dafbe1,stroke:#1a7f37,color:#1f2328,stroke-width:1.5px
classDef c3 fill:#fff8c5,stroke:#9a6700,color:#1f2328,stroke-width:1.5px
classDef c4 fill:#ffebe9,stroke:#cf222e,color:#1f2328,stroke-width:1.5px
classDef c5 fill:#fbefff,stroke:#8250df,color:#1f2328,stroke-width:1.5px
classDef c6 fill:#ddf4ff,stroke:#0550ae,color:#1f2328,stroke-width:1.5px
class A c1
class B c2
class C c3
class D c4
class E c5
class F c6适合谁
- 有一点 Python 或前端基础,想跟完一个能跑的全栈项目
- 会调大模型 API,但还没把 RAG / Tool Calling / Agent 串进真实业务
- 想看清「能聊天」到「能查库、能办事」中间差哪些步骤
能学到什么
- Vue3 + FastAPI 前后端分离:登录注册、JWT、统一响应与异常、Axios 联调
- 后台 CRUD:用户、实验室、设备;学生端列表与预约、我的预约、审核
- 文件上传与个人资料
- 从「能聊天」推到「能查库、能办事」的 Agent 链路
- RAG、Tool Calling、LangGraph、SSE 在同一业务里怎么串
环境要求
- Node.js(建议最新 LTS)
- Python 3.12+
- MySQL 8.0+
- VS Code(可选,便于跟笔记调试)
技术栈
| 端 | 技术 |
|---|---|
| 前端 | Vue 3 · Vite · Element Plus · Axios |
| 后端 | Python · FastAPI · SQLAlchemy · JWT |
| 数据库 | MySQL |
| AI | LangChain · ChromaDB · RAG · Tool Calling · LangGraph · SSE |
大模型按 OpenAI 兼容协议接入(如 DeepSeek)。
业务场景
学校有多间实验室,各有设备、人数上限、开放时段与使用规则。学生需要查实验室与设备、选时段提交预约;管理员审核通过或驳回;本人可取消待审 / 已通过的预约。
%%{init: {
"theme": "base",
"themeVariables": {
"fontFamily": "inherit",
"primaryTextColor": "#1f2328",
"lineColor": "#59636e",
"secondaryColor": "#ddf4ff",
"tertiaryColor": "#fff8c5"
}
}}%%
flowchart TD
S[学生] --> L[查看实验室 / 设备]
L --> T[选择日期与时段]
T --> P[提交预约 · 待审核]
P --> A{管理员审核}
A -->|通过| OK[可使用]
A -->|驳回| NO[结束]
P -->|本人取消| X[已取消]
OK -->|本人取消| X
classDef actor fill:#ddf4ff,stroke:#0969da,color:#1f2328,stroke-width:1.5px
classDef step fill:#dafbe1,stroke:#1a7f37,color:#1f2328,stroke-width:1.5px
classDef wait fill:#fff8c5,stroke:#9a6700,color:#1f2328,stroke-width:1.5px
classDef decision fill:#fbefff,stroke:#8250df,color:#1f2328,stroke-width:1.5px
classDef ok fill:#dafbe1,stroke:#1a7f37,color:#1f2328,stroke-width:1.5px
classDef bad fill:#ffebe9,stroke:#cf222e,color:#1f2328,stroke-width:1.5px
class S actor
class L,T step
class P wait
class A decision
class OK ok
class NO,X bad助手侧要能:回答规则类问题、查询开放实验室与设备、在信息齐全时走预约流程,并把推理与工具调用过程展示出来。
Agent 能力
- 对话:实验室助手聊天,前后端联调
- RAG:规则 / 开放时间等文档进知识库,按问题检索再回答
- Tool Calling:需要实时数据时由模型决定调工具查 MySQL(实验室、设备等)
- LangGraph Agent:多轮澄清意图,编排查空闲 → 确认 → 提交预约
- SSE:流式输出,过程节点可见(思考 / 调工具 / 最终回复)
%%{init: {
"theme": "base",
"themeVariables": {
"fontFamily": "inherit",
"actorBkg": "#ddf4ff",
"actorBorder": "#0969da",
"actorTextColor": "#1f2328",
"actorLineColor": "#0969da",
"signalColor": "#1f2328",
"signalTextColor": "#1f2328",
"labelBoxBkgColor": "#fff8c5",
"labelBoxBorderColor": "#9a6700",
"labelTextColor": "#1f2328",
"loopTextColor": "#1f2328",
"noteBkgColor": "#dafbe1",
"noteTextColor": "#1f2328",
"noteBorderColor": "#1a7f37",
"activationBkgColor": "#fbefff",
"activationBorderColor": "#8250df",
"sequenceNumberColor": "#ffffff"
}
}}%%
sequenceDiagram
participant U as 用户
participant FE as 前端
participant API as FastAPI
participant LLM as 大模型
participant RAG as ChromaDB
participant DB as MySQL
U->>FE: 自然语言提问 / 预约
FE->>API: SSE 对话请求
API->>RAG: 检索规则文档(可选)
RAG-->>API: 相关片段
API->>LLM: 上下文 + 工具定义
LLM-->>API: 决定调工具或直接答
API->>DB: Tool Calling 查实验室 / 设备 / 空闲
DB-->>API: 业务数据
API->>LLM: 工具结果
LLM-->>API: 最终回复或继续预约节点
API-->>FE: SSE 推送过程与答案
FE-->>U: 流式展示课程结构(27 节视频 + 1 节图文)
- 业务系统(约 00–19):环境与框架 → 鉴权与用户 → 实验室 / 设备 → 预约与审核
- AI 能力(约 20–23):助手对话 → RAG 知识库 → Tool Calling 查业务数据
- Agent 与收尾(约 24–26):LangGraph 智能预约 → SSE 流式与过程可见 → 首页与收尾
%%{init: {
"theme": "base",
"themeVariables": {
"fontFamily": "inherit",
"primaryTextColor": "#1f2328",
"lineColor": "#59636e",
"clusterBkg": "#f7f8fa",
"clusterBorder": "#c3c7cb",
"titleColor": "#1f2328"
}
}}%%
flowchart TB
subgraph P1[业务系统 00–19]
p1a[环境 / Vue / FastAPI]
p1b[登录注册 JWT]
p1c[用户 / 实验室 / 设备]
p1d[预约与审核]
p1a --> p1b --> p1c --> p1d
end
subgraph P2[AI 能力 20–23]
p2a[助手对话]
p2b[RAG]
p2c[Tool Calling]
p2a --> p2b --> p2c
end
subgraph P3[Agent 与收尾 24–26]
p3a[LangGraph 预约 Agent]
p3b[SSE 过程可见]
p3c[首页与收尾]
p3a --> p3b --> p3c
end
P1 --> P2 --> P3
classDef biz fill:#ddf4ff,stroke:#0969da,color:#1f2328,stroke-width:1.5px
classDef ai fill:#dafbe1,stroke:#1a7f37,color:#1f2328,stroke-width:1.5px
classDef agent fill:#fbefff,stroke:#8250df,color:#1f2328,stroke-width:1.5px
class p1a,p1b,p1c,p1d biz
class p2a,p2b,p2c ai
class p3a,p3b,p3c agent图文笔记站内阅读,视频在 B 站对应分集。会员可下载配套源码。
第 27 节「项目图解」为纯图文笔记,汇总课程路线与项目架构。
源码说明
会员下载的源码包含:
- 前后端完整代码(已排除
node_modules、.venv、本地向量数据目录) - 脱敏后的
.env示例(需自行填写数据库与大模型密钥) sql/lab_agent.sql业务库结构与示例数据- 《项目说明》《部署文档》
知识库向量需按笔记在本地重建,包内不附带已训练向量目录。