← 返回 Skills 市场
openclawzhangchong

moondream-vision-zc

作者 张翀 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
62
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install moondream-vision-zc
功能描述
利用本地 Ollama 运行 Moondream 模型对图像进行理解,返回自然语言描述,可直接在聊天中发送图片或文件路径调用。
使用说明 (SKILL.md)

SKILL.md - Moondream Vision

name: moondream-vision-zc description: 使用本地 Ollama 部署的 Moondream 模型进行图像理解,并将结果返回给 OpenClaw。该 Skill 适配 OpenClaw 2026 版本的多模态插件机制,可在聊天中直接发送图片或引用本地文件路径。 type: command

环境准备

  1. 确保 Ollama 已安装
    • Windows:winget install ollama 或从 https://ollama.com/download 下载并安装。
    • 安装完成后,在 PowerShell 中运行 ollama serve,确保后台服务在 11434 端口监听。
  2. 拉取 Moondream 模型(如果尚未本地缓存)
    ollama pull moondream
    
    • 若已有本地模型,可跳过此步骤。
  3. 验证模型
    ollama run moondream "一张猫的图片"
    
    • 返回文字描述即表示模型工作正常。
  4. 安装 Python 依赖(仅在使用脚本时需要)
    pip install requests
    
    • 脚本通过 HTTP 调用 Ollama API。

Skill 实现

目录结构

~/.openclaw/skills/moondream-vision/
├─ SKILL.md          # 本文件
└─ scripts/
   └─ moondream_vision.py

scripts/moondream_vision.py

import sys, json, base64, requests, pathlib

OLLAMA_URL = "http://127.0.0.1:11434/api/generate"

def encode_image(path: str) -> str:
    data = pathlib.Path(path).read_bytes()
    return base64.b64encode(data).decode("utf-8")

def run_moondream(image_path: str, prompt: str = ""):
    img_b64 = encode_image(image_path)
    payload = {
        "model": "moondream",
        "prompt": prompt,
        "images": [img_b64],
        "stream": False,
    }
    resp = requests.post(OLLAMA_URL, json=payload)
    resp.raise_for_status()
    result = resp.json()
    # Ollama returns a stream of tokens; when stream=False we get full response in ``response``
    return result.get("response", "")

if __name__ == "__main__":
    if len(sys.argv) \x3C 2:
        sys.stderr.write("Usage: python moondream_vision.py \x3Cimage_path> [prompt]\
")
        sys.exit(1)
    image = sys.argv[1]
    user_prompt = sys.argv[2] if len(sys.argv) > 2 else ""
    print(run_moondream(image, user_prompt))

在 OpenClaw 中注册命令

~/.openclaw/config/skills.json(若不存在请创建)添加如下条目:

{
  "name": "moondream-vision",
  "command": "python ${skill_dir}/scripts/moondream_vision.py",
  "description": "本地 Moondream 图像理解",
  "usage": "!moondream \x3Cimage_path> [prompt]",
  "args": ["image_path", "prompt?"],
  "output": "text"
}
  • ${skill_dir} 为此 skill 所在目录的绝对路径,OpenClaw 会在运行时自动替换。
  • 通过 !moondream D:\images\cat.jpg 在聊天中调用。

多模态接入方案说明

  • 模型:Moondream 是轻量级的视觉语言模型,适合本地推理。它通过 Ollama 的 REST API 接收 base64 编码的图像和可选文字提示,返回自然语言描述。
  • 与 GPT‑OSS‑120B 结合
    • 在需要更深层次的推理时,可将 Moondream 的输出作为 系统提示 传递给 GPT‑OSS‑120B,让后者进行复杂的分析、摘要或跨模态推理。
    • 示例工作流:
      1. !moondream img.png ➜ 获得图片描述 desc
      2. 调用 !gpt "基于以下描述,写一段新闻稿:\ ${desc}"
  • 性能:Moondream 推理在普通笔记本 CPU 上约 1‑2 秒/图像,GPU 可进一步加速。GPT‑OSS‑120B 仍通过 OpenClaw 统一调度,保持统一日志与审计。

常见问题 & 调试

  • Ollama 未启动:确保 ollama serve 正在运行,检查防火墙是否阻止 11434 端口。
  • 图片过大:Ollama 限制单张图片约 5 MB,建议在本地压缩后再发送。
  • 返回空:确认 prompt 参数非空,或在 payload 中加入 "system": "" 防止模型误判。

使用示例

用户:!moondream C:\Users\Administrator\Pictures\dog.jpg
Assistant: 这是一只棕色的狗,正坐在草地上,注视着镜头。

用户:!moondream C:\Users\Administrator\Pictures\dog.jpg "请把这张图的内容写成一段简短的广告文案"
Assistant: 「爱犬的欢笑,尽在自然」——让您的宠物在绿意盎然的草地上自由奔跑,感受生活的活力。

如有其他需求可进一步扩展,如批量处理、返回 JSON 结构等。

安全使用建议
This skill appears coherent, but review the following before installing: - Verify you only run Ollama and the Moondream model from trusted sources (download Ollama from the official site) because local models can read any images you give them. - The skill sends base64-encoded images to http://127.0.0.1:11434 — ensure Ollama is bound to localhost and not exposed to the network, otherwise other hosts could access the service and your images. - The provided script reads any file path you pass; avoid passing sensitive files or unspecified paths. Use it only with images you intend to analyze. - If you install the Python dependency (requests), perform that in a virtualenv if you prefer to avoid modifying the system Python environment. - Confirm the Moondream model source and license if you care about provenance or data-handling guarantees. If you want extra assurance, run Ollama in a sandboxed environment and inspect the model artifacts before use.
功能分析
Type: OpenClaw Skill Name: moondream-vision-zc Version: 1.0.0 The skill is a straightforward implementation of a local image-to-text tool using the Moondream model via Ollama. The Python script (moondream_vision.py) reads a local image file, encodes it to base64, and sends it to a local API endpoint (127.0.0.1:11434); it contains no external network calls, obfuscation, or unauthorized file access logic beyond its stated purpose.
能力评估
Purpose & Capability
Name/description claim local image understanding via a Moondream model served by Ollama; the SKILL.md only asks the user to install Ollama, pull the model, and call the local Ollama HTTP API — all proportional to the stated purpose.
Instruction Scope
Runtime instructions are limited to: starting a local Ollama server, pulling/running a local model, base64-encoding a user-supplied image file, and posting it to http://127.0.0.1:11434. The skill reads image files provided by the user (expected for image-understanding) and writes a local skills registration entry; it does not instruct reading arbitrary unrelated files or sending data to external hosts.
Install Mechanism
This is an instruction-only skill with no install spec or bundled binaries. It defers to user-installed Ollama and an optional pip dependency (requests), which is appropriate and low-risk for this use case.
Credentials
No environment variables, credentials, or config paths are requested. The instructions only reference the local Ollama service and a user-supplied image path, which aligns with the stated functionality.
Persistence & Privilege
The skill does not request always:true or other elevated persistence. It asks the user to add an entry to the user's own ~/.openclaw/config/skills.json (expected for registering a skill) and does not modify other skills or system-wide settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install moondream-vision-zc
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /moondream-vision-zc 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Moondream Vision by zhangchong Skill 1.0.0 - Initial Release - 支持在本地通过 Ollama 部署 Moondream 模型进行图像理解,并返回自然语言描述。 - 完全适配 OpenClaw 2026 版本多模态插件机制,支持在聊天中发送图片或本地文件路径。 - 提供 Python 脚本调用 Ollama API,支持自定义 prompt,响应文本输出。 - 原生注册命令,可通过 `!moondream <image_path> [prompt]` 方式集成并调用。 - 文档包含详细环境准备、常见问题、与 GPT‑OSS‑120B 的集成和使用示例。
元数据
Slug moondream-vision-zc
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

moondream-vision-zc 是什么?

利用本地 Ollama 运行 Moondream 模型对图像进行理解,返回自然语言描述,可直接在聊天中发送图片或文件路径调用。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 62 次。

如何安装 moondream-vision-zc?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install moondream-vision-zc」即可一键安装,无需额外配置。

moondream-vision-zc 是免费的吗?

是的,moondream-vision-zc 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

moondream-vision-zc 支持哪些平台?

moondream-vision-zc 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 moondream-vision-zc?

由 张翀(@openclawzhangchong)开发并维护,当前版本 v1.0.0。

💬 留言讨论