Files
my_bookmate/README.md
T

46 lines
1.2 KiB
Markdown
Raw Normal View History

# BookMate
2026-10-23 15:50:38 +08:00
基于 FastAPI 和 Next.js 的 AI 读书助手。支持 EPUB 导入、围绕书籍内容对话、原文引用和完整 EPUB 网页阅读。
2026-10-23 15:50:38 +08:00
## 本地启动
2026-10-23 15:50:38 +08:00
后端(Python 3.12):
```powershell
cd backend
python -m venv .venv
.venv/Scripts/python.exe -m pip install -r requirements.txt
Copy-Item .env.example .env
.venv/Scripts/python.exe -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
2026-10-23 15:50:38 +08:00
```
在 `.env` 配置模型 API,或启动后在网页的模型管理中添加模型。数据库和上传目录会自动创建。未配置向量服务时使用关键词检索。
2026-10-23 15:50:38 +08:00
另开终端启动前端(Node.js 20.9+):
2026-10-23 15:50:38 +08:00
```powershell
cd frontend
npm ci
npm run dev
```
2026-10-23 15:50:38 +08:00
访问 http://localhost:3000。前端默认连接 http://localhost:8000/api。
2026-10-23 15:50:38 +08:00
## 阅读与对话
2026-10-23 15:50:38 +08:00
导入 EPUB 后,在书架或聊天页面点击「阅读全书」。阅读器支持目录、翻页、字号调整,以及在当前浏览器保存阅读位置。选中文字后可将原文带入 AI 聊天输入框。
2026-10-23 15:50:38 +08:00
## 验证
2026-10-23 15:50:38 +08:00
```powershell
cd backend
.venv/Scripts/python.exe -B -m unittest test_book_file
```
2026-10-23 15:50:38 +08:00
```powershell
cd frontend
npm run build
```
2026-10-23 15:50:38 +08:00
本地 `.env`、模型凭据、数据库、上传书籍和构建产物不纳入版本控制。