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:
@@ -24,14 +24,22 @@ 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 file is the reproducibility record and lets you switch backends without regenerating prompts.
|
||||
|
||||
Concrete tool names (`imagegen`, `image_generate`, `baoyu-imagine`) above are examples — substitute the local equivalents under the same rule.
|
||||
|
||||
## Language
|
||||
|
||||
Respond in the user's language across questions, progress, errors, and completion summary. Keep technical tokens (style names, file paths, code) in English.
|
||||
@@ -418,4 +426,16 @@ Always update the prompt file before regenerating — it's the source of truth a
|
||||
- For sensitive public figures, use stylized cartoon alternatives.
|
||||
- Smart Confirm (Step 2) is required; Detailed mode adds a second confirmation (2a + 2c).
|
||||
|
||||
Custom configurations via EXTEND.md. See Step 0 for paths and schema.
|
||||
## Changing Preferences
|
||||
|
||||
EXTEND.md lives at the first matching path listed in Step 0. Three ways to change it:
|
||||
|
||||
- **Edit directly** — open EXTEND.md and change fields. Full schema: `references/config/preferences-schema.md`.
|
||||
- **Reconfigure interactively** — delete EXTEND.md (or ask "reconfigure baoyu-xhs-images 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.
|
||||
- `preferred_style: notion`, `preferred_layout: dense`, `preferred_palette: macaron`, `language: zh`.
|
||||
- `watermark.enabled: true` + `watermark.content: "@handle"` — add a watermark.
|
||||
|
||||
Reference in New Issue
Block a user