LearnMate 是一个基于 AI 的个人学习管理工具,通过结构化模板记录学习内容,利用 RAG 技术实现智能检索和知识图谱构建,帮助用户积累个人知识库。
核心特性:
- 📝 结构化日志记录(7+ 预设模板 + 自定义模板)
- 🤖 AI 自动补充完整日志和知识点
- 🔍 RAG 语义检索(pgvector + 混合检索)
- 📊 知识图谱可视化
- 📈 学习数据分析看板
- 📱 离线优先 + 多端同步
- 后端: Go + Gin + GORM + PostgreSQL + pgvector
- 前端: Flutter + Provider + Hive
- AI: OpenAI / Google Gemini / Ollama
- 部署: Docker Compose
- Go 1.21+
- Flutter 3.16+
- Docker & Docker Compose
- PostgreSQL 16+ (或使用 Docker)
**本地开发:**
```bash
cd backend
# 安装依赖
go mod download
# 运行数据库迁移
go run cmd/server/main.go migrate
# 启动服务
go run cmd/server/main.go
服务启动在 http://localhost:8080
cd flutter_app
# 安装依赖
flutter pub get
# 运行应用
flutter runlearnmeat/
├── backend/ # Go 后端
│ ├── cmd/server/ # 主程序
│ ├── internal/ # 内部包
│ ├── pkg/ # 公共包
│ ├── config/ # 配置文件
│ └── migrations/ # 数据库迁移
├── flutter_app/ # Flutter 前端
│ ├── lib/
│ │ ├── core/ # 核心配置
│ │ ├── data/ # 数据层
│ │ └── presentation/ # 展示层
│ └── pubspec.yaml
├── docs/ # 文档
│ ├── developer_guide.md
│ ├── implementation_plan.md
│ └── ...
├── docker-compose.yaml
└── README.md
启动后端后访问:http://localhost:8080/swagger/index.html
主要接口:
POST /api/auth/register- 用户注册POST /api/auth/login- 用户登录GET /api/templates- 获取模板列表POST /api/journals/structured- 创建结构化日志GET /api/knowledge/graph- 获取知识图谱GET /api/insights/dashboard- 学习数据看板
编辑 backend/config/config.yaml:
ai:
provider: gemini # 或 openai, ollama
api_key: ${AI_API_KEY}
model: gemini-1.5-flash编辑 flutter_app/lib/core/config/app_config.dart:
static const String apiBaseUrl = 'http://localhost:8080/api';# AI 服务
export AI_PROVIDER=gemini
export AI_API_KEY=your-api-key
# JWT
export JWT_SECRET=your-secret-key
# 数据库(如果不使用 Docker)
export DATABASE_HOST=localhost
export DATABASE_USER=admin
export DATABASE_PASSWORD=password后端:
cd backend
go test ./... -v前端:
cd flutter_app
flutter test后端:
gofmt -w .前端:
dart format .- 构建后端:
cd backend
CGO_ENABLED=0 GOOS=linux go build -o server cmd/server/main.go- 构建前端:
cd flutter_app
flutter build apk --release # Android
flutter build ios --release # iOS
flutter build web --release # Web- 使用 Docker Compose:
docker-compose -f docker-compose.prod.yaml up -d欢迎提交 Issue 和 Pull Request!
MIT License
开始你的学习之旅吧! 🚀