<<<<<<< HEAD
让收藏成为持续的价值
- 🧠 AI标签生成:集成豆包AI,智能生成内容标签
- 🌐 多语言支持:中英文切换界面
- 📱 智能导入:粘贴分享文本自动提取标题和链接
- 🎨 平台特色标签:不同平台使用专属颜色标识
- 🖱️ 一键跳转:点击卡片直接跳转到内容
Savor 是一个基于用户收藏行为的内容再发现平台,帮助用户重新利用已收藏但未被消费的内容。
- 将"收藏行为"转化为"可持续利用资产"
- 构建用户兴趣模型
- 提升内容复用效率
Savor/
├── backend/ # Node.js + Express 后端
│ ├── src/
│ │ ├── index.ts # 主应用入口
│ │ ├── db.ts # 数据库连接
│ │ ├── types.ts # 类型定义
│ │ ├── services/ # 业务逻辑服务
│ │ │ ├── contentService.ts # 内容管理
│ │ │ ├── tagService.ts # 标签系统
│ │ │ └── recommendationService.ts # 推荐系统
│ │ └── routes/
│ │ └── api.ts # API 路由
│ ├── package.json
│ ├── tsconfig.json
│ └── .env.example
│
├── frontend/ # React + TypeScript 前端
│ ├── src/
│ │ ├── main.tsx # 入口文件
│ │ ├── App.tsx # 主应用
│ │ ├── api.ts # API 调用
│ │ ├── components/ # React 组件
│ │ │ ├── AddTab.tsx # 添加收藏
│ │ │ ├── ContentCard.tsx # 内容卡片
│ │ │ ├── ContentGrid.tsx # 瀑布流
│ │ │ ├── TagConfirmation.tsx # 标签确认
│ │ │ └── RecommendationTab.tsx # 推荐页
│ │ └── styles/ # CSS 样式
│ ├── index.html
│ ├── vite.config.ts
│ ├── package.json
│ └── tsconfig.json
│
├── database/ # 数据库 Schema
│ ├── schema.sql # 表结构定义
│ └── seed.sql # 测试数据
│
└── README.md # 项目文档
- 用户粘贴链接导入内容(支持抖音、小红书、B站等)
- 系统自动解析内容信息
- 自动生成内容标签
- 卡片式内容展示
- 瀑布流布局(Pinterest风格)
- 支持标记已查看、删除、添加标签
- 从标题/描述自动提取关键词
- 用户可手动确认或添加新标签
- 停留时间
- 点击频率
- 回看次数
- 系统自动聚合用户兴趣(如"英语学习"、"健身"、"自律")
推荐权重 = 短期兴趣权重(30%) + 长期价值权重(40%) + 时间衰减反向权重(30%)
- 触发条件:用户近期收藏内容
- 行为:推送同标签内容
- 触发条件:收藏后长时间未访问(> 3天)
- 行为:重新推荐值得再看的内容
- 每日推送"你3天前收藏的内容,值得再看"
- 自动挖掘高价值内容
- 运行时:Node.js 18+
- 框架:Express 4
- 语言:TypeScript
- 数据库:PostgreSQL 14+
- 数据库驱动:postgres (js)
- 框架:React 18
- 语言:TypeScript
- 构建工具:Vite
- HTTP 客户端:Axios
- 样式:CSS3
- PostgreSQL 14+
- 表结构已定义在
database/schema.sql
- Node.js 18 或更高版本
- PostgreSQL 14 或更高版本
- npm 或 yarn
# 创建数据库
createdb savor_db
# 导入 schema
psql savor_db < database/schema.sql
# (可选)导入示例数据
psql savor_db < database/seed.sqlcd backend
# 复制环境配置
cp .env.example .env
# 编辑 .env 文件,设置数据库连接信息
# DATABASE_URL=postgresql://user:password@localhost:5432/savor_db
# DOUBAO_API_KEY=your_doubao_api_key_here # 可选,用于AI标签生成
# 安装依赖
npm install
# 启动开发服务器
npm run dev
# 或构建生产版本
npm run build
npm start后端服务器运行在 http://localhost:3000
cd frontend
# 安装依赖
npm install
# 启动开发服务器
npm run dev
# 或构建生产版本
npm run build前端应用运行在 http://localhost:5173
POST /api/contents/import
Body: { userId, url, title? }
GET /api/contents?userId=xxx&limit=20&offset=0
PATCH /api/contents/:contentId/view
DELETE /api/contents/:contentId?userId=xxx
GET /api/contents/:contentId/tags
POST /api/contents/:contentId/tags/confirm
Body: { tagName }
GET /api/users/:userId/interest-tags
POST /api/users/:userId/interest-tags/update
GET /api/recommendations?userId=xxx&limit=20
POST /api/wakeup/daily
Body: { userId }
- ✓ 链接导入
- ✓ 收藏展示(瀑布流)
- ✓ 简单标签系统
- ✓ 基础推荐(规则版)
- ✓ 收藏唤醒机制
- ✓ 用户兴趣聚合
- 社交功能
- 评论系统
- AI 标签生成
- 高级推荐算法
- 课程推荐(商业化)
id: UUID
username: string
email: string
created_at: Date
updated_at: Dateid: UUID
user_id: UUID (FK)
title: string
url: string (UNIQUE)
source: 'douyin' | 'xiaohongshu' | 'bilibili' | 'other'
description: string?
thumbnail_url: string?
view_count: number
is_viewed: boolean
created_at: Date
last_viewed_at: Date?id: UUID
content_id: UUID (FK)
tag_name: string
tag_type: 'auto' | 'user_confirmed'
confidence: 0-1
created_at: Dateid: UUID
content_id: UUID (FK)
user_id: UUID (FK)
stay_time: number (seconds)
click_count: number
rewatch_count: number
generated_at: Dateid: UUID
user_id: UUID (FK)
tag_name: string
confidence: 0-1
last_triggered_at: Date?
created_at: Date- React 组件:PascalCase (如
ContentCard) - 函数/变量:camelCase (如
getUserContents) - 类型/接口:PascalCase (如
SavedContent) - 常量:UPPER_SNAKE_CASE (如
MAX_DECAY_DAYS)
- 使用 TypeScript 进行类型检查
- 使用 async/await 处理异步操作
- 添加适当的注释和文档
cd backend
npm run dev
# 开启 TypeScript 编译和自动重启功能cd frontend
npm run dev
# Vite 开发服务器在 localhost:5173-
前端
- 使用虚拟滚动处理大量列表
- 图片懒加载
- React.memo 优化组件重渲染
-
后端
- 添加查询缓存
- 数据库查询优化(已有索引)
- 推荐算法分页处理
-
数据库
- 定期分析表统计信息
- 配置定期 VACUUM
A: 在前端 src/App.tsx 中修改默认 userId,或通过 localStorage 设置
A:
- 修改
backend/src/types.ts中的 source 类型 - 在
contentService.ts的detectSource函数中添加检测逻辑 - 在 API 中对应更新
A: 修改 recommendationService.ts 中的相关常数和权重计算逻辑
MIT
- GitHub: [Savor Repository]
- 邮箱: contact@savor.app
Savor 是一个基于用户收藏行为的内容再发现平台,帮助用户重新利用已收藏但未被消费的内容。
61543b933572f8c3c3d1e359e1a268c3a4fc514a