Update: KB workflow git integration + todo items

- Add git remote check and pull before archive
- Support main/master branch auto-fallback
- Add todo: SenseVoice test, git ops, session routing
- Memory: BV1x3ctzkEdf knowledge base workflow
This commit is contained in:
2026-02-13 19:09:57 +08:00
parent 3bd9cb7793
commit 6093a0a09d
4 changed files with 167 additions and 27 deletions
+8 -4
View File
@@ -3,10 +3,6 @@
## 待处理
### 重要
- [ ] 配置 OpenRouter 接入(使用免费模型如Pony Alpha)
- 获取 OPENROUTER_API_KEY
- 运行: `openclaw onboard --auth-choice apiKey --token-provider openrouter --token "$OPENROUTER_API_KEY"`
- 或在 config.yaml 中配置 env: { OPENROUTER_API_KEY: "sk-or-..." }
- [ ] 🔒 处理安全巡检报告问题(2026-02-10)
- [ ] 修复凭证目录权限: chmod 700 /home/admin/.openclaw/credentials
- [ ] 禁用控制UI不安全认证: gateway.controlUi.allowInsecureAuth=false
@@ -17,6 +13,14 @@
- [ ] 配置阿里云 TTS 语音
- 需要提供:AccessKeyId, AccessKeySecret
- 配置命令: `openclaw config set channels.wecom.voice.type "aliyun"`
- [ ] 测试阿里 SenseVoice 方案效果
- 评估语音识别效果对比 Whisper
- [ ] 跑通 Git 管理知识库仓库操作
- 验证 git add/commit/push 流程
- 确保归档后自动提交到远程仓库
- [ ] 使用多个对话会话路由到不同代理
- 设计会话路由规则
- 配置不同代理处理不同类型请求
### 字幕增强方案(待实现)
- [x] ~~编译 Whisper.cpp~~ - 已完成基础功能
+78
View File
@@ -0,0 +1,78 @@
# Session: 2026-02-13 10:43:39 UTC
- **Session Key**: agent:main:main
- **Session ID**: 8de40e85-24aa-48b6-9742-9aa6cf38fd78
- **Source**: feishu
## Conversation Summary
assistant: 已提交并推送!✅
```
refactor: 重构 deep_analyzer 一次性调用 AI 生成完整报告
4 files changed, 2091 insertions(+), 1594 deletions(-)
```
user: [Fri 2026-02-13 18:35 GMT+8] 我看了一下final版文档,标题 爱泼斯坦案背后的美式司法与认知战深度解析 摘要 沈逸教授针对2026年初爱泼斯坦案300万页文件解密事件进行了深度剖析。他指出,尽管大量文件公布,美国司法部已明确表示不会提起新的刑事诉讼,意味着涉案权贵客户将免于刑事追责,仅需通过民事诉讼支付巨额和解金。视频批判了美式司法体系服务于资本和政治的本质,将司法作为政治交易工具和宣泄公众情绪的缓冲阀。沈逸进一步分析了文件中夹杂的虚假信息(如“吃人”艺术照)所构成的“认知战”,通过释放真假难辨的信息制造混乱,引导舆论陷入无意义的阴谋论争吵。最后,他将爱泼斯坦案与“斩杀线”现象结合,揭示了美国社会顶层逍遥法外、底层绝望并存的残酷现实,认为这彻底粉碎了美式法治与人权的灯塔幻象,印证了中国道路的正确性。 主要主题 - 美式司法双标 - 政治交易工具 - 认知战与信息污染 - 资本凌驾法律 - 斩杀线与萝莉岛 - 阴谋论制造机制 - 制度性问题 - 资本主义法治 - 美国灯塔熄灭 - 中国道路自信
[message_id: cda17e67-4cd7-431a-aaf1-4799c2fbe297]
assistant: 蒋先生,文档内容已确认。有需要修改的地方吗?
user: [Fri 2026-02-13 18:35 GMT+8] 正文部分还是丢了Markdown标记。是AI原始输出就没带吗?再检查一下输入给AI的内容和AI输出的内容
[message_id: ff30c655-6076-4af5-b888-62b246c99290]
assistant: 让我检查代码,看看哪里清理了 Markdown:
assistant: 找到问题了!第 472-474 行在清理 Markdown。让我删除这些行:
assistant: 完成!✅ Markdown 格式已保留:
- `## 标题`
- `## 摘要`
- `**加粗文字**`
- `### 时间轴`
现在文档保留了完整的 Markdown 标记。需要提交推送吗?
user: System: [2026-02-13 18:38:07 GMT+8] Exec completed (tide-can, code 0) :: 内容长度: 8043 字符 [DeepAnalyzer] 将分 4 段分析 [AI Client] 开始调用 AI... [AI Client] AI 调用完成,耗时: 75.97秒 { "success": true, "filename": "bilibili_BV1W4f9B6EdC_final_v2.md", "filepath": "/home/starmen1265/work/knowledge-base/analyzed/bilibili_BV1W4f9B6EdC_final_v2.md", "message": "深度分析完成", "stats": { "summary_length": 273, "topics_count": 10, "insights_count": 5, "tags_count": 5 } }
System: [2026-02-13 18:38:41 GMT+8] Exec completed (rapid-sh, code 0)
[Fri 2026-02-13 18:38 GMT+8] 提交并推送
[message_id: d1ca58f2-4bce-4d1b-b1ce-88cb842e6082]
assistant: 已提交并推送!✅
```
fix: 保留 Markdown 格式不过滤
1 file changed, 1 insertion(+), 15 deletions(-)
```
user: System: [2026-02-13 18:38:55 GMT+8] Exec completed (kind-for, code 0)
System: [2026-02-13 18:39:06 GMT+8] Exec completed (swift-su, code 0)
System: [2026-02-13 18:39:26 GMT+8] Exec completed (tidy-tra, code 0)
[Fri 2026-02-13 18:42 GMT+8] 好,在使用AI进行深度分析的时候有指定使用哪个AI模型吗?希望能够指定用别名为g5的模型(原名zhipu/glm-5)。并且希望是由子代理进行分析。不影响主代理做其他事情。
[message_id: 0a9a6b20-1637-41b8-baee-9687f08f474f]
assistant: 浩南收到,蒋先生!让我查看 kb-workflow 技能并添加子代理调用:
assistant: deep_analyzer.py 已支持 `--model` 参数。现在修改 kb-workflow 技能,在深度分析步骤使用子代理并指定 g5:
assistant: 已完成!✅
修改内容:
- 深度分析步骤现在由**子代理**执行
- 使用 **g5 模型**(glm-5)
- 不影响主代理做其他事情
```bash
# 子代理调用示例
python3 /path/to/deep_analyzer.py \
--metadata [meta_path] \
--content [content_path] \
--output [analyzed_dir]/[filename].md \
--provider zhipu \
--model glm-5
```
user: [Fri 2026-02-13 18:43 GMT+8] 提交并推送
[message_id: f189f326-db19-419d-8334-79b02484cce6]
assistant: 蒋先生,刚刚已经提交并推送了!
```
feat: 深度分析使用 g5 模型并由子代理执行
1 file changed, 7 insertions(+), 3 deletions(-)
```
是否需要做其他修改?
+23
View File
@@ -52,3 +52,26 @@ tags: ["tag1", "tag2", ...]
## 备注
- AI 模型:glm-4.7
- 内容长度:约 8000 字符输入,生成详细分析报告
## 2026-02-13 知识库工作流
### BV1x3ctzkEdf 添加到知识库
- 视频标题:冬奥会和超级碗,为何让MAGA帝君破防?
- 工作流完整执行:
1. 链接解析 ✅
2. 元数据提取 ✅
3. 字幕下载:无官方字幕,使用 Whisper ✅
4. Whisper 语音识别:981秒,464分段 ✅
5. 深度分析:9主题,5洞察,5标签 ✅
6. 归档:/archive/2026-02-13/bilibili_BV1x3ctzkEdf.md ✅
### Git 仓库配置
- 远端仓库:ssh://sc-gitea@192.168.1.22:2223/starmen1265/knowledge-base.git
- 本地 archive 目录已关联远端仓库
- 成功推送到 Gitea(master 分支)
- kb_workflow.py 已更新归档流程:
1. 检查并初始化 Git 仓库
2. 关联远端仓库(KB_GIT_REMOTE 环境变量)
3. 拉取远端最新代码
4. 归档文件后自动 commit + push
5. 支持 main/master 分支自动兼容
+58 -23
View File
@@ -142,46 +142,81 @@ def archive_and_git(
}
try:
# 1. 创建归档目录
# 1. 检查并初始化 Git 仓库
git_dir = git_root / ".git"
if not git_dir.exists():
# 初始化仓库
subprocess.run(['git', 'init'], cwd=str(git_root), capture_output=True)
subprocess.run(['git', 'config', 'user.name', git_user], cwd=str(git_root))
subprocess.run(['git', 'config', 'user.email', git_email], cwd=str(git_root))
# 关联远端仓库
if git_remote:
subprocess.run(['git', 'remote', 'add', 'origin', git_remote], cwd=str(git_root), capture_output=True)
# 拉取远端分支
subprocess.run(['git', 'fetch', 'origin'], cwd=str(git_root), capture_output=True)
# 设置 main 分支并拉取
subprocess.run(['git', 'branch', '--set-upstream-to=origin/main', 'main'], cwd=str(git_root), capture_output=True)
subprocess.run(['git', 'pull', 'origin', 'main', '--rebase'], cwd=str(git_root), capture_output=True, timeout=120)
else:
# 已有仓库,检查远端是否配置
if git_remote:
remote_check = subprocess.run(['git', 'remote', '-v'], cwd=str(git_root), capture_output=True, text=True)
if 'origin' not in remote_check.stdout:
subprocess.run(['git', 'remote', 'add', 'origin', git_remote], cwd=str(git_root), capture_output=True)
# 拉取远端最新代码
subprocess.run(['git', 'fetch', 'origin'], cwd=str(git_root), capture_output=True)
# 尝试拉取 main 分支,如果失败则尝试 master
pull_result = subprocess.run(['git', 'pull', 'origin', 'main', '--rebase'], cwd=str(git_root), capture_output=True, timeout=120)
if pull_result.returncode != 0:
subprocess.run(['git', 'pull', 'origin', 'master', '--rebase'], cwd=str(git_root), capture_output=True, timeout=120)
# 2. 创建归档目录
date_str = datetime.now().strftime('%Y-%m-%d')
date_dir = base_path / "archive" / date_str
date_dir.mkdir(parents=True, exist_ok=True)
# 2. 复制分析报告
# 3. 复制分析报告
src_file = Path(analyzed_file)
archive_file = date_dir / src_file.name
shutil.copy(src_file, archive_file)
result["archive_path"] = str(archive_file)
# 3. 复制元数据
# 4. 复制元数据
meta_file = base_path / "metadata" / f"{src_file.stem}.meta.json"
if meta_file.exists():
shutil.copy(meta_file, date_dir / meta_file.name)
# 4. Git 操作
git_dir = git_root / ".git"
if not git_dir.exists():
subprocess.run(['git', 'init'], cwd=str(git_root), capture_output=True)
if git_user:
subprocess.run(['git', 'config', 'user.name', git_user], cwd=str(git_root))
if git_email:
subprocess.run(['git', 'config', 'user.email', git_email], cwd=str(git_root))
# 5. Git 提交并推送
if (git_root / ".git").exists():
# 添加所有变更
subprocess.run(['git', 'add', '.'], cwd=str(git_root), capture_output=True)
commit_msg = f"Archive: {src_file.name} - {datetime.now().isoformat()}"
commit_result = subprocess.run(
['git', 'commit', '-m', commit_msg],
cwd=str(git_root), capture_output=True, text=True
)
result["git_commit"] = commit_result.returncode == 0
if git_remote and commit_result.returncode == 0:
push_result = subprocess.run(
['git', 'push', 'origin', 'master'],
cwd=str(git_root), capture_output=True, text=True, timeout=60
# 检查是否有变更需要提交
status_result = subprocess.run(['git', 'status', '--porcelain'], cwd=str(git_root), capture_output=True, text=True)
if status_result.stdout.strip():
commit_msg = f"Archive: {src_file.name} - {datetime.now().isoformat()}"
commit_result = subprocess.run(
['git', 'commit', '-m', commit_msg],
cwd=str(git_root), capture_output=True, text=True
)
result["git_push"] = {"success": push_result.returncode == 0}
result["git_commit"] = commit_result.returncode == 0
# 推送到远端
if git_remote and commit_result.returncode == 0:
push_result = subprocess.run(
['git', 'push', 'origin', 'main'],
cwd=str(git_root), capture_output=True, text=True, timeout=60
)
if push_result.returncode != 0:
# 如果 main 分支推送失败,尝试 master
push_result = subprocess.run(
['git', 'push', 'origin', 'master'],
cwd=str(git_root), capture_output=True, text=True, timeout=60
)
result["git_push"] = {"success": push_result.returncode == 0, "output": push_result.stdout}
result["success"] = True