Scaffold V2 backend foundation

This commit is contained in:
2026-07-06 17:25:06 +08:00
parent 44af745828
commit 17cba7cf61
42 changed files with 1459 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
# AI 知识库系统 V2 后端
这是 V2 的后端服务目录当前处于阶段二第一批建设后端基础工程、核心数据模型、mock 登录能力。
## 技术栈
- FastAPI
- SQLAlchemy
- Alembic
- MySQL 8.x
- Pydantic Settings
- PyJWT
## 当前已包含
- 应用入口和健康检查
- 统一 JSON 响应结构
- 配置读取和 `.env` 示例
- SQLAlchemy 数据库连接
- Alembic 迁移骨架
- 核心 `sys_*` 数据模型
- mock 短信验证码
- 用户手机号验证码登录
- 用户 Token 鉴权
- 当前用户信息接口
## 本地启动
```bash
cd ai_knowledge_base_v2/apps/backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
uvicorn app.main:app --reload --host 127.0.0.1 --port 8100
```
默认短信验证码为 `.env` 中的 `MOCK_SMS_CODE`,默认值是 `123456`
## 下一步
- 补 Alembic 初始迁移脚本。
- 补聊天会话和消息接口。
- 补管理员登录接口。
- 接入 Redis 替换内存短信验证码和 Token 黑名单。