refactor: 移除 AI 词云、AI 时间轴和博客模块

暂停开发以下功能,将设计文档移至未完成计划文件夹:

- AI 词云 (Keyword Cloud): 前端、API、数据库模型、n8n 工作流
- AI 时间轴 (AI Timeline): 前端、API、数据库模型
- 博客 (Blog): 导航链接占位

变更内容:
- 删除词云和时间轴的前端页面及组件
- 删除 /api/keyword-cloud/* 和 /api/events/* API 端点
- 从 prisma/schema.prisma 移除 Keyword, Quarter, VisualStyleRule, KeywordCloudErrorLog, AIEvent 模型
- 从 validations.ts 移除相关 Zod Schema
- 从国际化消息中移除 keywordCloud/timeline 命名空间
- 从导航菜单移除词云、时间轴、博客链接
- 更新 CLAUDE.md 移除词云系统文档

设计文档已移至 .omc/plans/postponed-features/ 供后续恢复开发参考
This commit is contained in:
2026-02-21 12:35:54 +08:00
parent c2eabfea97
commit 79c25eb1b3
42 changed files with 708 additions and 3124 deletions
-86
View File
@@ -226,92 +226,6 @@ API Submitter Agent (提交到生产环境 API)
/discover-projects all --batch=5
```
### Keyword Cloud System (季度 AI 热点词云)
**功能**: 自动化采集 Google Trends 数据,展示季度 AI 热点词汇词云。
**数据流**: n8n 工作流 → AI 清洗 → 规则匹配 → PostgreSQL → Next.js 前端
#### 数据库表
- `Quarter`: 季度元数据(quarter, title, titleEn, subtitle, subtitleEn, displayOrder, isActive)
- `Keyword`: 关键词数据(word, trendScore, description, visualConfig)
- `VisualStyleRule`: 视觉样式规则配置(name, minScore, maxScore, color, size, border, rotation)
- `KeywordCloudErrorLog`: 错误日志(quarter, keyword, errorType, errorMessage)
#### API 端点
- `GET /api/keyword-cloud/quarters`: 获取季度列表(支持 `isActive` 过滤)
- `GET /api/keyword-cloud/keywords/[quarter]`: 获取指定季度的关键词
- `GET /api/keyword-cloud/rules`: 获取视觉样式规则配置
- `POST /api/keyword-cloud/keywords`: 批量写入关键词(n8n 使用,需 API Key 认证)
- `GET /api/keyword-cloud/health`: 健康检查端点(返回系统统计信息)
#### 前端路由
- `/[locale]/keyword-cloud`: 词云展示页面
#### 前端组件
- **Location**: `src/app/[locale]/keyword-cloud/components/`
- `CloudWord`: 单个词汇组件(支持颜色、大小、边框、旋转、悬停弹出框)
- `QuarterNavigator`: 季度导航组件(前后切换)
- `ProgressIndicator`: 进度条组件(显示季度进度)
- `KeywordCloud`: 主容器组件(集成所有子组件,客户端组件)
#### 国际化支持
- **消息键**: `src/messages/{locale}.json` 中的 `keywordCloud` 命名空间
- **支持的字段**:
- `metaTitle`/`metaDescription`: SEO 元数据
- `badge`: 页面徽章文本
- `title`/`titleHighlight`: 主标题(支持高亮)
- `subtitle`: 副标题描述
- `loading`/`loadFailed`/`retry`: 加载状态文本
- `hotKeyword`: 热门词汇提示(支持 `{word}` 参数替换)
- **导航菜单**: `navigation.keywordCloud` 键控制导航栏显示
- **添加新翻译**: 更新 `src/messages/zh.json` 和 `src/messages/en.json` 中的 `keywordCloud` 部分
#### 数据访问层
- **Location**: `src/hooks/useKeywordCloud.ts` (服务器端函数)
- **Functions**:
- `getAllQuarters()`: 获取所有季度列表
- `getQuarterByQuarter()`: 获取单个季度详情(含关键词计数)
- `getKeywordsByQuarter()`: 获取指定季度的所有关键词
- `getVisualStyleRules()`: 获取视觉样式规则
- `upsertQuarter()`: 创建或更新季度
- `createKeywords()`: 批量创建关键词
- `logKeywordCloudError()`: 记录错误日志
#### 客户端 Hook
- **Location**: `src/hooks/useKeywordCloudClient.ts`
- **Function**: `useKeywordCloud(quarter)` - 响应式获取季度关键词数据
#### n8n 工作流
- **配置文件**: `n8n-workflows/keyword-cloud-workflow.json`
- **文档**: `n8n-workflows/README.md`
- **流程**:
1. Schedule Trigger: 每季度末最后一天的 23:00 自动触发
2. Calculate Quarter: 计算当前季度标识和时间范围
3. Google Trends: 采集热门搜索词
4. Extract Keywords: 提取关键词和热度分数
5. Get Visual Rules: 获取视觉样式规则
6. Match Visual Rules: 为关键词匹配视觉样式
7. Send to API: 写入数据库
#### 初始化数据
```bash
# 运行种子数据脚本(创建视觉规则和示例数据)
pnpm tsx scripts/seed-keyword-cloud.ts
```
#### 测试 API
```bash
# 运行 API 测试脚本
set -a && source .env.local && set +a && npx tsx scripts/test-keyword-api.ts
```
#### 环境变量
- `WEBHOOK_API_KEY`: n8n 工作流使用的 API 密钥(必需)
- n8n 环境变量(在 n8n 中设置):
- `API_URL`: API 端点 URL(如 `http://localhost:3000`)
- `API_KEY`: 与 `WEBHOOK_API_KEY` 相同
## MCP Servers Usage (按需使用)
1. **context7**: 不确定 API 用法时查阅最新文档