Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

feat(confirm-ui): add illustration usage toggle to image confirmation

hugohe3fca3628e7157
diff --git a/skills/ppt-master/scripts/confirm_ui/static/app.js b/skills/ppt-master/scripts/confirm_ui/static/app.js
index 9c55713a..5a12c95f 100644
--- a/skills/ppt-master/scripts/confirm_ui/static/app.js
+++ b/skills/ppt-master/scripts/confirm_ui/static/app.js
@@ -1,6 +1,6 @@
/* PPT Master - Eight Confirmations UI
* Finite/enumerable fields (canvas, mode, visual style, icons, image usage,
- * AI source, formula policy, generation mode) list ALL options from
+ * illustration usage, AI source, formula policy, generation mode) list ALL options from
* /static/catalogs.json with the AI's recommendation marked. Open/generative
* fields (color, typography, generated-image style) show >=3 AI candidates. Open fields also expose
* Custom controls. On confirm the page saves result.json and closes.
@@ -52,6 +52,7 @@
image_strategy_color: "Color",
image_strategy_mood: "Mood",
image_usage_custom_required: "Describe the custom image plan before confirming.",
+ illustration_usage: "Illustration usage",
font_heading: "Heading",
font_body: "Body",
font_body_size: "Body baseline size",
@@ -132,6 +133,7 @@
image_strategy_color: "色彩",
image_strategy_mood: "情绪",
image_usage_custom_required: "请先写清楚自定义图片方案。",
+ illustration_usage: "插图使用",
font_heading: "标题",
font_body: "正文",
font_body_size: "正文基准字号",
@@ -288,6 +290,7 @@
if (field === "visual_style") return REC.visual_style || (REC.style && REC.style.value);
if (field === "icons") return REC.icons && REC.icons.value;
if (field === "image_usage") return REC.images && REC.images.value;
+ if (field === "illustration_usage") return REC.illustrations && REC.illustrations.value;
if (field === "image_ai_path") return REC.image_ai_path || (REC.images && REC.images.ai_path);
if (field === "formula_policy") return REC.typography && REC.typography.formula_policy && REC.typography.formula_policy.value;
if (field === "generation_mode") return REC.generation_mode && REC.generation_mode.value;
@@ -1197,8 +1200,14 @@
? "例如:封面用 AI 生成,产品页用用户素材,行业页用网络来源"
: "e.g. AI cover + user product assets + web industry images"
});
+ var illusSub = el("div", "subfield");
+ illusSub.appendChild(el("div", "subfield-label", t("illustration_usage")));
+ enumField(illusSub, CAT.illustration_usage, recOrFirst("illustration_usage", CAT.illustration_usage),
+ function () { return STATE.illustration_usage; },
+ function (v) { STATE.illustration_usage = v; });
enumField(sub, CAT.image_ai_path, recOrFirst("image_ai_path", CAT.image_ai_path),
function () { return STATE.image_ai_path; }, function (v) { STATE.image_ai_path = v; });
+ sec.appendChild(illusSub);
sec.appendChild(sub);
sec.appendChild(strategySub);
if (strategyCands.length) selectImageStrategy(imageStrategySelectedIndex());
@@ -1332,6 +1341,7 @@
STATE.formula_policy = pick("formula_policy", CAT.formula_policy);
STATE.image_usage = pick("image_usage", CAT.image_usage);
+ STATE.illustration_usage = pick("illustration_usage", CAT.illustration_usage);
STATE.image_ai_path = pick("image_ai_path", CAT.image_ai_path);
STATE.generation_mode = pick("generation_mode", CAT.generation_mode);
diff --git a/skills/ppt-master/scripts/confirm_ui/static/catalogs.json b/skills/ppt-master/scripts/confirm_ui/static/catalogs.json
index 231a5ea8..210156ba 100644
--- a/skills/ppt-master/scripts/confirm_ui/static/catalogs.json
+++ b/skills/ppt-master/scripts/confirm_ui/static/catalogs.json
@@ -377,6 +377,24 @@
"label_en": "No images"
}
],
+ "illustration_usage": [
+ {
+ "id": "none",
+ "label": "不刻意使用插图",
+ "label_zh": "不刻意使用插图",
+ "label_en": "No intentional illustrations",
+ "desc_zh": "默认选项;仅在内容本身需要时使用图片。",
+ "desc_en": "Default. Use images only when the content itself needs them."
+ },
+ {
+ "id": "use",
+ "label": "使用插图",
+ "label_zh": "使用插图",
+ "label_en": "Use illustrations",
+ "desc_zh": "让插图成为版面的一部分;用多用少由系统按内容与视觉风格判断。",
+ "desc_en": "Let illustrations be part of the design; how heavily is decided by content and visual style."
+ }
+ ],
"image_ai_path": [
{
"id": "auto",
diff --git a/skills/ppt-master/scripts/docs/confirm_ui.md b/skills/ppt-master/scripts/docs/confirm_ui.md
index 352aa41b..b3810ee1 100644
--- a/skills/ppt-master/scripts/docs/confirm_ui.md
+++ b/skills/ppt-master/scripts/docs/confirm_ui.md
@@ -1,6 +1,6 @@
# Confirm UI — Eight Confirmations Page
-> The interactive, visual surface for SKILL.md Step 4 (the Eight Confirmations). Enumerable fields list **all** options from a catalog with the AI's recommendation badged; generative fields (color, typography, generated-image style) show **≥3** AI candidates (creative recommendations always offer real choice — same rule as the h.5 image strategy; fewer only on the honest-shortfall exception, with a stated reason). Fields whose universe is open (canvas, mode, visual style, icons, image usage) also get a **Custom** box; fully closed fields (AI source when applicable, formula policy, generation mode, refine spec) do not. The AI writes its recommendation to `recommendations.json`; the user's final choices are written back to `result.json` for the AI to read. On confirm the page saves the result and shuts the server down (auto-close). The chat path is always a valid fallback — if the browser cannot open (remote / headless / web host), the AI presents the same confirmations in chat.
+> The interactive, visual surface for SKILL.md Step 4 (the Eight Confirmations). Enumerable fields list **all** options from a catalog with the AI's recommendation badged; generative fields (color, typography, generated-image style) show **≥3** AI candidates (creative recommendations always offer real choice — same rule as the h.5 image strategy; fewer only on the honest-shortfall exception, with a stated reason). Fields whose universe is open (canvas, mode, visual style, icons, image usage) also get a **Custom** box; fully closed fields (illustration usage, AI source when applicable, formula policy, generation mode, refine spec) do not. The AI writes its recommendation to `recommendations.json`; the user's final choices are written back to `result.json` for the AI to read. On confirm the page saves the result and shuts the server down (auto-close). The chat path is always a valid fallback — if the browser cannot open (remote / headless / web host), the AI presents the same confirmations in chat.
## `confirm_ui/server.py`
@@ -32,16 +32,16 @@ pip install flask
## Two kinds of field
- **Enumerable + custom** — canvas / mode / visual_style / icons / image usage. The page lists common options from `static/catalogs.json`, badges the AI's recommendation, and still offers a Custom box for edge cases (custom canvas size, bespoke narrative mode, mixed image plan, self-provided icon system, etc.). `visual_style` additionally honors an optional `visual_style_spectrum` that badges a 3-pick personality spectrum (safe / shifted / bold, each with a temperament tag + analogy) in place of the single recommendation — see the schema below.
-- **Closed enumerable** — formula policy / generation mode / refine spec, plus AI source only when image usage may include `ai`. These have no Custom box; out-of-catalog values snap back to the recommended option. Use pipeline vocabulary: icon ids are actual library ids such as `tabler-outline`, or `emoji` for system emoji; image usage labels mirror Strategist terminology: `ai` = AI-generated, `web` = Web-sourced, `provided` = User-provided, `placeholder` = Placeholder, `none` = No images. Use custom prose only when several sources are mixed.
+- **Closed enumerable** — illustration usage / formula policy / generation mode / refine spec, plus AI source only when image usage may include `ai`. These have no Custom box; out-of-catalog values snap back to the recommended option. Use pipeline vocabulary: icon ids are actual library ids such as `tabler-outline`, or `emoji` for system emoji; image usage labels mirror Strategist terminology: `ai` = AI-generated, `web` = Web-sourced, `provided` = User-provided, `placeholder` = Placeholder, `none` = No images. Use image-usage custom prose only when several sources are mixed. `illustration_usage` is a closed two-option intent toggle (`none` / `use`) — how heavily illustrations are used and where they are sourced are decided downstream by Strategist + `image_usage`, not here.
- **Generative (open)** — color, typography, generated-image style. No finite catalog; the AI authors **≥3 candidates** the page renders as cards (never a single option — creative fields must offer real choice; fewer than 3 only on the honest-shortfall exception). `page_count`, `audience`, and `content_divergence` are free inputs (`content_divergence` is a free-text intent shown under audience in §c, not a fixed-option field).
-**Custom box** appears only on fields whose universe is genuinely open — `canvas`, `mode`, `visual_style`, `icons`, and `image_usage`. Fully closed sets — `image_ai_path`, `formula_policy`, `generation_mode`, `refine_spec` — have **no** Custom box; an out-of-catalog value there is snapped back to the recommended option.
+**Custom box** appears only on fields whose universe is genuinely open — `canvas`, `mode`, `visual_style`, `icons`, and `image_usage`. Fully closed sets — `illustration_usage`, `image_ai_path`, `formula_policy`, `generation_mode`, `refine_spec` — have **no** Custom box; an out-of-catalog value there is snapped back to the recommended option.
`image_ai_path` is conditional: the page shows it and writes it to `result.json` only when `image_usage` is `ai` or a custom image plan that may include AI. Web-sourced / User-provided / Placeholder / No images paths do not carry an AI backend choice.
## Catalogs — `static/catalogs.json` (the finite option universe)
-The front-end loads `/api/catalogs` (served by the confirm server) and falls back to the static `/static/catalogs.json` if that route is unavailable. `/api/catalogs` returns the static file **with the `canvas` list synced live from `config.py CANVAS_FORMATS`** — the set of formats and their `dim` come from config (single source of truth, zero drift), while bilingual labels / use text stay in catalogs.json (a plain fallback label is synthesized for any new id config adds). Keys: `canvas`, `modes`, `visual_styles` (grouped), `icons`, `image_usage`, `image_ai_path`, `formula_policy`, `generation_mode`, `delivery_purpose`. Each entry is `{ "id", "label", "label_zh", "label_en", ... }`; descriptions use `desc_zh` / `desc_en`, and `visual_styles` groups use `group_zh` / `group_en`. The front-end falls back to legacy `label` / `desc` / `group`, so old catalogs still load, but new user-facing catalog text must be bilingual. English labels should mirror canonical reference names (`pyramid`, `swiss-minimal`, `Path A`, `mixed`, etc.); Chinese labels should be translated for users. Descriptions render inline after the option title, not as a separate selected-option line. `visual_styles` is `[{ "group", "group_zh", "group_en", "items": [...] }]`. For `canvas` you only need to maintain the bilingual labels in catalogs.json; the format set and dimensions are authoritative in `config.py CANVAS_FORMATS`.
+The front-end loads `/api/catalogs` (served by the confirm server) and falls back to the static `/static/catalogs.json` if that route is unavailable. `/api/catalogs` returns the static file **with the `canvas` list synced live from `config.py CANVAS_FORMATS`** — the set of formats and their `dim` come from config (single source of truth, zero drift), while bilingual labels / use text stay in catalogs.json (a plain fallback label is synthesized for any new id config adds). Keys: `canvas`, `modes`, `visual_styles` (grouped), `icons`, `image_usage`, `illustration_usage`, `image_ai_path`, `formula_policy`, `generation_mode`, `delivery_purpose`. Each entry is `{ "id", "label", "label_zh", "label_en", ... }`; descriptions use `desc_zh` / `desc_en`, and `visual_styles` groups use `group_zh` / `group_en`. The front-end falls back to legacy `label` / `desc` / `group`, so old catalogs still load, but new user-facing catalog text must be bilingual. English labels should mirror canonical reference names (`pyramid`, `swiss-minimal`, `Path A`, `mixed`, etc.); Chinese labels should be translated for users. Descriptions render inline after the option title, not as a separate selected-option line. `visual_styles` is `[{ "group", "group_zh", "group_en", "items": [...] }]`. For `canvas` you only need to maintain the bilingual labels in catalogs.json; the format set and dimensions are authoritative in `config.py CANVAS_FORMATS`.
## Round-trip data contract
@@ -54,7 +54,7 @@ The page runs as a **two-tier wizard in one browser session**. `recommendations.
| `tier` | Page renders | Button | On submit |
|---|---|---|---|
| `1` | anchors — canvas, audience + `content_divergence` + `delivery_purpose` *(PPT only — omitted on non-PPT canvases, not written to the result)* (all in the §c key-info area), mode + visual_style | **Next** | writes `result.json` `{ stage: "tier1", status: "tier1-confirmed", <anchors> }`; the page does **not** close — it shows a "deriving…" state and polls `GET /api/recommendations` |
-| `2` | realization — page count, color, typography, icons, formula, image usage + strategy, generation mode, refine spec | **Confirm** | writes `result.json` `{ stage: "final", status: "confirmed", <all fields> }`, then shuts the page down |
+| `2` | realization — page count, color, typography, icons, formula, image usage + illustration usage + strategy, generation mode, refine spec | **Confirm** | writes `result.json` `{ stage: "final", status: "confirmed", <all fields> }`, then shuts the page down |
| *(absent)* | legacy single-pass — every section on one page | **Confirm** | single final write (`status: "confirmed"`) — backward-compatible |
The AI launches Tier 1 (`--daemon --wait`), reads the tier-1 result, **re-derives** the realization candidates from the user's actual anchors, overwrites `recommendations.json` with `"tier": 2` (realization fields only — it need not echo the anchors), and re-attaches with `--wait-only`. The page preserves the user's Tier 1 selections across the transition (single JS session). `GET /api/recommendations` is served `no-store` so the poll sees the tier-2 overwrite, and when `tier == 2` the server **folds the confirmed anchors from `result.json` back into the payload** (`recommend.canvas` / `mode` / `visual_style` / `delivery_purpose`, plus `audience` / `content_divergence` values) — so a **page refresh / reopen on Tier 2 re-initializes the anchors from the user's choices** instead of catalog defaults, even though those sections are not rendered on the Tier-2 page.
@@ -69,7 +69,9 @@ The AI launches Tier 1 (`--daemon --wait`), reads the tier-1 result, **re-derive
"mode": "pyramid",
"visual_style": "swiss-minimal",
"icons": "tabler-outline",
- "image_usage": "web",
+ "image_usage": "ai",
+ "image_ai_path": "auto",
+ "illustration_usage": "use",
"formula_policy": "mixed",
"generation_mode": "continuous",
"delivery_purpose": "balanced"
@@ -125,6 +127,7 @@ The AI launches Tier 1 (`--daemon --wait`), reads the tier-1 result, **re-derive
> Each `candidates` array above shows **one** entry for brevity — the creative fields (`color`, `typography`, `image_strategy`) must each carry **≥3** in a real file (see the rule above); `selected` indexes the recommended default.
- `recommend.*` names the recommended `id` for each enumerable field (must match a `catalogs.json` id, or be a free string for a recommended custom value). The page badges and pre-selects it. **Guarantee**: if a `recommend.*` is omitted, the page falls back to the first catalog option so every enumerable field always shows one badged recommendation — but the AI should still set them for a meaningful default. Legacy aliases are accepted for old files (`line` → `tabler-outline`, `filled` → `tabler-filled`, `monochrome` → `chunk-filled`, `search` → `web`, `default` → `auto`, `builtin` → `host-native`), but new files should write canonical ids. For `recommend.image_usage`, do not write bare `"custom"`; if several image sources are mixed, write the concrete prose plan directly, such as `"封面用 AI 生成,产品页用用户素材,行业页用网络来源"` / `"AI cover + user product assets + web industry images"`.
+- `recommend.illustration_usage` is the user's illustration intent toggle inside the image section, not a second image-source enum. It is a closed two-option field — `none` (don't intentionally add illustrations) or `use` (make illustrations part of the deck). How heavily (sparse vs pervasive) and from where are decided downstream by Strategist + `image_usage`, which maps to §VIII rows using the normal source vocabulary (`ai` / `web` / `user` / `placeholder` / `slice`).
- When `recommend.image_usage` is `ai` or a custom plan that includes AI, also set `recommend.image_ai_path` to one of `auto` / `api` / `host-native` / `manual`; the page presents these as explicit choices.
- For a custom image plan, the page treats "may include AI" as true only when the recommendation includes `recommend.image_ai_path` or `image_strategy.candidates`; a custom plan without those signals is handled as non-AI and omits AI controls / fields.
- **Color candidates carry the user-facing core `palette`**: `background`, `secondary_bg`, `primary`, `accent`, `secondary_accent`, and `body_text`. The page renders labelled swatches and offers per-role override inputs for precise single-role edits, plus a **Custom color card with a free-text box** (parallel to the custom typography box) — the user can describe the palette in words or paste HEX values instead of filling each role; this writes `color: { "name": "custom", "custom": "<text>" }` to `result.json` for the AI to interpret. Legacy `text` is accepted as an alias for `body_text`, but new files should write `body_text`. Strategist derives secondary text, borders, state colors, and visual-style neutral tiers later when writing `design_spec.md` / `spec_lock.md`; those are not user-facing confirmation choices.
@@ -154,7 +157,9 @@ The AI launches Tier 1 (`--daemon --wait`), reads the tier-1 result, **re-derive
"typography": { "name": "...", "heading": { "cjk": "...", "latin": "...", "css": "..." }, "body": { "cjk": "...", "latin": "...", "css": "..." }, "body_size": 24, "body_size_unit": "px", "sizes": { "title": 42, "subtitle": 32, "annotation": 18 } },
"delivery_purpose": "balanced",
"formula_policy": "mixed",
- "image_usage": "web",
+ "image_usage": "ai",
+ "image_ai_path": "auto",
+ "illustration_usage": "use",
"image_strategy": { "name": "方案 A", "rendering": "vector-illustration", "palette": "cool-corporate", "visual": "...", "color": "...", "mood": "..." },
"generation_mode": "continuous",
"refine_spec": false,
@@ -167,6 +172,7 @@ The AI launches Tier 1 (`--daemon --wait`), reads the tier-1 result, **re-derive
The shape above is the **final** (Tier 2) result, carrying all Tier 1 + Tier 2 fields. The intermediate **Tier 1** write carries only the anchor fields plus `"stage": "tier1"`, `"status": "tier1-confirmed"`; the AI reads it to re-derive Tier 2 and never treats it as the final confirmation. A legacy single-pass write has no `stage` (or `stage: "final"`) and `status: "confirmed"`.
- Any option field may instead hold a **free-text custom string** (the user picked **Custom**); `color` / `typography` custom entries set `name: "custom"`. Image usage custom values must be concrete prose plans, not the literal string `"custom"`. The AI interprets custom text against the canonical references.
+- `illustration_usage` is a closed `none` / `use` toggle. `none` = do not intentionally add decorative illustrations (default, current behavior); `use` = make illustrations part of the deck, with intensity (sparse vs pervasive) the Strategist's call from content + visual style. The source still comes from `image_usage`: `image_usage: none` produces no decorative illustration rows; otherwise AI-backed illustration sets may use an illustration sheet plus `slice` rows, provided assets become `user` rows, web assets become `web` rows when licensing is acceptable, and deferred illustrations become `placeholder` rows.
- `image_ai_path` and `image_strategy` are omitted from `result.json` unless `image_usage` is `ai` or a custom image plan that may include generated images. Both are honored downstream as confirmed choices — and the page is only a convenience surface over the **canonical chat channel**: the same choices made in chat are honored identically when no `result.json` exists. `image_ai_path` drives the Step 5 generation path (`image-generator.md` §7 — `host-native` forces the host tool even when `IMAGE_BACKEND` is set); the chosen `image_strategy` candidate is locked verbatim by Strategist h.5 (no re-pick).
- After the user clicks the **final Confirm** (Tier 2, or single-pass), the page saves `result.json` and shuts the server down (auto-close). A Tier-1 **Next** instead keeps the page open (it polls for the re-derived Tier 2). In the default flow, the first `--daemon --wait` returns on the tier-1 result and the second `--wait-only` returns on the final result; the AI reads each immediately — no extra chat confirmation is required. Chat confirmation remains the fallback when the page cannot be used. Either way, Step 4 ends with a `--shutdown` cleanup so a never-confirmed page cannot keep holding port 5050 ahead of the Step 6 live preview.