Skip to content

trrueee/LearnMate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LearnMate - AI 驱动的个人学习日志系统

项目简介

LearnMate 是一个基于 AI 的个人学习管理工具,通过结构化模板记录学习内容,利用 RAG 技术实现智能检索和知识图谱构建,帮助用户积累个人知识库。

核心特性:

  • 📝 结构化日志记录(7+ 预设模板 + 自定义模板)
  • 🤖 AI 自动补充完整日志和知识点
  • 🔍 RAG 语义检索(pgvector + 混合检索)
  • 📊 知识图谱可视化
  • 📈 学习数据分析看板
  • 📱 离线优先 + 多端同步

技术栈

  • 后端: Go + Gin + GORM + PostgreSQL + pgvector
  • 前端: Flutter + Provider + Hive
  • AI: OpenAI / Google Gemini / Ollama
  • 部署: Docker Compose

快速开始

1. 环境要求

  • 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

4. 启动前端

cd flutter_app

# 安装依赖
flutter pub get

# 运行应用
flutter run

项目结构

learnmeat/
├── 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

文档

API 文档

启动后端后访问: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 .

部署

生产环境部署

  1. 构建后端:
cd backend
CGO_ENABLED=0 GOOS=linux go build -o server cmd/server/main.go
  1. 构建前端:
cd flutter_app
flutter build apk --release  # Android
flutter build ios --release  # iOS
flutter build web --release  # Web
  1. 使用 Docker Compose:
docker-compose -f docker-compose.prod.yaml up -d

贡献

欢迎提交 Issue 和 Pull Request!

许可证

MIT License


开始你的学习之旅吧! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors