Files
ai-dimension/docs/api-assessment.md
T
Yuzhiran Dev 24cd9cef53 🎉 feat: initialize 宇之然AI维度 project
- uni-app Vue3 frontend with dark glassmorphism theme
- 5 AI dimensions: Origin / Development / Current / Learning / Trend
- AI Chat system prompt updated from geometry to AI
- 23 AI knowledge articles initialized in DB
- Trend API + cron job for daily news
- Product pricing (Pro ¥19.9, VIP ¥39.9)
- Pinia stores + API utilities
- AGENTS.md documentation
2026-07-10 13:26:04 +08:00

58 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 后端 API 评估与改造计划
## 现有 API 与新前端映射
### ✅ 可直接复用
| 前端功能 | 后端 API | 改造量 |
|---------|---------|--------|
| 微信登录 | `POST /api/auth/login` | ✅ 零改动 |
| H5 注册/登录 | `POST /api/auth/user/register` / `POST /api/auth/user/login` | ✅ 零改动 |
| 获取用户信息 | `GET /api/auth/me` | ✅ 零改动 |
| 知识列表(按维度) | `GET /api/knowledge?dim=1&category=concept` | ✅ 零改动,改数据即可 |
| 知识详情 | `GET /api/knowledge/:id` | ✅ 零改动 |
| 收藏/取消收藏 | `POST /api/knowledge/:id/collect` / `DELETE /api/knowledge/collect/:id` | ✅ 零改动 |
| AI 问答 | `POST /api/ai-chat/ask` | ⚠️ 改 system prompt(从几何→AI |
| 问答配额 | `GET /api/ai-chat/quota` | ✅ 零改动 |
| 分享获得次数 | `POST /api/ai-chat/share-gain` | ✅ 零改动 |
| 创建订单 | `POST /api/payment/create-order` | ✅ 零改动 |
| 商品列表 | `GET /api/payment/products` | ✅ 改商品数据 |
| 提交反馈 | `POST /api/feedback` | ✅ 零改动 |
| 上传作品 | `POST /api/gallery` | ⚠️ 改为 AI 作品展示 |
| 作品列表 | `GET /api/gallery` | ✅ 零改动 |
### ⚠️ 需改造
| API | 改动内容 | 工作量 |
|-----|---------|--------|
| `POST /api/ai-chat/ask` | `getSystemPromptByDimension()` 函数 — 从几何 prompt 改为 AI 主题 prompt | 改 1 个函数 |
| `GET /api/user/progress` | 原为几何探索进度,改为 AI 学习进度 | 前端改字段名即可 |
| `POST /api/user/progress` | 同上 | 前端改字段名即可 |
### ❌ 移除或降级
| API | 处理方式 |
|-----|---------|
| `GET /api/pinyin/*` (4 个路由) | 前端不调用即可,后端保留兼容 |
| `GET /api/bgm` | 可作为可选功能保留(背景白噪音) |
| `GET /api/share` | 保留,用于分享激励 |
## 需要新增的 API
| 新 API | 说明 | 工作量 |
|--------|------|--------|
| `GET /api/trends` | AI 趋势资讯列表(接入 Hermes cron 的新闻数据) | 新建 model + route1天 |
| `GET /api/tools` | AI 工具导航列表 | 简单 CRUD,小时级 |
## 改造总结
**后端改造成本极低,95% 的 API 可以直接用。**
- 主要改 1 个函数(AI Chat system prompt
- 新增 1-2 个接口(趋势、工具)
- 其余全部零改动
## 数据库改造
- 无需改 schema
- Knowledge 表已有 `dim`, `category`, `sections`, `tags`, `isPremium` 等字段
- 只需填充 AI 内容数据
- AIChatQuota 表可以直接用(原 5 次免费 → 改为 10 次免费)