Axelhu Local Sdxl

# 本地 SDXL 生图 (axelhu-local-sdxl)

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "Axelhu Local Sdxl" with this command: npx skills add axelhu/axelhu-local-sdxl

本地 SDXL 生图 (axelhu-local-sdxl)

基于 ComfyUI + SDXL 的本地图片生成技能。适用于需要高质量配图、素材生成、本地私密生图、或对在线生成有频率限制的场景。

触发时机

在以下场景时使用:

  • 用户/其他 agent 说"本地生图"、"本地SD生图"、"用本地工具生成图片"
  • 用户/其他 agent 说"私密生图"、"脱敏生图"、"不上传在线"
  • 需要生成涉及隐私、测试、商业素材的内容,且明确指定本地处理
  • 需要精细控制构图、风格、尺寸的生图任务,且指定本地执行

不要用于:

  • 默认生图请求(那些默认走在线服务,如 Midjourney/DALL-E)
  • 用户说"生成图片"、"画一张图"且没有指定本地(默认在线优先)

使用方式

直接描述想要的图片内容,例如:

  • "帮我生成一张科技感十足的封面图"
  • "画一个程序员深夜编程的场景,插画风格"
  • "生成一张杭州西湖的夜景图,高清写实风格"

Agent 收到后执行生图脚本,发送结果给用户。

技术规格

项目参数
模型Stable Diffusion XL 1.0 (fp16)
显卡NVIDIA RTX 3080 (10GB VRAM)
出图尺寸默认 1024×768,可调整
生图速度~18秒/张(euler 采样,20步)
可用采样器euler, dpmpp_2m, lcm, ddim 等
API 端口localhost:8188

Agent 调用方法

方式一:通过脚本调用(推荐)

import subprocess
result = subprocess.run(
    ["python3", "/path/to/scripts/sdxl_generate.py",
     "--prompt", "一只狐狸在森林里",
     "--negative", "模糊, 低质量",
     "--steps", "20",
     "--seed", "42",
     "--output", "/tmp/output.png"],
    capture_output=True, text=True
)
print(result.stdout)

方式二:直接调 ComfyUI REST API

import requests, time, json

COMFYUI = "http://localhost:8188"

def generate(prompt, negative="", steps=20, seed=42, width=1024, height=768):
    workflow = {
        "loader": {"class_type": "CheckpointLoaderSimple",
                   "inputs": {"ckpt_name": "sdxl-base-1.0.safetensors"}},
        "positive": {"class_type": "CLIPTextEncode",
                     "inputs": {"text": prompt, "clip": ["loader", 1]}},
        "negative": {"class_type": "CLIPTextEncode",
                      "inputs": {"text": negative, "clip": ["loader", 1]}},
        "latent": {"class_type": "EmptyLatentImage",
                   "inputs": {"width": width, "height": height, "batch_size": 1}},
        "sampler": {"class_type": "KSampler",
                    "inputs": {"seed": seed, "steps": steps, "cfg": 7.0,
                               "sampler_name": "euler", "scheduler": "normal",
                               "denoise": 1.0,
                               "positive": ["positive", 0], "negative": ["negative", 0],
                               "model": ["loader", 0], "latent_image": ["latent", 0]}},
        "decode": {"class_type": "VAEDecode",
                   "inputs": {"samples": ["sampler", 0], "vae": ["loader", 2]}},
        "save": {"class_type": "SaveImage",
                 "inputs": {"images": ["decode", 0], "filename_prefix": "sdxl_gen"}}
    }
    r = requests.post(f"{COMFYUI}/prompt", json={"prompt": workflow})
    pid = r.json()["prompt_id"]
    # 等待完成(轮询)
    for _ in range(30):
        time.sleep(2)
        hist = requests.get(f"{COMFYUI}/history/{pid}").json()
        if pid in hist:
            return f"{COMFYUI}/view?filename=sdxl_gen_00001_.png"
    return None

参数说明

参数默认值说明
--prompt(必填)图片描述,越详细越好
--negative"blurry, low quality, distorted"反向提示词
--steps20采样步数,越高质量越好越慢
--seed随机种子,决定具体画面
--width1024宽度(8的倍数)
--height768高度(8的倍数)
--samplereuler采样器(euler/dpmpp_2m/lcm/ddim)
--cfg7.0CFG 强度(1-20)
--output自动输出路径

快速参考:常用场景

场景推荐参数
写实风景/人物--steps 25 --cfg 7 --sampler euler
动漫/插画风格--steps 20 --cfg 8 --negative "写实, 照片"
快速草图/验证--steps 4 --sampler lcm --cfg 1.0(需要 LCM 模型)
16:9 横幅图--width 1280 --height 720

输出格式

生图完成后,脚本自动将图片保存到指定路径或 /tmp/ 目录,并通过飞书发送图片消息给用户。

注意事项

  • ComfyUI 服务必须已启动(python3 main.py --port 8188
  • RTX 3080 推荐分辨率 1024×768 以下,更高分辨率可能爆显存
  • 生图过程约 18 秒,请提前告知用户等待
  • 图片风格默认写实,如需特定风格在 prompt 中描述

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Multi Edge-TTS CN

Edge-TTS 在线语音合成 skill。基于微软 Edge TTS 引擎,生成速度快(1-2秒),支持多种音色和输出格式。同时支持飞书(OGG/Opus)和企业微信(AMR)。默认音色 xiaoxiao_lively。需联网。

Registry SourceRecently Updated
General

vedic-destiny

吠陀命盘分析中文入口。用于完整命盘研判、命主盘 Rashi chart 与九分盘 Navamsha chart 联读、既往事件回看、出生时间稳定度判断、事业主题、婚姻主题、时空盘专题,以及基于 Jagannatha Hora PDF、星盘截图或文本命盘数据的系统拆盘。当用户提到完整星盘、事业方向、婚姻问题、关系窗...

Registry SourceRecently Updated
General

One Person Company OS

Build a visual operating cockpit for an AI-native one-person company across promise, buyer, product, delivery, cash, learning, and assets. / 为 AI 一人公司建立可视化经营...

Registry SourceRecently Updated
General

健康追踪

健康追踪技能 - 追踪饮水、睡眠、步数等健康数据,JSON存储。

Registry SourceRecently Updated