This repository has been archived on 2026-02-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
openclaw-skills/skills/kb-workflow/SKILL.md
T
OpenClaw Agent 28d64e711d refactor(kb-workflow): 简化SKILL.md,删除sessions_spawn代码流程
改为命令行调用方式的简洁描述
2026-02-10 22:32:13 +08:00

133 lines
3.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.
---
name: kb-workflow
description: 知识库工作流编排技能。接收"添加到知识库 + 链接"消息,完成完整处理流程。
metadata:
short-description: 知识库工作流编排
---
# KB Workflow
## 触发条件
当用户发送包含以下模式的消息时,此技能自动触发:
| 触发词 | 行为 | 示例 |
|--------|------|------|
| `添加到知识库` + 链接 | 添加到知识库并处理 | "添加到知识库 https://www.bilibili.com/video/BVxxx" |
| `保存到知识库` + 链接 | 同上 | "保存到知识库 https://www.bilibili.com/video/BVxxx" |
## Workflow 步骤
当触发后,按照以下步骤执行:
### 步骤 1: 查重
运行查重命令:
```bash
python3 kb_workflow.py --check --url "[URL]"
```
- 如果存在:汇报用户并询问是更新还是跳过
- 如果不存在:继续步骤 2
### 步骤 2: 链接解析
运行 kb-link-parser:
```bash
cd kb-link-parser && python3 link-parser.py --url "[URL]"
```
手动保存结果到:`~/work/knowledge-base/pending/{platform}_{id}.link.json`
### 步骤 3: 元数据提取
根据平台运行对应命令:
Bilibili:
```bash
cd kb-bilibili-metadata && python3 bilibili_metadata.py --id [BV号] --type video --output ~/work/knowledge-base/metadata/{platform}_{id}.meta.json
```
### 步骤 4: 内容下载
根据平台运行对应命令:
Bilibili:
```bash
cd kb-bilibili-content && python3 bilibili_content.py --id [BV号] --type video --output ~/work/knowledge-base/content
```
### 步骤 5: OCR 处理
如果有字幕或视频,运行 OCR(30分钟超时):
```bash
cd kb-ocr-processor && python3 ocr_processor.py --input [字幕或视频文件] --output ~/work/knowledge-base/content/{platform}_{id}.txt
```
### 步骤 6: 深度分析
运行深度分析:
```bash
cd kb-deep-analyzer && python3 deep_analyzer.py --metadata ~/work/knowledge-base/metadata/{platform}_{id}.meta.json --content [元数据或OCR结果] --output ~/work/knowledge-base/analyzed/{platform}_{id}.md
```
### 步骤 7: 归档
运行归档命令:
```bash
python3 kb_workflow.py --archive ~/work/knowledge-base/analyzed/{platform}_{id}.md
```
### 步骤 8: 汇报完成
向用户汇报:
- 视频标题
- 处理阶段完成情况
- 最终文件路径
- Git commit 信息
## 目录结构
```
~/work/knowledge-base/
├── archive/
│ └── YYYY-MM-DD/
│ └── {platform}_{id}.md
│ └── {platform}_{id}.meta.json
├── pending/
│ └── {platform}_{id}.link.json
├── metadata/
│ └── {platform}_{id}.meta.json
├── content/
│ ├── downloads/
│ │ └── {platform}_{id}.mp4
│ ├── subtitles/
│ │ └── {platform}_{id}.srt
│ └── {platform}_{id}.txt
└── analyzed/
└── {platform}_{id}.md
```
## 支持的平台
| 平台 | 元数据命令 | 内容命令 |
|------|-----------|---------|
| Bilibili | kb-bilibili-metadata | kb-bilibili-content |
| 知乎 | kb-zhihu-metadata | - |
## 辅助命令
```bash
# 查重
python3 kb_workflow.py --check --url "[URL]"
# 归档
python3 kb_workflow.py --archive "[分析报告路径]"
```
## 环境变量(可选)
```bash
export KB_BASE_PATH="~/work/knowledge-base"
```