Skills 技能包
可被 AI Agent 直接调用的封装能力
draw-router
多通道图像生成执行器。把 Cloudflare / Agnes / DashScope 收进一条命令,按策略择优出图,失败自动降级,并对结果做质量门禁。
为什么需要它
单一图像通道会挂、会限流、会因模型先验把画面带偏。draw-router 把多个通道编排成一条带降级链的管线,让"出图"这件事对上层调用者变成一个稳定接口。
通道
| 通道 | 模型 | 免费额度 |
|---|---|---|
| Cloudflare SDXL | stable-diffusion-xl-base-1.0 | 10000 Neurons / 天 |
| Cloudflare Flux | flux-1-schnell | 10000 Neurons / 天 |
| Agnes AI | agnes-image-2.1-flash | 有限 |
| DashScope | qwen-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
策略
| 策略 | 通道顺序 | 场景 |
|---|---|---|
balanced | CF-SDXL → CF-Flux → Agnes → DashScope | 默认 |
cover | CF-SDXL → Agnes → CF-Flux | 封面 |
figure | Agnes → CF-SDXL → CF-Flux | 人像 |
draft | CF-Flux → CF-SDXL → Agnes | 草稿 |
art | CF-SDXL → Agnes → CF-Flux | 艺术 |
realistic | Dreamshaper → 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
}
质量门禁
- 文件大小:不小于 20KB,拦住"200 但空图"的假成功
- 格式校验:检查文件头魔数,确认为有效图像
- 瞬时重试:单通道失败自动重试,再降级到下一通道
配置
密钥经 provider-catalog.json 注入,不入库:
{
"providers": {
"cloudflare": { "account_id": "...", "api_token": "..." },
"agnes": { "api_key": "..." },
"dashscope": { "api_key": "..." }
}
}
更新于 2026-09 · Python 3.8+