Skills 技能包

可被 AI Agent 直接调用的封装能力

draw-router

多通道图像生成执行器。把 Cloudflare / Agnes / DashScope 收进一条命令,按策略择优出图,失败自动降级,并对结果做质量门禁。

为什么需要它

单一图像通道会挂、会限流、会因模型先验把画面带偏。draw-router 把多个通道编排成一条带降级链的管线,让"出图"这件事对上层调用者变成一个稳定接口。

通道

通道模型免费额度
Cloudflare SDXLstable-diffusion-xl-base-1.010000 Neurons / 天
Cloudflare Fluxflux-1-schnell10000 Neurons / 天
Agnes AIagnes-image-2.1-flash有限
DashScopeqwen-image-3.0付费

用法

# 基本
python skills/draw-router/scripts/draw-router.py "一只白鹭在雾中飞翔"

# 指定策略与比例
python skills/draw-router/scripts/draw-router.py "prompt" --profile cover --ratio 3:4

# 只用免费通道
python skills/draw-router/scripts/draw-router.py "prompt" --free-only

# 自检 / 统计
python skills/draw-router/scripts/draw-router.py --diagnose
python skills/draw-router/scripts/draw-router.py --stats

策略

策略通道顺序场景
balancedCF-SDXL → CF-Flux → Agnes → DashScope默认
coverCF-SDXL → Agnes → CF-Flux封面
figureAgnes → CF-SDXL → CF-Flux人像
draftCF-Flux → CF-SDXL → Agnes草稿
artCF-SDXL → Agnes → CF-Flux艺术
realisticDreamshaper → CF-SDXL → Agnes写实

输出

stdout 末行输出结构化 JSON,便于上层解析:

{
  "success": true,
  "provider": "cloudflare-sdxl",
  "model": "stable-diffusion-xl-base-1.0",
  "file_path": "/path/to/output.png",
  "file_size": 2048576,
  "generation_time": 19.5
}

质量门禁

配置

密钥经 provider-catalog.json 注入,不入库:

{
  "providers": {
    "cloudflare": { "account_id": "...", "api_token": "..." },
    "agnes":      { "api_key": "..." },
    "dashscope":  { "api_key": "..." }
  }
}
更新于 2026-09 · Python 3.8+