local-hub
本地能力中心。通过 HTTP 调用本机麦克风、摄像头、Ollama、YOLO、Stable Diffusion、TTS/转写、通知、剪贴板、天气、白名单脚本等。当需要「验证是否有声音、拍一张照、用本地模型对话、文生图/图生图、朗读、系统通知、读剪贴板、看图描述、列模型、天气、跑脚本」时使用。需先确保 local_hub 服务已启动(workspace/local_hub/run.sh)。
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/damianleemoha/local-hubLocal Hub — 本地能力中心
⚠️ 使用前必读:本 skill 仅包含「调用说明」,不包含服务端代码。实际提供接口的 local_hub 服务需在本机单独部署并先启动。服务未启动时,所有 curl 调用会连接失败。
服务端代码与下载:
- 仓库:https://github.com/DamianLeeMoha/local_hub
- 直接下载 zip:https://github.com/DamianLeeMoha/local_hub/releases/download/v1.0.0/local_hub-v1.0.0.zip
解压后进入目录,创建虚拟环境并安装依赖(python3 -m venv .venv-hub、source .venv-hub/bin/activate、pip install -r requirements.txt),再执行./run.sh。
这是什么:一个跑在你本机的 HTTP 服务(默认 http://127.0.0.1:9000),把麦克风、摄像头、Ollama、YOLO、Stable Diffusion 等统一成一组 API。Silas 通过 exec + curl 调用这些接口,不占用 OpenClaw 的 skill 检索维度,只是「多了一个可调的后端」。
与其它 skills 的关系:和 pptx、screen-capture 等不在同一维度——其它 skills 是「能力目录里的一条」;local_hub 是底层服务。本 skill 只是「调用说明」:告诉 Silas 何时、如何用 curl 去调这个服务。
前置条件
- 服务必须先启动(用户或你在本机执行一次):
cd ~/.openclaw/workspace/local_hub && source .venv-hub/bin/activate && ./run.sh - 健康检查(可选):
curl -s http://127.0.0.1:9000/health返回{"status":"ok",...}表示服务在线。
何时使用
| 需求 | 用哪个接口 | 说明 |
|---|---|---|
| 验证刚才播放的声音是否被听到 | POST /audio/check | 录约 1 秒,返回是否有声音(rms、has_sound) |
| 本机 TTS 朗读一段文字 | POST /audio/tts | JSON: text, voice(可选);macOS say,返回音频 path |
| 音频转文字 | POST /audio/transcribe | 上传 file 或 form path;需设 TRANSCRIBE_SCRIPT |
| 拍一张摄像头画面 | POST /camera/snapshot | 返回保存的图片路径 |
| 对一张图做目标检测(YOLO) | POST /vision/yolo | 需上传图片(form),返回检测框等 |
| 用视觉模型描述图片 | POST /vision/describe | 上传图片,Ollama llava 等;query model=llava |
| 用本地 Ollama 对话(含 openclaw-distill) | POST /llm/chat | JSON body:model, prompt, system(可选) |
| 列出本机 Ollama 模型 | GET /llm/models | 返回 models 列表 |
| 文本向量(embedding) | POST /llm/embed | JSON: model, text |
| 文生图(Stable Diffusion) | POST /image/txt2img | 需本机 A1111 在 7860 端口 |
| 图生图(Stable Diffusion) | POST /image/img2img | 需提供 image_path + prompt |
| 系统通知(macOS) | POST /notify | JSON: title, body |
| 读/写剪贴板 | GET /clipboard、POST /clipboard | GET 读文本,POST JSON text 写 |
| 系统状态(音量、电池等) | GET /system/status | macOS 简要状态 |
| 天气 | GET /weather | query 可选城市 |
| 执行白名单脚本 | POST /run/script | JSON: name, params(可选);需配置 RUN_SCRIPT_WHITELIST |
怎么用(curl 示例)
基地址:http://127.0.0.1:9000(若改过端口或主机,以实际为准)。
1. 检查是否有声音(播放后验证)
curl -s -X POST "http://127.0.0.1:9000/audio/check?duration=1&threshold=0.01"
返回示例:{"rms":0.02,"threshold":0.01,"has_sound":true,"duration":1.0}。看 has_sound 为 true/false。
2. 摄像头拍一张
curl -s -X POST http://127.0.0.1:9000/camera/snapshot
返回示例:{"path":"/Users/.../local_hub/data/camera_1234567890.jpg"}。后续可读该文件或交给 describe-image。
3. 本地 Ollama 对话
curl -s -X POST http://127.0.0.1:9000/llm/chat \
-H "Content-Type: application/json" \
-d '{"model":"openclaw-distill","prompt":"你好","system":null}'
返回里有 response 字段即模型回复。可换 qwen2.5:14b、llava 等本机已有模型。
4. YOLO 检测(上传图片)
curl -s -X POST http://127.0.0.1:9000/vision/yolo \
-F "file=@/path/to/image.jpg"
返回 detections 列表及保存路径。
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-damianleemoha-local-hub": {
"enabled": true,
"auto_update": true
}
}
}