mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-07-12 05:51:44 +08:00
refactor: unify image-backend resolution with preferred_image_backend preference
Replaces the stateless ask-once backend rule with a 4-step resolution (current-request override > saved preference > auto-select > ask) and adds a single `preferred_image_backend` field (auto | ask | <backend-id>) to every image-consuming skill's EXTEND.md schema. Runtime-native tools (Codex `imagegen`, Hermes `image_generate`, ...) win by default; absent field equals `auto` so existing user EXTEND.md files stay valid with no schema version bump. Each image-consuming skill also gains a top-level `## Changing Preferences` section as a first-class surface for pinning a backend and editing common one-line preferences. Applies across: - baoyu-infographic (reverts in-progress two-field image_backend_mode design) - baoyu-comic - baoyu-cover-image - baoyu-image-cards - baoyu-article-illustrator - baoyu-slide-deck - baoyu-xhs-images - docs/image-generation-tools.md (canonical author-side doc)
This commit is contained in:
@@ -23,11 +23,17 @@ Concrete `AskUserQuestion` references below are examples — substitute the loca
|
||||
|
||||
## Image Generation Tools
|
||||
|
||||
When this skill needs to render an image:
|
||||
When this skill needs to render an image, resolve the backend in this order:
|
||||
|
||||
- **Use whatever image-generation tool or skill is available** in the current runtime — e.g., Codex `imagegen`, Hermes `image_generate`, `baoyu-imagine`, or any equivalent the user has installed.
|
||||
- **If multiple are available**, ask the user **once** at the start which to use (batch with any other initial questions).
|
||||
- **If none are available**, tell the user and ask how to proceed.
|
||||
1. **Current-request override** — if the user names a specific backend in the current message, use it.
|
||||
2. **Saved preference** — if `EXTEND.md` sets `preferred_image_backend` to a backend available right now, use it.
|
||||
3. **Auto-select** (when the preference is `auto`, unset, or the pinned backend isn't available):
|
||||
- If the current runtime exposes a native image tool (e.g., Codex `imagegen`, Hermes `image_generate`), use it. Runtime-native tools are preferred by default — agents that know their own tool inventory should surface the native one here.
|
||||
- Otherwise, if exactly one non-native backend is installed (e.g., `baoyu-imagine`), use it.
|
||||
- Otherwise (multiple non-native backends with no runtime-native tool), ask the user once — batch with any other initial questions.
|
||||
4. **If none are available**, tell the user and ask how to proceed.
|
||||
|
||||
Setting `preferred_image_backend: ask` forces the step-3 prompt every run regardless of available backends. Users change the pinned backend via the `## Changing Preferences` section below.
|
||||
|
||||
**Prompt file requirement (hard)**: write each image's full, final prompt to a standalone file under `prompts/` (naming: `NN-{type}-[slug].md`) BEFORE invoking any backend. The backend receives the prompt file (or its content); the file is the reproducibility record and lets you switch backends without regenerating prompts.
|
||||
|
||||
@@ -228,13 +234,18 @@ Files:
|
||||
- **Characters**: Simplified silhouettes; NO realistic humans
|
||||
- **Title**: Use exact title from user/source; never invent
|
||||
|
||||
## Extension Support
|
||||
## Changing Preferences
|
||||
|
||||
Custom configurations via EXTEND.md. See **Step 0** for paths.
|
||||
EXTEND.md lives at the path noted in **Step 0**. Three ways to change it:
|
||||
|
||||
Supports: Watermark | Preferred dimensions | Default aspect/output | Quick mode | Custom palettes | Language
|
||||
|
||||
Schema: [references/config/preferences-schema.md](references/config/preferences-schema.md)
|
||||
- **Edit directly** — open EXTEND.md and change fields. Full schema: [references/config/preferences-schema.md](references/config/preferences-schema.md).
|
||||
- **Reconfigure interactively** — delete EXTEND.md (or ask "reconfigure baoyu-cover-image preferences" / "重新配置"). The next run re-triggers first-time setup.
|
||||
- **Common one-line edits**:
|
||||
- `preferred_image_backend: auto` — default; runtime-native tool wins, falls back to the only installed backend, asks only if multiple non-native are present.
|
||||
- `preferred_image_backend: codex-imagegen` — pin to Codex's built-in.
|
||||
- `preferred_image_backend: baoyu-imagine` — pin to the baoyu-imagine skill.
|
||||
- `preferred_image_backend: ask` — confirm backend every run.
|
||||
- `watermark.enabled: true`, `preferred_type`, `preferred_palette`, `preferred_rendering`, `default_aspect`, `quick_mode: true`, `language` — shift the auto-selection defaults and confirmation flow.
|
||||
|
||||
## References
|
||||
|
||||
|
||||
Reference in New Issue
Block a user