This repository has been archived on 2026-08-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
kb-skills/.planning/article-analysis-plan.md
T
starmen1265 cf7cbd2ad0
PR Test / lint (pull_request) Successful in 2s
feat: kb-deep-analyzer 支持文章类型分析
- 新增 --type article 参数
- 文章类型生成 300 字摘要 + 完整原文
- 视频类型保持原有时间轴分析逻辑
- 更新相关文档

🤖 Generated by AI
2026-03-13 11:12:34 +08:00

100 lines
3.4 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.
# kb-deep-analyzer 文章支持 - Implementation Plan
**Goal:** 让 kb-deep-analyzer 对文章内容生成 300 字摘要 + 原文 + 元数据,而非视频的时间轴分析
**Approach:** 在 deep_analyzer.py 中根据 `--type` 参数选择不同的 prompt 模板
**Estimated Total Time:** 30 分钟
## Checkpoint 1: 修改 deep_analyzer.py 核心逻辑 (~15 min)
- [ ] Task 1.1: 修改 `_build_prompt` 方法签名,添加 `content_type` 参数 (~2 min)
- **Action:** 在方法签名中添加 `content_type: str = "video"`
- **Verify:** 方法签名正确
- [ ] Task 1.2: 提取视频 prompt 为 `_build_video_prompt` 方法 (~3 min)
- **Action:** 将现有逻辑移到独立方法
- **Verify:** 原有视频分析功能不受影响
- [ ] Task 1.3: 新增 `_build_article_prompt` 方法 (~5 min)
- **Action:** 创建文章专用 prompt:
- 300 字以内摘要,描述核心观点
- 主要主题(不超过 5 个)
- 标签(3-5 个)
- **不包含时间轴**
- **Verify:** prompt 模板符合需求
- [ ] Task 1.4: 修改 `_build_prompt` 根据 `content_type` 分发 (~2 min)
- **Action:**
```python
if content_type == "article":
return self._build_article_prompt(...)
else:
return self._build_video_prompt(...)
```
- **Verify:** 类型判断正确
- [ ] Task 1.5: 修改 `analyze` 方法,传递 `content_type` (~2 min)
- **Action:** 将 content_type 传递到 _build_prompt
- **Verify:** 调用链正确
- [ ] Task 1.6: 修改 `main` 函数,传递 type 参数 (~1 min)
- **Action:** `analyzer.analyze(metadata, content, args.type)`
- **Verify:** 命令行参数正确传递
## Checkpoint 2: 修改输出格式逻辑 (~5 min)
- [ ] Task 2.1: 文章输出时保留原文 (~3 min)
- **Action:** 在文章类型分析完成后,追加原文内容
- **格式:**
```markdown
## 摘要
[AI 生成的 300 字摘要]
## 主要主题
- 主题1
- 主题2
## 原文
[完整的文章原文]
```
- **Verify:** 输出格式正确
- [ ] Task 2.2: 调整 frontmatter 生成逻辑 (~2 min)
- **Action:** 文章类型不包含 duration 字段
- **Verify:** frontmatter 格式正确
## Checkpoint 3: 更新文档 (~5 min)
- [ ] Task 3.1: 更新 kb-deep-analyzer/SKILL.md (~3 min)
- **Action:** 添加 `--type article` 的使用说明
- **Verify:** 文档清晰
- [ ] Task 3.2: 确认 kb-workflow/SKILL.md 已正确传递 type 参数 (~2 min)
- **Action:** 检查步骤 6 的命令是否包含 `--type` 参数
- **Verify:** workflow 文档正确
## Checkpoint 4: 测试验证 (~5 min)
- [ ] Task 4.1: 单元测试 - 视频类型不受影响 (~2 min)
- **Action:** 确认 `--type video` 行为不变
- **Verify:** 无回归
- [ ] Task 4.2: 集成测试 - 文章类型输出正确 (~3 min)
- **Action:** 用一篇知乎文章测试 `--type article`
- **Verify:** 输出包含摘要 + 原文,无时间轴
## Verification Criteria
- [ ] `python deep_analyzer.py --type video` 行为与之前一致
- [ ] `python deep_analyzer.py --type article` 生成 300 字摘要 + 原文
- [ ] 文章输出无"时间轴"部分
- [ ] frontmatter 正确(文章无 duration)
- [ ] SKILL.md 文档已更新
## Execution Options
**1. Single-Agent (this session)** - 我在本会话中顺序执行任务,每个 checkpoint 汇报
**2. Dispatch Sub-Agent** - 启动子代理执行开发任务
选择哪种方式?