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/kb-deep-analyzer/SKILL.md
T
starmen1265 202960eb64 fix: 统一知识库技能模型名称为 glm-5,补充 OCR 和 kb-funasr 说明
- kb-deep-analyzer: glm-4.7 → glm-5, gpt-4 → glm-5
- kb-workflow: 步骤5增加 OCR 和 kb-funasr 作为备用方案
- 统一命令使用 --type subtitle-download
2026-02-27 15:36:18 +08:00

95 lines
2.2 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 Skill
**kb-deep-analyzer** - AI-powered deep content analysis.
## Features
- Multi-type analysis (tutorial, documentation, news)
- Template-based output
- Quality scoring
- Automatic tagging
- **多格式元数据支持**: 支持扁平结构 `{"title":"xxx"}` 和嵌套结构 `{"data":{"metadata":{...}}}`
## Commands
```bash
# 分析内容(推荐:使用 -u 参数强制无缓冲输出)
AI_API_KEY="your-api-key" AI_PROVIDER="zhipu" AI_MODEL="glm-4.7" \
python3 -u deep_analyzer.py --metadata meta.json --content content.json --output analysis.md
# 指定类型
python deep_analyzer.py --metadata meta.json --content content.json --type tutorial --output tutorial.md
# 指定 AI 提供商
python deep_analyzer.py -m meta.json -c content.json -o out.md --provider zhipu --model glm-4
```
## 环境变量配置
**必须设置以下环境变量**:
```bash
export AI_API_KEY="your-api-key"
export AI_PROVIDER="zhipu" # 或 openai, minimax
export AI_MODEL="glm-5" # 模型名称
export AI_BASE_URL="https://..." # 可选,自定义 API 地址
```
### 重要提示
**必须使用 `-u` 参数运行 Python**,确保输出实时显示在终端:
```bash
python3 -u deep_analyzer.py ...
```
如果不使用 `-u` 参数,Python 的 stdout 缓冲会导致输出延迟或看不到进度。
## 执行方式选择
### 方式1: 并发执行(推荐,默认)
- 使用 `batch_size=3`(默认)
- 6个分片约 100 秒完成
- 适合快速分析
```bash
python3 -u deep_analyzer.py --metadata meta.json --content content.json -o out.md
```
### 方式2: 顺序执行
- 使用 `batch_size=1`
- 6个分片约 735 秒完成
- 适合调试和问题排查
```bash
# 在代码中设置 batch_size=1
# analyzer.analyze(metadata, content, "video", batch_size=1)
```
## Metadata Format
支持两种元数据格式:
```json
// 格式1: 扁平结构
{
"title": "视频标题",
"author": "作者名",
"duration": 619,
"bvid": "BVxxx"
}
// 格式2: 嵌套结构(kb-bilibili-metadata 输出)
{
"data": {
"metadata": {
"title": "视频标题",
"author": "作者名",
"duration": "10:19"
}
}
}
```
会自动转换为扁平格式进行分析。