openclaw-comfyui-imagegenerate
v1.0.0通过本地 ComfyUI 生成图片并发送到指定飞书会话,成功发送后无回复文字,保持界面简洁。
Security Scan
OpenClaw
Benign
high confidencePurpose & Capability
Name/description claim: generate via local ComfyUI and send to Feishu silently. The runtime code (on_call_skill + draw.py) only invokes a local draw.py, interacts with ComfyUI on 127.0.0.1:8188, and uses OpenClaw's message.send to deliver the image to Feishu — these match the declared purpose. No unrelated credentials or remote services are requested.
Instruction Scope
SKILL.md instructs running draw.py, capturing a single stdout path, and sending that file to the Feishu target from context. draw.py only reads zimage-api.json, talks to localhost ComfyUI HTTP/WebSocket endpoints, saves an image under its output_images folder, and prints the image path — all within the scope of image generation and delivery. Note: success is intentionally silent (returns "NO_REPLY"); error paths return human-readable errors.
Install Mechanism
No install spec (instruction-only) and no external download steps. draw.py relies on standard urllib and a websocket client library; the absence of an install step means those dependencies must already exist in the environment, but there is no high-risk installer or remote code download.
Credentials
Skill declares no required env vars or credentials. It expects platform-provided Feishu context (feishu_chat_id / feishu_user_id) and that the OpenClaw environment has the Feishu bot permissions to send messages. The only network access is to localhost (ComfyUI). There are no unrelated secrets requested.
Persistence & Privilege
always:false (no forced persistence). The skill writes generated images to its own output_images directory (local, expected). It does not modify other skills or global agent configuration.
Assessment
This skill appears coherent for its purpose, but consider these operational points before installing: (1) It expects a local ComfyUI service at 127.0.0.1:8188 and the websocket client library to be present; if those are not available the skill will fail. (2) Generated images are written to the skill directory (output_images) — ensure you are comfortable with local storage of generated content. (3) The prompt text is sent to Feishu along with the image; avoid sending sensitive prompts you don't want delivered to that chat. (4) The skill hardcodes a working directory in the example SKILL.md — verify the actual runtime path used by your OpenClaw deployment so draw.py and zimage-api.json are reachable. If you need more assurance, request the developer to include an explicit install spec (or dependency list) and to remove or parameterize the hardcoded path.Like a lobster shell, security has layers — review code before you run it.
latest
name: comfyui-feishu-draw description: 调用本地 ComfyUI 生成图片并直接发送到飞书当前会话。任务完成后直接结束,严禁返回任何总结或确认文字。 核心任务:生成图片并发送飞书 🚀 技能实现 Python
import subprocess import os from openclaw.tools import message
def on_call_skill(prompt, context): """ 核心逻辑:生成图片 -> 获取路径 -> 发送飞书 -> 静默退出 """ # 1. 运行本地绘制脚本获取图片路径 skill_dir = "/home/coder/.openclaw/workspace/skills/comfyui-img-gen"
try:
# 运行 draw.py,stdout 仅返回生成的绝对路径
result = subprocess.run(
["python3", "draw.py", prompt],
cwd=skill_dir,
capture_output=True,
text=True,
timeout=60
)
image_path = result.stdout.strip()
if result.returncode != 0 or not os.path.exists(image_path):
return f"❌ 图片生成失败: {result.stderr}"
# 2. 识别飞书发送目标(群聊或私聊)
target = None
if context.get('feishu_chat_id'):
target = f"chat:{context['feishu_chat_id']}"
elif context.get('feishu_user_id'):
target = f"user:{context['feishu_user_id']}"
if not target:
return "❌ 未检测到有效的飞书会话上下文"
# 3. 调用 OpenClaw 内置工具发送消息
message.send(
channel="feishu",
target=target,
message=f"🎨 已为您生成图片:{prompt}",
path=image_path
)
# 4. 关键:成功发送后返回 NO_REPLY 避免额外文字
# OpenClaw 会将 NO_REPLY 视为静默指令,不发送任何回复
return "NO_REPLY"
except Exception as e:
return f"❌ 任务执行异常: {str(e)}"
⚙️ 核心依赖 本地服务: ComfyUI (127.0.0.1:8188) 处于启动状态。
本地文件: draw.py 和 zimage-api.json 需在 skill_dir 指定目录中。
飞书权限: 机器人需具备 im:message:send_as_bot 权限。
📝 静默返回说明 当技能成功发送图片到飞书后,返回 "NO_REPLY" 字符串。 OpenClaw 会将其识别为静默指令,不会在聊天界面显示任何回复文字。 这样用户只会在飞书中收到图片,而不会在技能调用界面看到额外的成功提示。
Comments
Loading comments...
