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 AI-authored custom design candidates
hugohe3778077e80b83
diff --git a/skills/ppt-master/references/image-renderings/_index.md b/skills/ppt-master/references/image-renderings/_index.mdindex 7906c91b..849ac81b 100644--- a/skills/ppt-master/references/image-renderings/_index.md+++ b/skills/ppt-master/references/image-renderings/_index.md@@ -54,15 +54,7 @@ Each rendering has its own file with: style paragraph, line / texture / depth no### 1.5 Escape hatch — `custom`-When no preset carries the deck's temperament, set `image_rendering: custom` and supply a one-paragraph `image_rendering_behavior`.--**Trigger** — all of:--| Condition | Check against |-|---|---|-| No preset style fits | `design_spec.d Style` |-| Brand / template / chat names no preset | truth-precedence inputs |-| Not expressible as "preset X + small adjustment" | Strategist confirmation chat |+Whenever proposed image usage includes `ai`, Stage 2 authors one separate, visible custom rendering proposal in addition to the preset cards. It uses `rendering: custom` plus a complete behavior paragraph, remains initially unselected, and enters the confirmed contract only when the user chooses it. A template-backed proposal must honor inherited identity and the confirmed template-application plan.**Hard rule — `rendering_behavior` prose**:@@ -77,7 +69,7 @@ When no preset carries the deck's temperament, set `image_rendering: custom` and- image_rendering_behavior: "Hand-screened poster aesthetic — slightly misregistered halftone overlays, 3 flat ink colors with visible dot pattern at 12% opacity, no gradients, no anti-aliased edges; reads as silkscreen print."```-**Hard rule**: `custom` is a tail-case, not a default. See [`strategist-image.md`](../strategist-image.md) for the one-`custom`-per-dimension limit.+**Hard rule**: the custom candidate is mandatory when AI images are proposed; selecting `custom` is a tail-case, not the default. See [`strategist-image.md`](../strategist-image.md) for the Stage-2 carrier and downstream lock behavior.---diff --git a/skills/ppt-master/references/modes/_index.md b/skills/ppt-master/references/modes/_index.mdindex 6a6ec863..84f193c2 100644--- a/skills/ppt-master/references/modes/_index.md+++ b/skills/ppt-master/references/modes/_index.md@@ -52,7 +52,7 @@ Each mode has its own file with: narrative skeleton, page-structure tendencies,## 3. How to use1. Strategist reads this index at confirmation `d. Layer 1`.-2. Pick one mode from the auto-selection table + the confirmed communication contract and source structure.+2. Preselect one mode from the auto-selection table + the confirmed communication contract and source structure; separately author the visible AI custom candidate required by §4.3. Record the confirmed mode and rationale in `design_spec.md`, then project `- mode: <name>` into `spec_lock.md`.4. Executor reads **only** `modes/<locked-mode>.md` at generation entry — never globs this directory.@@ -64,10 +64,10 @@ Each mode has its own file with: narrative skeleton, page-structure tendencies,`custom` holds **any bespoke narrative direction the five don't give as-is** — and what *kind* of thing it is doesn't matter. It might be a nameable cadence (dialectic 正反合, myth-vs-reality, countdown / Top-N, Socratic), a deliberate multi-act fusion of several modes, or the user's own feel for how the deck should carry (confrontational here, detached there). Don't try to taxonomize it.-**Either side may originate it.** The user can ask for it directly; or the Strategist — as the deck's strategist — may **recommend** `custom` when a bespoke direction (often a fusion of two modes) genuinely serves the deck better than any single preset. Like every confirmation, it's a recommendation the user confirms or overrides — and the recommendation must **spell the custom out in plain language** (what the cadence / fusion / posture actually is), never present the bare token `custom`, so the user confirms something legible. Either way, the Strategist crystallizes the intent in the Design Spec first, then projects it as `- mode: custom` plus a concrete `- mode_behavior:` paragraph in `spec_lock.md`. The Executor follows that prose in place of a preset file. (This records the intent so it survives 20 pages of generation — the Executor only ever reads `spec_lock.md`, never the chat.)+**Always author the candidate; select it only when warranted.** Stage 2 includes one visible, non-empty AI custom proposal beside the five presets, spelling out the cadence / fusion / posture in plain language. It is initially unselected and does not replace the best-fit preset recommendation unless the user already supplied that exact custom direction; with a template, it must fit available prototype capacity. When the user selects it, the editable prose is saved as `mode: custom` plus `mode_behavior`; otherwise it remains recommendation-only. The Strategist crystallizes a selected custom direction in the Design Spec first, then projects the same pair to `spec_lock.md`. The Executor follows that prose in place of a preset file. (This records the intent so it survives 20 pages of generation — the Executor only ever reads `spec_lock.md`, never the chat.)> **One value per deck — fusion is *one* `custom`, not several modes.** A deck always locks a single `mode`. A multi-mode blend is expressed as **one** `mode: custom` whose `mode_behavior` paragraph describes the acts — never by locking several modes.>> **First ask whether it's really fusion.** A locked mode is a *tendency*, not a cage: a `narrative` deck can still carry one analytical (pyramid-style) page, an `instructional` deck one showcase reveal — that is leaning within a dominant mode, and needs **no** `custom`. Reach for `custom` only when there is genuinely no single dominant spine.-**The one thing to avoid**: reaching for `custom` as a *dodge* — defaulting to it because picking among the five takes judgment. When a preset genuinely fits, lock the preset; propose `custom` when a bespoke direction earns its place, not to avoid choosing. (And a user-stated direction is authoritative the same way a user-supplied outline is — see the lens-not-mandate note in §1.)+**The one thing to avoid**: selecting `custom` as a *dodge* — defaulting to it because picking among the five takes judgment. The custom candidate is mandatory; a custom lock is not. When a preset genuinely fits, keep that preset selected. A user-stated direction remains authoritative the same way a user-supplied outline is — see the lens-not-mandate note in §1.diff --git a/skills/ppt-master/references/strategist-image.md b/skills/ppt-master/references/strategist-image.mdindex 887b87aa..7662bba8 100644--- a/skills/ppt-master/references/strategist-image.md+++ b/skills/ppt-master/references/strategist-image.md@@ -18,9 +18,9 @@ For ≥3 AI-generated same-family spots, plan one unplaced `ai` Illustration She## 2. AI Image Strategy — propose before Stage 2; lock only for confirmed `ai`-When proposed sources include `ai`, read every entry in [`image-renderings/_index.md`](./image-renderings/_index.md) before constructing Stage 2. Unless the user or active template already names a rendering, place at least three credible, distinct renderings across the coordinated safe/shifted/bold directions; a genuine compatibility shortfall may return fewer with a reason. Each `image_strategy` carries localized `rendering`, `visual`, and `mood` only. Mood includes a recognizable real-world analogy. Image colors always inherit that direction's deck HEX roles; never add an image palette or alter deck colors to rescue a rendering.+When proposed sources include `ai`, read every entry in [`image-renderings/_index.md`](./image-renderings/_index.md) before constructing Stage 2. Unless the user or active template already names a rendering, place at least three credible, distinct preset renderings across the coordinated safe/shifted/bold directions; a genuine compatibility shortfall may return fewer with a reason. Each preset `image_strategy` carries localized `rendering`, `visual`, and `mood` only. Mood includes a recognizable real-world analogy. Image colors always inherit that direction's deck HEX roles; never add an image palette or alter deck colors to rescue a rendering.-`custom` is a tail case: at most one candidate uses it, and its visual prose must satisfy the catalog's custom grammar. Record the confirmed deck-wide `image_rendering` in `design_spec.md §III` first, then project it to `spec_lock.md colors`; confirmed custom prose also becomes `image_rendering_behavior` and is carried into every AI brief. A confirmed non-custom id needs no behavior row. Ignore legacy `image_palette` rows.+Also write one `custom_candidates.image_strategy` under the Confirm UI contract: localized `name` / `visual` / `mood`, `rendering: custom`, and non-empty localized `behavior` satisfying the catalog grammar. Keep it unselected unless the user supplied it (`recommend.image_strategy: custom`); under a template it obeys inherited identity and application. Only a selected custom locks its edited behavior as `image_rendering_behavior`; otherwise discard it downstream. Ignore legacy `image_palette`.For specialized or regulated paper-figure subjects, preserve the prompt depth required by [`image-generator.md`](./image-generator.md) §4.2 rather than shortening to a generic brief. Scan the outline for genuine image-led pages, list the proposed hero pages in Stage-2 `image_notes` so the user can retain, edit, or remove them in the same confirmation, then mark only the confirmed pages' AI rows `page_role: hero_page`; local is the default. `text_policy: embedded` is reserved for lettering that must be fused into the artwork; ordinary titles, data, labels, and prose remain editable SVG. Analyze confirmed provided assets before writing §VIII.diff --git a/skills/ppt-master/references/strategist.md b/skills/ppt-master/references/strategist.mdindex d3807a7f..b39f1cd3 100644--- a/skills/ppt-master/references/strategist.md+++ b/skills/ppt-master/references/strategist.md@@ -99,15 +99,15 @@ When authoring §IX, translate every purpose named in `communication_intent` int**Stage 2 only.** Do not recommend or confirm any item in this section until the Stage-1 communication contract is confirmed. These are tools selected to serve the scenario, not substitutes for defining it.-Two independent layers, each locks one catalog item. Output: `d. Mode: <mode> + Visual style: <visual_style>`.+Two independent layers, each locks one preset or `custom`. Output: `d. Mode: <mode> + Visual style: <visual_style>`.-> **Presenting a `custom` lock — spell it out.** Whenever either layer resolves to `custom`, the confirmation must state the bespoke choice in **plain language** — what the cadence / fusion / posture actually is (Layer 1), or what the aesthetic actually is (Layer 2) — so the user confirms a legible direction, never the bare word `custom`. Show this prose in the confirmation first; it is the same content you then crystallize into the `mode_behavior` / `visual_style_behavior` line. e.g. `d. Mode: custom — open with a narrative hook, then a pyramid analysis core, then a showcase close (no single dominant spine)` — not just `Mode: custom`.+> **Mandatory AI custom candidates.** Every Stage-2 `recommendations.json` carries visible, non-empty `custom_candidates.mode` and `.visual_style`, initially unselected unless the user supplied that exact direction. If selected, spell the proposal out in plain language and save literal `custom` plus the edited `mode_behavior` / `visual_style_behavior`; otherwise it remains recommendation-only. Never write bespoke prose as the enum value.#### Layer 1 — Communication mode🚧 **GATE**: read [`modes/_index.md`](./modes/_index.md) before recommending.-The deck's **narrative + persuasion skeleton** — how the argument is organized and advanced. Lock **one** of `pyramid` / `narrative` / `instructional` / `showcase` / `briefing` (closed set; full catalog in the index).+The deck's **narrative + persuasion skeleton** — how the argument is organized and advanced. Lock one preset from `pyramid` / `narrative` / `instructional` / `showcase` / `briefing`, or `custom` with behavior.**Source**:- User supplied their own outline / structure → it is authoritative. Transcribe it into `§IX` as given (page order + titles preserved); still lock a mode, but for register / voice and page-internal treatment, **not** to reshape — never reorder the user's pages or rewrite their given titles. Note in `design_spec.md` that the structure is user-authored. `briefing` imposes the least if no particular "讲法" is intended.@@ -125,9 +125,9 @@ The deck's **visual aesthetic** — shape language, decoration density, whitespa**Source**:- User named a style (chat / template / beautify) → it is truth: map to the closest preset (or `custom` with a `visual_style_behavior` paragraph) and lock directly. **Skip the spectrum below** — do not re-offer choice they already made.-- No user description → **present a personality spectrum, not one safe pick** (this is the lever against "every deck looks the same" — the visual style is what most determines a deck's character, so it gets real choice, like the alternative-set rule used for image rendering). Author **≥3 distinct styles** from the index's auto-selection table spanning *safe* (the industry-norm recommendation) → *shifted* (an alternate one tick more expressive) → *bold* (a characterful style that challenges the default — `brutalist` / `zine` / `memphis` / `ink-wash` / `vintage-poster` etc., whenever the content can carry it). Give each a one-line **temperament tag + real-world analogy** (for example, "like an Economist feature"). Write the three to `recommendations.json` `visual_style_spectrum` (each `{id, tag_zh/en/ja, note_zh/en/ja}` — include the `_ja` variants whenever the page `lang` is `ja`) **and present the same three in chat** as the always-valid fallback; set `recommend.visual_style` to the *safe* pick as the pre-selected default. The user may pick any of the three, a style outside them, or Custom. Honest-shortfall exception: if the content genuinely supports fewer than 3 non-gimmicky directions, present the smaller set and say why — never pad with a style that fights the content.+- No user description → **present a personality spectrum, not one safe pick** (this is the lever against "every deck looks the same" — the visual style is what most determines a deck's character, so it gets real choice, like the alternative-set rule used for image rendering). Author **≥3 distinct styles** from the index's auto-selection table spanning *safe* (the industry-norm recommendation) → *shifted* (an alternate one tick more expressive) → *bold* (a characterful style that challenges the default — `brutalist` / `zine` / `memphis` / `ink-wash` / `vintage-poster` etc., whenever the content can carry it). Give each a one-line **temperament tag + real-world analogy** (for example, "like an Economist feature"). Write the three to `recommendations.json` `visual_style_spectrum` (each `{id, tag_zh/en/ja, note_zh/en/ja}` — include the `_ja` variants whenever the page `lang` is `ja`) **and present the same three in chat** as the always-valid fallback; set `recommend.visual_style` to the *safe* pick as the pre-selected default. The user may pick any of the three or the separate full-copy Custom proposal. Honest-shortfall may reduce the preset set, never remove Custom.-**Forbidden — a non-catalog name as `visual_style`**: the value MUST be an `id` from the visual-styles catalog (or genuine `custom` prose). A name that is **not** in that catalog is not a visual style — most often it is an image-rendering name from the `_index` "Paired rendering" column (`flat`, `vector-illustration`, `digital-dashboard`, `3d-isometric`, `corporate-photo`, …), which names the §h *illustration* family, not the deck's layout aesthetic. Do not borrow it. (Names that are intentionally **both** a style and its paired rendering — `glassmorphism`, `blueprint`, `editorial`, `dark-tech` — are valid styles because they *are* in the catalog.) Generic baseline words — `flat` / flat-design / 扁平 / modern / clean / simple / minimal — are **not** custom-worthy either: the whole system is flat by default (shadows discouraged), so map them to the closest preset (flat + grid → `swiss-minimal`; flat + rounded → `soft-rounded`; flat + dense → `brutalist`). Reserve `custom` for an aesthetic no preset covers.+**Forbidden — a non-catalog name as `visual_style`**: the value MUST be an `id` from the visual-styles catalog or literal `custom`; bespoke prose belongs only in `visual_style_behavior`. A name that is **not** in that catalog is not a visual style — most often it is an image-rendering name from the `_index` "Paired rendering" column (`flat`, `vector-illustration`, `digital-dashboard`, `3d-isometric`, `corporate-photo`, …), which names the §h *illustration* family, not the deck's layout aesthetic. Do not borrow it. (Names that are intentionally **both** a style and its paired rendering — `glassmorphism`, `blueprint`, `editorial`, `dark-tech` — are valid styles because they *are* in the catalog.) Generic baseline words — `flat` / flat-design / 扁平 / modern / clean / simple / minimal — are **not** custom-worthy either: the whole system is flat by default (shadows discouraged), so map them to the closest preset (flat + grid → `swiss-minimal`; flat + rounded → `soft-rounded`; flat + dense → `brutalist`). Reserve a custom lock for an aesthetic no preset covers; the mandatory candidate does not make it the default.**Carries no color.** A visual style governs how the deck's HEX (locked at `e`) is *used* — never which colors, same discipline as [`image-renderings`](./image-renderings/_index.md). When the deck has AI images, prefer the style's paired rendering so layout and illustration share one aesthetic.diff --git a/skills/ppt-master/references/visual-styles/_index.md b/skills/ppt-master/references/visual-styles/_index.mdindex 37bb4fef..7519ea80 100644--- a/skills/ppt-master/references/visual-styles/_index.md+++ b/skills/ppt-master/references/visual-styles/_index.md@@ -92,14 +92,14 @@ Each style has its own file with: shape & decoration, typography character, colo## 3. Escape hatch — `custom`-When no preset captures the intended aesthetic, record the confirmed custom aesthetic in the Design Spec first, then project `- visual_style: custom` plus a `- visual_style_behavior:` line to `spec_lock.md`: one paragraph naming shape language, composition geometry (page-scale moves), decoration density, whitespace, typographic character, and texture — **no HEX, no color names as values**. `custom` is a tail-case, not a default; reach for a preset first.+Stage 2 always authors one visible, non-empty AI custom proposal beside the preset spectrum. Its paragraph names shape language, composition geometry (page-scale moves), decoration density, whitespace, typographic character, and texture — **no HEX, no color names as values**. The proposal is initially unselected and remains recommendation-only unless the user chooses it; a template-backed proposal must stay inside the inherited identity and confirmed application plan. When selected, record the edited aesthetic in the Design Spec first, then project `- visual_style: custom` plus `- visual_style_behavior:` to `spec_lock.md`. The candidate is mandatory; selecting `custom` remains a tail-case, not the default.---## 4. How to use1. Strategist reads this index at confirmation `d. Layer 2`.-2. Pick one style from the auto-selection table + the deck's vibe.+2. Preselect one style from the auto-selection table + the deck's vibe; separately author the visible AI custom proposal from §3.3. Record the confirmed style and rationale in `design_spec.md`, then project `- visual_style: <name>` into `spec_lock.md`.4. Executor reads **only** `visual-styles/<locked-style>.md` at generation entry — never globs this directory.diff --git a/skills/ppt-master/scripts/confirm_ui/server.py b/skills/ppt-master/scripts/confirm_ui/server.pyindex 62f49171..7b6b8383 100644--- a/skills/ppt-master/scripts/confirm_ui/server.py+++ b/skills/ppt-master/scripts/confirm_ui/server.py@@ -419,6 +419,55 @@ def _template_stage2_error(return None+def _localized_text_present(candidate: dict, field: str) -> bool:+ """Return whether a candidate carries non-empty localized prose."""+ return any(+ isinstance(candidate.get(key), str) and bool(candidate[key].strip())+ for key in (field, f'{field}_zh', f'{field}_en', f'{field}_ja')+ )+++def _stage2_custom_candidates_error(recommendations: dict) -> Optional[str]:+ """Require visible AI-authored custom alternatives in new Stage 2 files."""+ candidates = recommendations.get('custom_candidates')+ if not isinstance(candidates, dict):+ return 'Stage 2 recommendations must include custom_candidates'++ for field in ('mode', 'visual_style'):+ candidate = candidates.get(field)+ if not isinstance(candidate, dict):+ return f'custom_candidates.{field} must be an object'+ for prose_field in ('name', 'behavior'):+ if not _localized_text_present(candidate, prose_field):+ return (+ f'custom_candidates.{field} requires non-empty localized '+ f'{prose_field}'+ )++ recommend = recommendations.get('recommend')+ usage = recommend.get('image_usage') if isinstance(recommend, dict) else None+ if usage is None:+ usage = recommendations.get('image_usage')+ if isinstance(usage, dict):+ usage = usage.get('value')+ uses_ai = 'ai' in usage if isinstance(usage, list) else usage == 'ai'+ if not uses_ai:+ return None++ image_candidate = candidates.get('image_strategy')+ if not isinstance(image_candidate, dict):+ return 'custom_candidates.image_strategy must be an object when image_usage includes ai'+ if image_candidate.get('rendering') != 'custom':+ return 'custom_candidates.image_strategy.rendering must be custom'+ for prose_field in ('name', 'visual', 'mood', 'behavior'):+ if not _localized_text_present(image_candidate, prose_field):+ return (+ 'custom_candidates.image_strategy requires non-empty localized '+ f'{prose_field}'+ )+ return None++def _submission_stage_error(project_path: Path,confirm_dir: Path,@@ -452,6 +501,9 @@ def _submission_stage_error()if recommendation_error:return recommendation_error+ recommendation_error = _stage2_custom_candidates_error(recommendations)+ if recommendation_error:+ return recommendation_errorallowed_submissions = {1: {'stage1'},@@ -482,6 +534,42 @@ def _submission_stage_error(return None+def _custom_selection_error(result: dict) -> Optional[str]:+ """Require behavior prose whenever a creative custom choice is selected."""+ if result.get('mode') == 'custom' and not str(+ result.get('mode_behavior') or ''+ ).strip():+ return 'mode=custom requires non-empty mode_behavior'+ if result.get('visual_style') == 'custom' and not str(+ result.get('visual_style_behavior') or ''+ ).strip():+ return 'visual_style=custom requires non-empty visual_style_behavior'+ image_strategy = result.get('image_strategy')+ if isinstance(image_strategy, dict) and image_strategy.get('rendering') == 'custom':+ behavior = image_strategy.get('behavior') or image_strategy.get('custom')+ if not str(behavior or '').strip():+ return 'image_strategy.rendering=custom requires non-empty behavior'+ return None+++def _normalize_custom_selections(result: dict) -> None:+ """Keep custom prose only for the creative choices actually selected."""+ if result.get('mode') != 'custom':+ result.pop('mode_behavior', None)+ if result.get('visual_style') != 'custom':+ result.pop('visual_style_behavior', None)++ image_strategy = result.get('image_strategy')+ if not isinstance(image_strategy, dict):+ return+ legacy_behavior = image_strategy.pop('custom', None)+ if image_strategy.get('rendering') == 'custom':+ if not image_strategy.get('behavior') and legacy_behavior:+ image_strategy['behavior'] = legacy_behavior+ return+ image_strategy.pop('behavior', None)++def _expected_result_stage(confirm_dir: Path) -> str:"""Return the result stage expected from the current recommendations."""try:@@ -678,6 +766,25 @@ def _merge_confirmed_choices(data: dict, result_file: Path) -> None:'selected': 0,'candidates': [res['image_strategy']],}+ custom_candidates = data.get('custom_candidates')+ if not isinstance(custom_candidates, dict):+ custom_candidates = {}+ data['custom_candidates'] = custom_candidates+ for field, behavior_field in (+ ('mode', 'mode_behavior'),+ ('visual_style', 'visual_style_behavior'),+ ):+ behavior = res.get(behavior_field)+ if res.get(field) != 'custom' or not str(behavior or '').strip():+ continue+ candidate = custom_candidates.get(field)+ if not isinstance(candidate, dict):+ candidate = {}+ candidate['behavior'] = behavior+ custom_candidates[field] = candidate+ image_strategy = res.get('image_strategy')+ if isinstance(image_strategy, dict) and image_strategy.get('rendering') == 'custom':+ custom_candidates['image_strategy'] = image_strategy# Stage 3 must retain its own production recommendations until final# confirmation. A final-result reopen reflects those confirmed mechanics.# Legacy single-pass results have no stage but do carry status=confirmed.@@ -1079,6 +1186,9 @@ def create_app()if recommendation_error:return jsonify({'error': recommendation_error}), 409+ recommendation_error = _stage2_custom_candidates_error(data)+ if recommendation_error:+ return jsonify({'error': recommendation_error}), 409# Template application is authored by Strategist from the installed# workspace and current content. Never expose legacy mode fields as# user-facing confirmation controls.@@ -1115,6 +1225,10 @@ def create_app()if stage_error:return jsonify({'error': stage_error}), 409+ custom_error = _custom_selection_error(result)+ if custom_error:+ return jsonify({'error': custom_error}), 400+ _normalize_custom_selections(result)locked_values = _apply_locked_recommendations(result,confirm_dir / RECOMMENDATIONS_NAME,diff --git a/skills/ppt-master/scripts/confirm_ui/static/app.js b/skills/ppt-master/scripts/confirm_ui/static/app.jsindex e390580c..840987cd 100644--- a/skills/ppt-master/scripts/confirm_ui/static/app.js+++ b/skills/ppt-master/scripts/confirm_ui/static/app.js@@ -65,6 +65,11 @@content_divergence_locked_hint: "This profile preserves the source wording and page structure, so this field is fixed.",custom: "Custom",custom_placeholder: "Type your own…",+ ai_custom_candidate: "AI custom proposal",+ ai_custom_candidate_hint: "Always visible for comparison. It is not selected by default; select it to edit.",+ custom_behavior_required: "The selected AI custom proposal cannot be blank.",+ mode_behavior_placeholder: "Describe the act sequence, title voice, page rhythm, and presentation posture.",+ visual_style_behavior_placeholder: "Describe shape language, composition, decoration density, whitespace, typography character, and texture.",recommended: "Recommended",placeholder_audience: "Who is this deck for?",placeholder_pages: "e.g. 12-15",@@ -76,9 +81,8 @@image_strategy_rendering: "Rendering",image_strategy_visual: "Visual",image_strategy_mood: "Mood",- image_strategy_manual: "Custom",- image_strategy_manual_desc: "Choose a rendering manually, or add custom prose.",- image_strategy_custom_prompt: "Custom prompt notes",+ image_strategy_ai_custom: "AI custom proposal",+ image_strategy_ai_custom_desc: "A complete out-of-catalog rendering proposal. Select it to edit.",image_strategy_custom_placeholder: "Describe the exact generated-image direction, subjects, composition, style cues, or things to avoid.",image_strategy_reference_hint: "Reference images show rendering only. Final AI images inherit the deck color scheme selected above.",image_strategy_no_reference: "No reference image for this custom choice.",@@ -198,6 +202,11 @@content_divergence_locked_hint: "このプロファイルは原文とページ構成を保持するため、この項目は固定されています。",custom: "カスタム",custom_placeholder: "自由に入力…",+ ai_custom_candidate: "AIカスタム案",+ ai_custom_candidate_hint: "比較できるよう常に全文を表示します。初期選択はされず、選択後に編集できます。",+ custom_behavior_required: "選択したAIカスタム案を空欄にはできません。",+ mode_behavior_placeholder: "構成の流れ、タイトルの語り口、ページのリズム、表現姿勢を記述します。",+ visual_style_behavior_placeholder: "形状言語、構図、装飾密度、余白、書体の性格、質感を記述します。",recommended: "おすすめ",placeholder_audience: "この資料は誰に向けたもの?",placeholder_pages: "例:12-15",@@ -209,9 +218,8 @@image_strategy_rendering: "レンダリング",image_strategy_visual: "ビジュアル",image_strategy_mood: "ムード",- image_strategy_manual: "カスタム",- image_strategy_manual_desc: "レンダリングを手動で選ぶか、カスタム記述を追加します。",- image_strategy_custom_prompt: "カスタム指示",+ image_strategy_ai_custom: "AIカスタム案",+ image_strategy_ai_custom_desc: "カタログ外の完全なレンダリング案です。選択後に編集できます。",image_strategy_custom_placeholder: "生成画像の方向性、被写体、構図、スタイル要素、避けたい要素を具体的に入力してください。",image_strategy_reference_hint: "参照画像はレンダリングのみを示します。最終AI画像の色は上で選んだデッキ配色を継承します。",image_strategy_no_reference: "このカスタム選択には参照画像がありません。",@@ -331,6 +339,11 @@content_divergence_locked_hint: "当前流程要求原文和页面结构保持不变,因此该字段已锁定。",custom: "自定义",custom_placeholder: "输入自定义内容…",+ ai_custom_candidate: "AI 自定义方案",+ ai_custom_candidate_hint: "始终展示完整内容用于比较;默认不选中,选择后可编辑。",+ custom_behavior_required: "已选择的 AI 自定义方案不能为空。",+ mode_behavior_placeholder: "描述叙事阶段、标题语气、页面节奏和表达姿态。",+ visual_style_behavior_placeholder: "描述形状语言、构图、装饰密度、留白、字体气质和纹理。",recommended: "推荐",placeholder_audience: "这份演示文稿面向谁?",placeholder_pages: "如:12-15",@@ -342,9 +355,8 @@image_strategy_rendering: "渲染风格",image_strategy_visual: "视觉",image_strategy_mood: "情绪",- image_strategy_manual: "自定义",- image_strategy_manual_desc: "手动选择渲染风格,也可以补充自定义描述。",- image_strategy_custom_prompt: "自定义提示要求",+ image_strategy_ai_custom: "AI 自定义方案",+ image_strategy_ai_custom_desc: "一套完整的目录外渲染方案;选择后可以编辑。",image_strategy_custom_placeholder: "描述生成图的具体方向、主体、构图、风格关键词或需要避免的内容。",image_strategy_reference_hint: "参考图只展示渲染风格;最终 AI 图片直接继承上方已选的整套 PPT 配色。",image_strategy_no_reference: "自定义选择没有参考图。",@@ -535,7 +547,6 @@var CAT = null; // catalogs.json — finite option universevar REC = null; // recommendations.json — AI picks + candidatesvar ICON_PREVIEWS = {}; // /api/icon-previews — real SVG samples from templates/icons- var AI_IMAGE_COMPARISON = {}; // /api/ai-image-comparison — reference PNG optionsvar STATE = {};var REC_ALIASES = {icons: {@@ -663,45 +674,6 @@return row;}- function comparisonItems(kind) {- return (AI_IMAGE_COMPARISON && AI_IMAGE_COMPARISON[kind]) || [];- }-- function comparisonItem(kind, id) {- var items = comparisonItems(kind);- for (var i = 0; i < items.length; i += 1) {- if (items[i] && items[i].id === id) return items[i];- }- return null;- }-- function comparisonLabel(item, kind) {- return item ? (comparisonValueLabel(kind, item.id) || item.label || item.id || "") : "";- }-- function firstComparisonId(kind, fallback) {- var items = comparisonItems(kind);- if (fallback === "custom") return fallback;- if (fallback && comparisonItem(kind, fallback)) return fallback;- return items.length ? items[0].id : (fallback || "");- }-- function comparisonSelect(kind, value) {- var select = el("select", "text-input image-strategy-select");- comparisonItems(kind).forEach(function (item) {- var option = document.createElement("option");- option.value = item.id;- option.textContent = comparisonLabel(item, kind);- select.appendChild(option);- });- var customOption = document.createElement("option");- customOption.value = "custom";- customOption.textContent = t("custom");- select.appendChild(customOption);- select.value = firstComparisonId(kind, value);- return select;- }-// Section numbers run 1..N within the stage currently rendered; the counter is// reset at the top of renderForStage. The legacy `num` arg is ignored so each// stage numbers its own sections cleanly (stage 2 is not a continuation of 1).@@ -777,9 +749,10 @@return firstId(list);}// Render an enumerable field: ALL options from the catalog, recommended one- // badged, current selection from STATE, plus a trailing Custom box. Callers- // may place Custom or selected sentinel options on their own rows when they- // represent qualitatively different paths rather than another preset.+ // badged, current selection from STATE, plus an optional Custom box. An+ // AI-authored custom candidate stays fully visible while unselected and+ // becomes editable only after selection; legacy custom inputs keep their+ // compact free-text behavior.// `list` is either a flat array of {id,label,desc,dim,viewbox} or a grouped array// of {group, items:[...]}.function enumField(parent, list, recommendedId, getVal, setVal, opts2) {@@ -797,10 +770,12 @@if (s && s.id) specById[s.id] = { tag: localized(s, "tag"), note: localized(s, "note") };});var allowCustom = opts2.allowCustom === true; // only for fields not fully enumerable- var customSentinel = opts2.customSentinel || "";+ var aiCustom = opts2.aiCustom || null;+ var customSentinel = opts2.customSentinel || (aiCustom ? "custom" : "");var customInvalidValues = opts2.customInvalidValues || [];var cur = getVal();- var isCustom = cur != null && cur !== "" && ids.indexOf(cur) === -1;+ var isCustom = cur != null && cur !== "" &&+ (cur === customSentinel || ids.indexOf(cur) === -1);if (!allowCustom && isCustom) {// closed field with an out-of-catalog value → snap to recommended/firstcur = ids.indexOf(recommendedId) >= 0 ? recommendedId : ids[0];@@ -809,13 +784,32 @@}var allChips = [];- var customInput = el("input", "text-input custom-input");+ var customInput = el(aiCustom ? "textarea" : "input", "text-input custom-input");if (opts2.inputClass) customInput.classList.add(opts2.inputClass);- customInput.type = "text";+ if (aiCustom) customInput.rows = aiCustom.rows || 4;+ else customInput.type = "text";customInput.placeholder = opts2.placeholder || t("custom_placeholder");customInput.style.display = "none";+ var customPreview = null;++ function customText() {+ if (!aiCustom) return customInput.value || "";+ return String(aiCustom.getText ? aiCustom.getText() : (aiCustom.text || ""));+ }- function deselect() { allChips.forEach(function (c) { c.classList.remove("selected"); }); }+ function syncAiCustom(selected) {+ if (!aiCustom || !customPreview) return;+ var value = customText();+ customPreview.textContent = value;+ customPreview.style.display = selected ? "none" : "block";+ customInput.style.display = selected ? "block" : "none";+ if (selected && customInput.value !== value) customInput.value = value;+ }++ function deselect() {+ allChips.forEach(function (c) { c.classList.remove("selected"); });+ if (aiCustom) syncAiCustom(false);+ }function makeChip(o) {var label = optionLabel(o);var desc = optionDesc(o);@@ -849,7 +843,7 @@chip.addEventListener("click", function () {deselect();chip.classList.add("selected");- customInput.style.display = "none";+ if (!aiCustom) customInput.style.display = "none";setVal(o.id);});allChips.push(chip);@@ -865,7 +859,7 @@parent.appendChild(row);});if (allowCustom) {- var lastRow = el("div", "chips");+ var lastRow = el("div", aiCustom ? "chips custom-chip-row" : "chips");lastRow.appendChild(buildCustomChip());parent.appendChild(lastRow);}@@ -888,30 +882,58 @@parent.appendChild(customRow);}}- if (allowCustom) parent.appendChild(customInput);+ if (allowCustom && !aiCustom) parent.appendChild(customInput);function buildCustomChip() {- var customChip = el("div", "chip", t("custom"));- if (recommendedId && ids.indexOf(recommendedId) === -1) {+ var customChip = el("div", aiCustom ? "chip ai-custom-candidate" : "chip");+ if (aiCustom) {+ var customHead = el("div", "ai-custom-candidate-head");+ customHead.appendChild(el("span", "chip-text",+ aiCustom.label || t("ai_custom_candidate")));+ customHead.appendChild(el("span", "ai-custom-candidate-hint",+ aiCustom.hint || t("ai_custom_candidate_hint")));+ customChip.appendChild(customHead);+ customPreview = el("div", "ai-custom-candidate-copy", customText());+ customChip.appendChild(customPreview);+ customChip.appendChild(customInput);+ } else {+ customChip.appendChild(el("span", "chip-text", t("custom")));+ }+ if (recommendedId === customSentinel ||+ (recommendedId && ids.indexOf(recommendedId) === -1 && isCustom)) {customChip.classList.add("recommended");customChip.appendChild(el("span", "rec-badge", "★ " + t("recommended")));}if (isCustom) {customChip.classList.add("selected");- customInput.style.display = "block";- customInput.value = customInvalidValues.indexOf(cur) >= 0 ? "" : cur;+ if (aiCustom) syncAiCustom(true);+ else {+ customInput.style.display = "block";+ customInput.value = customInvalidValues.indexOf(cur) >= 0 ? "" : cur;+ }+ } else if (aiCustom) {+ syncAiCustom(false);}customChip.addEventListener("click", function () {deselect();customChip.classList.add("selected");- customInput.style.display = "block";+ if (aiCustom) syncAiCustom(true);+ else customInput.style.display = "block";customInput.focus();- setVal(customInput.value || customSentinel);+ setVal(aiCustom ? customSentinel : (customInput.value || customSentinel));});allChips.push(customChip);return customChip;}- customInput.addEventListener("input", function () { setVal(customInput.value || customSentinel); });+ customInput.addEventListener("click", function (event) { event.stopPropagation(); });+ customInput.addEventListener("input", function () {+ if (aiCustom) {+ if (aiCustom.setText) aiCustom.setText(customInput.value);+ setVal(customSentinel);+ } else {+ setVal(customInput.value || customSentinel);+ }+ });}function textField(parent, getVal, setVal, placeholderKey, numeric) {@@ -1036,6 +1058,36 @@return candidate[field] != null ? candidate[field] : null;}+ function customCandidateSpec(field) {+ var candidates = REC && REC.custom_candidates;+ var candidate = candidates && candidates[field];+ if (typeof candidate === "string") return { behavior: candidate };+ if (candidate && typeof candidate === "object") return candidate;+ var legacy = REC && REC[field + "_behavior"];+ if (legacy && typeof legacy === "object") legacy = legacy.value;+ return legacy ? { behavior: legacy } : {};+ }++ function customCandidateBehavior(field) {+ var candidate = customCandidateSpec(field);+ return String(localized(candidate, "behavior") || candidate.value || candidate.custom || "");+ }++ function creativeCustomOptions(field, stateKey, placeholderKey) {+ var candidate = customCandidateSpec(field);+ var current = String(STATE[stateKey] || customCandidateBehavior(field) || "");+ if (!current.trim()) return null;+ STATE[stateKey] = current;+ return {+ label: localized(candidate, "name") || t("ai_custom_candidate"),+ hint: t("ai_custom_candidate_hint"),+ getText: function () { return STATE[stateKey] || ""; },+ setText: function (value) { STATE[stateKey] = value; },+ rows: 4,+ placeholder: t(placeholderKey)+ };+ }+function colorRecommendationCandidates() {var direct = (REC.color && REC.color.candidates) || [];if (direct.length) return direct;@@ -1074,6 +1126,19 @@}).slice(0, 3);}+ function imageStrategyCustomCandidate() {+ var candidate = customCandidateSpec("image_strategy");+ if (!customCandidateBehavior("image_strategy")) {+ candidate = imageStrategyCandidates().filter(function (item) {+ return item && item.rendering === "custom";+ })[0] || {};+ }+ if (!candidate || typeof candidate !== "object") return null;+ candidate = Object.assign({}, candidate, { rendering: "custom" });+ var normalized = normalizedImageStrategy(candidate);+ return String(normalized.behavior || "").trim() ? normalized : null;+ }+function normalizedImageStrategy(candidate) {candidate = candidate || {};var out = {@@ -1082,7 +1147,8 @@visual: localized(candidate, "visual") || "",mood: localized(candidate, "mood") || ""};- if (candidate.custom) out.custom = candidate.custom;+ var behavior = localized(candidate, "behavior") || candidate.behavior || candidate.custom || "";+ if (behavior) out.behavior = behavior;return out;}@@ -1242,8 +1308,18 @@function applyDesignDirection(candidate) {candidate = candidate || {};- if (candidate.mode) STATE.mode = candidate.mode;- if (candidate.visual_style) STATE.visual_style = candidate.visual_style;+ if (candidate.mode) {+ STATE.mode = candidate.mode;+ if (candidate.mode === "custom" && candidate.mode_behavior) {+ STATE.mode_behavior = candidate.mode_behavior;+ }+ }+ if (candidate.visual_style) {+ STATE.visual_style = candidate.visual_style;+ if (candidate.visual_style === "custom" && candidate.visual_style_behavior) {+ STATE.visual_style_behavior = candidate.visual_style_behavior;+ }+ }if (candidate.color) {STATE.color = {name: localized(candidate.color, "name") || candidate.color.name || "",@@ -1320,9 +1396,16 @@function renderNarrativeDirection(host) {var sec = section(4, "sec_narrative");+ var custom = creativeCustomOptions("mode", "mode_behavior", "mode_behavior_placeholder");enumField(sec, CAT.modes, recOrFirst("mode", CAT.modes),function () { return STATE.mode; }, function (v) { STATE.mode = v; },- { allowCustom: true, customOnOwnRow: true });+ {+ allowCustom: !!custom,+ customOnOwnRow: true,+ customSentinel: "custom",+ placeholder: t("mode_behavior_placeholder"),+ aiCustom: custom+ });host.appendChild(sec);}@@ -1359,11 +1442,17 @@function renderVisualDirection(host) {var sec = section(5, "sec_visual");+ var custom = creativeCustomOptions(+ "visual_style", "visual_style_behavior", "visual_style_behavior_placeholder"+ );enumField(sec, CAT.visual_styles, recOrFirst("visual_style", CAT.visual_styles),function () { return STATE.visual_style; }, function (v) { STATE.visual_style = v; },{- allowCustom: true,+ allowCustom: !!custom,customOnOwnRow: true,+ customSentinel: "custom",+ placeholder: t("visual_style_behavior_placeholder"),+ aiCustom: custom,spectrum: visualStyleRecommendationSpectrum(),preview: "visual_style",chipsClass: "visual-style-grid"@@ -2026,13 +2115,15 @@var row = appendImageStrategyPreviews(visual, strategy);visual.classList.toggle("image-strategy-preview-empty", !row);if (!row) visual.appendChild(el("div", "toggle-desc", t("image_strategy_no_reference")));- title.textContent = strategy.name || t("image_strategy_manual");+ title.textContent = strategy.name || t("image_strategy_ai_custom");var parts = [];if (strategy.rendering) {parts.push(t("image_strategy_rendering") + ": " +comparisonValueLabel("rendering", strategy.rendering));}- if (strategy.custom) parts.push(strategy.custom);+ if (strategy.visual) parts.push(t("image_strategy_visual") + ": " + strategy.visual);+ if (strategy.mood) parts.push(t("image_strategy_mood") + ": " + strategy.mood);+ if (strategy.behavior) parts.push(strategy.behavior);desc.textContent = parts.join(" · ") || t("image_strategy_reference_hint");}refreshImageStrategyPreview = paint;@@ -2100,6 +2191,10 @@strategySub.appendChild(el("div", "toggle-desc", t("image_strategy_reference_hint")));var strategyGrid = el("div", "font-grid image-strategy-grid");var strategyCands = imageStrategyRecommendationCandidates();+ var customStrategy = STATE.image_strategy_custom || imageStrategyCustomCandidate();+ var customCard = null;+ var syncCustomStrategy = function () {};+ var selectCustomImageStrategy = function () {};function markStrategyCard(selectedCard) {strategyGrid.querySelectorAll(".font-card").forEach(function (card) {@@ -2110,6 +2205,7 @@function selectImageStrategy(idx, selectedCard) {STATE.image_strategy = normalizedImageStrategy(strategyCands[idx]);markStrategyCard(selectedCard || strategyGrid.querySelector('[data-strategy-index="' + idx + '"]'));+ syncCustomStrategy(false);refreshImageStrategyPreview();}@@ -2121,12 +2217,6 @@return -1;}- function isManualImageStrategy(strategy) {- if (!strategy) return false;- return Object.prototype.hasOwnProperty.call(strategy, "custom") ||- strategy.rendering === "custom" || imageStrategyCandidateIndex(strategy) < 0;- }-strategyCands.forEach(function (candidate, idx) {var card = el("div", "font-card");card.setAttribute("data-strategy-index", String(idx));@@ -2150,51 +2240,59 @@});if (!strategyCands.length) strategyGrid.appendChild(el("div", "toggle-desc", t("image_strategy_empty")));- // Custom is a separate full-width path below the three recommended- // thumbnails, not a fourth visual recommendation.- var manualCard = el("div", "font-card image-strategy-manual-card");- var manualTop = el("div", "font-card-head");- manualTop.appendChild(el("span", "font-card-name", t("image_strategy_manual")));- manualTop.appendChild(el("span", "font-card-meta", t("image_strategy_manual_desc")));- manualCard.appendChild(manualTop);- var manualControls = el("div", "image-strategy-manual-controls");- var manualRendering = firstComparisonId("rendering",- (STATE.image_strategy && STATE.image_strategy.rendering) ||- (strategyCands[0] && strategyCands[0].rendering));- var renderingWrap = el("label", "image-strategy-select-wrap");- renderingWrap.appendChild(el("span", "image-strategy-select-label", t("image_strategy_rendering")));- var renderingSelect = comparisonSelect("rendering", manualRendering);- renderingWrap.appendChild(renderingSelect);- manualControls.appendChild(renderingWrap);- manualCard.appendChild(manualControls);- var customWrap = el("label", "image-strategy-custom-wrap");- customWrap.appendChild(el("span", "image-strategy-select-label", t("image_strategy_custom_prompt")));- var customInput = el("textarea", "text-input image-strategy-custom-input");- customInput.rows = 3;- customInput.placeholder = t("image_strategy_custom_placeholder");- customInput.value = (STATE.image_strategy && STATE.image_strategy.custom) || "";- customWrap.appendChild(customInput);- manualCard.appendChild(customWrap);-- function selectManualImageStrategy() {- var rendering = renderingSelect.value;- STATE.image_strategy = {- name: t("image_strategy_manual"),- rendering: rendering,- visual: comparisonLabel(comparisonItem("rendering", rendering), "rendering") ||- comparisonValueLabel("rendering", rendering),- mood: t("image_strategy_manual_desc"),- custom: customInput.value || ""+ if (customStrategy) {+ customStrategy = normalizedImageStrategy(customStrategy);+ STATE.image_strategy_custom = customStrategy;+ customCard = el("div", "font-card image-strategy-custom-card ai-custom-candidate");+ var customTop = el("div", "font-card-head");+ customTop.appendChild(el("span", "font-card-name",+ customStrategy.name || t("image_strategy_ai_custom")));+ customTop.appendChild(el("span", "font-card-meta", t("image_strategy_ai_custom_desc")));+ customCard.appendChild(customTop);+ [+ ["image_strategy_visual", customStrategy.visual],+ ["image_strategy_mood", customStrategy.mood]+ ].forEach(function (row) {+ if (row[1]) customCard.appendChild(el("div", "color-note", t(row[0]) + ":" + row[1]));+ });+ var customCopy = el("div", "ai-custom-candidate-copy", customStrategy.behavior);+ customCard.appendChild(customCopy);+ var customInput = el("textarea", "text-input image-strategy-custom-input");+ customInput.rows = 4;+ customInput.placeholder = t("image_strategy_custom_placeholder");+ customInput.value = customStrategy.behavior;+ customInput.style.display = "none";+ customCard.appendChild(customInput);++ syncCustomStrategy = function (selected) {+ customCopy.textContent = customStrategy.behavior || "";+ customCopy.style.display = selected ? "none" : "block";+ customInput.style.display = selected ? "block" : "none";+ if (selected && customInput.value !== customStrategy.behavior) {+ customInput.value = customStrategy.behavior || "";+ }};- markStrategyCard(manualCard);- refreshImageStrategyPreview();++ selectCustomImageStrategy = function () {+ STATE.image_strategy = normalizedImageStrategy(customStrategy);+ markStrategyCard(customCard);+ syncCustomStrategy(true);+ refreshImageStrategyPreview();+ };++ customInput.addEventListener("click", function (event) { event.stopPropagation(); });+ customInput.addEventListener("input", function () {+ customStrategy.behavior = customInput.value;+ STATE.image_strategy_custom = normalizedImageStrategy(customStrategy);+ selectCustomImageStrategy();+ });+ customCard.addEventListener("click", function () {+ selectCustomImageStrategy();+ customInput.focus();+ });+ syncCustomStrategy(false);+ strategyGrid.appendChild(customCard);}- renderingSelect.addEventListener("click", function (event) { event.stopPropagation(); });- renderingSelect.addEventListener("change", selectManualImageStrategy);- customInput.addEventListener("click", function (event) { event.stopPropagation(); });- customInput.addEventListener("input", selectManualImageStrategy);- manualCard.addEventListener("click", selectManualImageStrategy);- strategyGrid.appendChild(manualCard);strategySub.appendChild(strategyGrid);var recommendedIds = selectedImageUsageIds(recValue("image_usage"));@@ -2242,17 +2340,14 @@sec.appendChild(usageNote);sec.appendChild(strategySub);- if (isManualImageStrategy(STATE.image_strategy)) {- renderingSelect.value = firstComparisonId("rendering",- STATE.image_strategy.rendering || renderingSelect.value);- customInput.value = STATE.image_strategy.custom || "";- selectManualImageStrategy();+ if (STATE.image_strategy && STATE.image_strategy.rendering === "custom" && customCard) {+ selectCustomImageStrategy();} else if (STATE.image_strategy && imageStrategyCandidateIndex(STATE.image_strategy) >= 0) {selectImageStrategy(imageStrategyCandidateIndex(STATE.image_strategy));} else if (strategyCands.length) {selectImageStrategy(imageStrategySelectedIndex());- } else {- selectManualImageStrategy();+ } else if (customCard) {+ selectCustomImageStrategy();}refreshUsageChips();host.appendChild(sec);@@ -2427,6 +2522,17 @@return recommended != null && recommended !== "" ? recommended : firstId(catList);}+ function initCreativeSelection(field, catalog, behaviorKey) {+ var value = pick(field, catalog);+ var behavior = customCandidateBehavior(field);+ if (value && value !== "custom" && !findCatalogOption(catalog, value)) {+ behavior = String(value);+ value = "custom";+ }+ STATE[field] = value;+ STATE[behaviorKey] = behavior;+ }+function initStage1State() {STATE.canvas = pick("canvas", CAT.canvas);STATE.audience = (REC.audience && REC.audience.value) || "";@@ -2455,8 +2561,8 @@STATE.delivery_purpose = recId("delivery_purpose") ||directionField("delivery_purpose") || STATE.delivery_purpose || "balanced";STATE.page_count = (REC.page_count && REC.page_count.value != null) ? String(REC.page_count.value) : (STATE.page_count || "");- STATE.mode = pick("mode", CAT.modes);- STATE.visual_style = pick("visual_style", CAT.visual_styles);+ initCreativeSelection("mode", CAT.modes, "mode_behavior");+ initCreativeSelection("visual_style", CAT.visual_styles, "visual_style_behavior");var cc = colorRecommendationCandidates();var csel = (REC.color && REC.color.selected != null) ? REC.color.selected :(designDirectionSpec().selected || 0);@@ -2496,13 +2602,22 @@STATE.image_usage = [defaultImageUsageId()];}STATE.image_notes = imageUsageNotesRecommendation(rawImageUsage);+ STATE.image_strategy_custom = imageStrategyCustomCandidate();var strategyCandidates = imageStrategyRecommendationCandidates();- if (strategyCandidates.length) {+ var directionStrategy = directionField("image_strategy");+ var customStrategyRecommended = recId("image_strategy") === "custom";+ if ((customStrategyRecommended ||+ (directionStrategy && directionStrategy.rendering === "custom")) &&+ STATE.image_strategy_custom) {+ STATE.image_strategy = normalizedImageStrategy(STATE.image_strategy_custom);+ } else if (strategyCandidates.length) {STATE.image_strategy = normalizedImageStrategy(strategyCandidates[imageStrategySelectedIndex()] || strategyCandidates[0]);- } else if (directionField("image_strategy")) {- STATE.image_strategy = normalizedImageStrategy(directionField("image_strategy"));+ } else if (directionStrategy) {+ STATE.image_strategy = normalizedImageStrategy(directionStrategy);+ } else if (STATE.image_strategy_custom) {+ STATE.image_strategy = normalizedImageStrategy(STATE.image_strategy_custom);}}@@ -2548,6 +2663,36 @@return payload;}+ function normalizeCreativePayload(payload) {+ if (payload.mode !== "custom") delete payload.mode_behavior;+ if (payload.visual_style !== "custom") delete payload.visual_style_behavior;+ var imageStrategy = payload.image_strategy;+ if (imageStrategy && imageStrategy.rendering === "custom") {+ if (!imageStrategy.behavior && imageStrategy.custom) {+ imageStrategy.behavior = imageStrategy.custom;+ }+ delete imageStrategy.custom;+ } else if (imageStrategy) {+ delete imageStrategy.behavior;+ delete imageStrategy.custom;+ }+ delete payload.image_strategy_custom;+ return payload;+ }++ function customSelectionsValid(payload) {+ var imageStrategy = payload.image_strategy || {};+ var valid = payload.mode !== "custom" || String(payload.mode_behavior || "").trim();+ valid = valid && (payload.visual_style !== "custom" ||+ String(payload.visual_style_behavior || "").trim());+ valid = valid && (imageStrategy.rendering !== "custom" ||+ String(imageStrategy.behavior || "").trim());+ if (!valid) {+ document.getElementById("confirm-status").textContent = t("custom_behavior_required");+ }+ return !!valid;+ }+function stage2Payload() {var payload = communicationPayload();payload.stage = "stage2";@@ -2555,7 +2700,9 @@payload.template_application = STATE.template_application;}payload.mode = STATE.mode;+ payload.mode_behavior = STATE.mode_behavior;payload.visual_style = STATE.visual_style;+ payload.visual_style_behavior = STATE.visual_style_behavior;payload.page_count = STATE.page_count;// Reading mode keeps the legacy delivery_purpose key for compatibility.if (isPptCanvas(STATE.canvas)) payload.delivery_purpose = STATE.delivery_purpose;@@ -2568,7 +2715,7 @@if (needsGeneratedImagesForUsage(payload.image_usage)) {payload.image_strategy = normalizedImageStrategy(STATE.image_strategy);}- return payload;+ return normalizeCreativePayload(payload);}function submitStage(payload, nextStage) {@@ -2608,6 +2755,7 @@function submitStage2() {var payload = stage2Payload();if (!imageUsageValid(payload.image_usage)) return;+ if (!customSelectionsValid(payload)) return;submitStage(payload, 3);}@@ -2671,6 +2819,8 @@} else {payload.image_strategy = normalizedImageStrategy(payload.image_strategy);}+ normalizeCreativePayload(payload);+ if (!customSelectionsValid(payload)) return;btn.disabled = true;fetch("/api/confirm", {method: "POST",@@ -2728,11 +2878,6 @@.catch(function () { return {}; });}- function loadAiImageComparison() {- return fetchJson("/api/ai-image-comparison", "ai image comparison")- .catch(function () { return {}; });- }-function boot() {applyStaticTranslations();var toggleBtn = document.getElementById("btn-lang-toggle");@@ -2818,13 +2963,11 @@Promise.all([loadCatalogs(),fetchJson("/api/recommendations", "recommendations"),- loadIconPreviews(),- loadAiImageComparison()+ loadIconPreviews()]).then(function (res) {CAT = res[0];REC = res[1];ICON_PREVIEWS = res[2] || {};- AI_IMAGE_COMPARISON = res[3] || {};if (REC.lang === "zh" || REC.lang === "en" || REC.lang === "ja") {var hasStored = false;try { hasStored = !!window.localStorage.getItem("ppt_lang"); } catch (e) { /* ignore */ }diff --git a/skills/ppt-master/scripts/confirm_ui/static/style.css b/skills/ppt-master/scripts/confirm_ui/static/style.cssindex 89b330e4..65c5d217 100644--- a/skills/ppt-master/scripts/confirm_ui/static/style.css+++ b/skills/ppt-master/scripts/confirm_ui/static/style.css@@ -485,11 +485,11 @@ textarea.text-input { resize: vertical; line-height: 1.5; }grid-template-columns: repeat(3, minmax(0, 1fr));align-items: stretch;}-.image-strategy-grid > .font-card:not(.image-strategy-manual-card) {+.image-strategy-grid > .font-card:not(.image-strategy-custom-card) {min-width: 0;padding: 10px;}-.image-strategy-grid > .image-strategy-manual-card,+.image-strategy-grid > .image-strategy-custom-card,.image-strategy-grid > .toggle-desc {grid-column: 1 / -1;}@@ -535,29 +535,9 @@ textarea.text-input { resize: vertical; line-height: 1.5; }.image-strategy-preview-empty {padding: 14px 0 4px;}-.image-strategy-manual-card {+.image-strategy-custom-card {background: var(--card);}-.image-strategy-manual-controls {- display: grid;- grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));- gap: 10px;- margin: 10px 0;-}-.image-strategy-select-wrap {- display: flex;- flex-direction: column;- gap: 5px;-}-.image-strategy-select-label {- font-size: 11.5px;- color: var(--muted);-}-.image-strategy-select {- width: 100%;- min-height: 34px;- padding: 6px 8px;-}.font-sample-heading { font-size: 24px; font-weight: 700; line-height: 1.3; }.font-sample-body { font-size: 14px; color: #333; margin-top: 4px; }.custom-typography-input { margin-top: 8px; min-height: 58px; resize: vertical; }@@ -617,6 +597,38 @@ textarea.text-input { resize: vertical; line-height: 1.5; }.custom-input { margin-top: 8px; }.custom-chip-row,.standalone-chip-row { margin-top: 8px; }+.custom-chip-row .ai-custom-candidate { width: 100%; }+.ai-custom-candidate {+ display: block;+ width: 100%;+ padding: 12px 14px;+ text-align: left;+ color: inherit;+ font-weight: 400;+}+.ai-custom-candidate-head {+ display: flex;+ align-items: baseline;+ gap: 10px;+ flex-wrap: wrap;+}+.ai-custom-candidate-head .chip-text { font-weight: 650; }+.ai-custom-candidate-hint { font-size: 11.5px; color: var(--muted); }+.ai-custom-candidate-copy {+ margin-top: 8px;+ color: var(--ink);+ font-size: 12.5px;+ line-height: 1.55;+ white-space: pre-wrap;+}+.ai-custom-candidate.selected .ai-custom-candidate-copy { color: inherit; }+.ai-custom-candidate .custom-input,+.ai-custom-candidate .image-strategy-custom-input {+ width: 100%;+ min-height: 86px;+ margin-top: 8px;+ resize: vertical;+}/* ---- recommended chip + group labels ---- */.chip.recommended {diff --git a/skills/ppt-master/scripts/docs/confirm_ui.md b/skills/ppt-master/scripts/docs/confirm_ui.mdindex ce2ef4c8..83f78742 100644--- a/skills/ppt-master/scripts/docs/confirm_ui.md+++ b/skills/ppt-master/scripts/docs/confirm_ui.md@@ -48,16 +48,16 @@ Dependency:pip install flask```-## Two kinds of field+## Field shapes-- **Enumerable + custom** — canvas / mode / visual_style / icons. The page lists common options from `static/catalogs.json`, badges the AI's recommendation, and still offers a Custom box for edge cases. In the icon field, concrete libraries stay together while **No icons** and **Custom** each occupy a separate row because they are distinct paths, not additional library styles.+- **Enumerable + custom** — canvas / icons retain blank manual inputs; mode / visual_style instead show a mandatory AI-authored proposal in full, initially unselected and editable after selection. Selected mode / style writes literal `custom` plus its behavior sibling.- **Visual examples for hard-to-name choices** — the full-screen confirmation page loads real SVG page samples from `static/style_previews/` for `visual_style`, and renders real sample SVGs from `templates/icons` for `icons`. These thumbnails make style and icon-library choices visually comparable before the user locks them. Preview copy is fixed role text (big title / section title / body / points), not project content from `recommendations.json`, so users compare visual treatment rather than copywriting. These previews are a confirmation aid only: they do not add fields to `recommendations.json` or `result.json`, and they do not replace the later Step 6 live preview.- **Image usage multi-select** — image sources are selected as one or more catalog ids: `ai` = AI-generated, `web` = Web-sourced, `provided` = User-provided, `placeholder` = Placeholder, `none` = No images. `none` is exclusive. Recommendation and result values may be a legacy single string, but new files should use an array. When several sources are recommended, write the source ids to `recommend.image_usage` and write the actual usage strategy to `image_notes`, not a custom prose value.- **Closed enumerable** — PPT reading mode (`delivery_purpose` compatibility key), formula policy / generation mode / refine spec, plus AI source only when image usage includes `ai`. These have no Custom box; out-of-catalog values snap back to the recommended option.- **Open prose** — `audience`, `communication_intent`, `audience_outcome`, `core_message`, `delivery_context`, `artifact_afterlife`, `content_divergence`, and `page_count`. `communication_intent` may carry several purposes plus priority / sequence; common paths appear only as help text. `content_divergence` remains a separate source-treatment axis.- **Coordinated generative directions** — `design_directions` carries ≥3 safe / shifted / bold candidates. Each candidate bundles visual style, color, typography, icon id, and conditional generated-image rendering. The page can still render legacy top-level `color`, `typography`, and `image_strategy` candidates, but new staged recommendations use the coordinated bundle.-**Custom box** appears only on fields whose universe is genuinely open — `canvas`, `mode`, `visual_style`, and `icons`. Image usage uses a multi-select source list plus `image_notes` instead of a Custom box. 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.+AI-authored custom proposals apply only to mode, visual style, and conditional AI-image rendering; a selected proposal cannot be blank. Color / typography keep their existing manual Custom cards. Image usage uses source ids plus `image_notes`; closed sets have no Custom path.**Stage-1 current-value contract.** Each editable prose box starts with the Strategist's recommendation, if one exists. The user may retain, revise, or clear it; no Stage-1 prose field has a non-empty validation gate. On confirmation, the browser submits the current strings and the server preserves them through every later stage and the final `result.json`, including `""`. Blank means no explicit user constraint and may cause downstream default judgment, but it never causes the initial recommendation to be restored. A profile-declared `locked: true` field is read-only and remains the sole exception.@@ -136,6 +136,23 @@ After Stage 1 is confirmed, overwrite the file with the complete Stage-2 solutio"value": "选用封面、章节页和数据页原型;跳过示例内容页。品牌标识和页脚保留,正文可按当前材料重组。"},"image_notes": { "value": "封面和章节页用 AI 主视觉;产品页优先用户素材。" },+ "custom_candidates": {+ "mode": {+ "name_zh": "冲突到决策",+ "behavior_zh": "先建立业务冲突,再用结论先行结构推动决策。"+ },+ "visual_style": {+ "name_zh": "编辑批注风",+ "behavior_zh": "严格栅格配合边注和证据强调。"+ },+ "image_strategy": {+ "name_zh": "证据拼贴",+ "rendering": "custom",+ "visual_zh": "纸面证据拼贴",+ "mood_zh": "审慎可信",+ "behavior_zh": "裁切纸面配少量批注,保持平面深度并继承演示色板。"+ }+ },"design_directions": {"selected": 0,"candidates": [@@ -167,7 +184,7 @@ After Stage 1 is confirmed, overwrite the file with the complete Stage-2 solutio}```-The example shows one candidate for brevity; a real file carries ≥3 coordinated directions. Top-level `color`, `typography`, `image_strategy`, and `visual_style_spectrum` remain read-compatible for legacy payloads, but new staged files do not duplicate the bundle.+The example abbreviates the ≥3 preset directions. `custom_candidates.mode` / `.visual_style` are mandatory; `.image_strategy` is mandatory when proposed sources include `ai`. Each is separate from the preset bundle and needs localized, non-empty copy. Legacy top-level candidate fields remain read-compatible.After Stage 2 is confirmed, overwrite it with Stage-3 production recommendations only:@@ -184,7 +201,8 @@ After Stage 2 is confirmed, overwrite it with Stage-3 production recommendations}```-- `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.+- `recommend.*` names each recommended id. New mode / style values use a catalog id or literal `custom`; arbitrary prose values are legacy-only. Use `recommend.image_strategy: "custom"` only when an explicit user-supplied image direction should start selected. Missing recommendations fall back to the normal preset. Legacy aliases remain accepted; new files write canonical ids.+- `custom_candidates` is recommendation-only. Mode / style carry localized `name` + `behavior`; conditional image strategy also carries `rendering: "custom"`, `visual`, and `mood`. The server rejects missing required candidates; the UI shows full copy, edits it only after selection, rejects a selected blank, and omits unselected candidates from `result.json`. Template-backed proposals obey inherited identity, prototype capacity, and `template_application`.- `audience`, `communication_intent`, and `audience_outcome` are load-bearing Stage-1 reasoning inputs, so seed concrete recommendations when the evidence supports them; they are not required user inputs. Every Stage-1 prose field may be blank after confirmation, while the six communication keys remain present as key lines in `spec_lock.md communication`. `communication_intent` may preserve several purposes plus priority / sequence; never add a `primary_job` enum.- Do not write `recommend.template_reuse_scope` or `recommend.template_adherence`. Strategist records those internal exporter values later in `spec_lock.md` after inspecting the actual template and current content.- For an active template workspace, write one editable prose field as top-level `template_application.value`. It summarizes actual page/prototype use and preservation/reorganization decisions. Omit it for free design. The UI returns the current string through Stage 2, Stage 3, and final confirmation; Strategist then persists the final effective plan as `- **Template Application**: ...` in `design_spec.md §I`, and `page-context` projects it to Executor. Never replace it with internal reuse/adherence ids or a fixed option menu.@@ -197,7 +215,7 @@ After Stage 2 is confirmed, overwrite it with Stage-3 production recommendations- **Per-role size override** (parallel to color's per-role HEX override): besides `body_size`, the page exposes editable inputs for `title` / `subtitle` / `annotation`. The browser applies one documented deterministic dependency chain: `reading mode → body baseline → unpinned role sizes` (role ramp: `body ×` the §g ratios). Changing reading mode updates the body and all unpinned roles locally; changing body updates unpinned roles locally. Editing body or a role pins that value, so later reading-mode changes do not overwrite it. Font / direction-card selection preserves all current sizes. This is a browser-only state update: it performs no fetch, asks the backend to author no new recommendations, and a re-render preserves exactly what the user sees. Each role input is labelled as px and shows an approximate pt equivalent (`1px = 0.75pt`) for orientation. The final values are written to `result.json` as `typography.sizes: { "title", "subtitle", "annotation" }` in **px** — every canvas, no pt and no `sizes_pt` provenance. Candidate `sizes` remain accepted for compatibility, but the fresh Stage-2 baseline is normalized through the same local ramp before first render.- **`delivery_purpose` compatibility key / Reading mode** (enumerable, PPT only) decides where meaning is carried, not merely how large type is: `text` makes pages self-contained with complete sentences, short prose, captions, tables, and necessary detail; `balanced` shares explanation between page and presenter; `presentation` uses one idea, concise claims, and visual evidence while speech / notes carry the detail. It therefore governs page grammar, granularity, density / rhythm, and note burden. Reading-mode cards intentionally show **no px value**; the typography section owns the separately visible body / role sizes and applies any local default. It is surfaced in Stage 2 beside the visual system, separate from communication intent. `recommend.delivery_purpose` pre-selects one; `result.json` retains the key, while `spec_lock.md` uses canonical `consumption_mode`. Non-PPT canvases omit it.- **Combined style preview** — a compact live "overall impression" strip sits just above the color section and is **sticky**: it pins under the topbar so it stays visible while the user scrolls through the color / icon / typography sections, keeping the picking controls and their combined effect on screen together. It applies the currently selected color palette **and** typography (heading sample in `primary` over `background`, body sample in `body_text`, an `accent` bar, a `secondary_bg` chip) and repaints on every color / HEX-override / font / `body_size` change. It does not replace the per-candidate swatches or font samples (those stay for picking); it is deliberately an abstract style chip, **not** a slide-layout preview — page layout preview remains the live-preview server's job (Step 6). No schema field; it derives entirely from the existing color + typography selections.-- **Generated-image direction** is a rendering decision inside each `design_directions` candidate and is shown only when `image_usage` includes `ai`. Each object records `rendering` plus short `visual` / `mood` prose. The right-side image section renders up to three recommended cards with one reference thumbnail each in a single row; Custom occupies a separate full-width row below them. The left preview simultaneously shows the currently selected generated-image rendering at a larger size, updating immediately when the user changes the right-side selection. The UI writes no `palette` or `color` field: final image colors come directly from the selected deck `color.palette`. Legacy `image_strategy.palette` input is accepted but ignored for color and stripped from new submissions.+- **Generated-image direction** appears only for `image_usage: ai`: up to three preset cards plus one full-width AI custom proposal. Custom has no preset dropdown; selection makes it editable and submits `rendering: "custom"` + `behavior`. The live preview follows the selection. No image palette is written; deck colors remain authoritative, and legacy `image_strategy.palette` is ignored.- **`design_directions`** is the canonical Stage-2 personality spectrum. Each candidate carries localized name / note, `visual_style`, `color`, `typography`, `icons`, and conditional `image_strategy`. Author ≥3 spanning safe / shifted / bold (honest-shortfall exception applies). Selecting one applies the whole bundle; the component controls below are advanced overrides. The bundle itself is presentation-only—`result.json` stores the actual selected components, not a direction id.- `recommend.generation_mode` and `refine_spec` mirror the two mandatory notes in [`generate-pptx`](../../workflows/generate-pptx.md) Step 4. Confirmed `generation_mode: "split"` / `refine_spec: true` are explicit user choices, equivalent to opting in through chat.- `content_divergence` is a **free-text** Stage-1 source-treatment field. Blank means a balanced default; facts stay sourced at every level. Strategist consumes it while authoring §IX and records it in `design_spec.md §I`; it is not written to `spec_lock.md`. Beautify sends `{ "value": "keep source wording and page structure verbatim", "locked": true }`, so the UI displays it read-only and the server restores it on every staged submit. Template-fill does not use this confirmation flow and does not surface it.@@ -236,13 +254,13 @@ After Stage 2 is confirmed, overwrite it with Stage-3 production recommendations}```-The shape above is the **final** result: Stage 1 owns the communication contract, Stage 2 owns the complete deck solution (including color / typography / icons / images), and Stage 3 adds production mechanics. Intermediate writes carry the accumulated earlier fields with `stage1-confirmed` or `stage2-confirmed`; legacy `tier1` / `tier2` remain read-compatible but are no longer written.+The shape above is final. Selected custom values use `mode: custom` + `mode_behavior`, `visual_style: custom` + `visual_style_behavior`, or `image_strategy.rendering: custom` + `behavior`. Intermediate writes retain accumulated fields; legacy tier names remain read-compatible.**Final-result consumption contract.** A final result is the user-confirmed input contract for the Strategist's Design Spec, not another recommendation input. The Strategist re-reads the complete final object, writes and audits `design_spec.md` against every explicitly present field, and may autonomously decide only details that remain unconfirmed. Only after that audit passes does it project `spec_lock.md` from the completed Design Spec; lock authoring is not a second design pass. It must not omit, substitute, narrow, weaken, reinterpret, or re-recommend a confirmed value. If one value cannot be honored, the owning workflow reports or pauses under failure recovery; it never deletes the requirement to keep the pipeline moving.-- Any option field may instead hold a **free-text custom string** (the user picked **Custom**); `color` / `typography` custom entries set `name: "custom"`. Image usage is not a custom string in new results: it is a source-id array, with free-text strategy captured in `image_notes`.+- Bespoke mode / style prose lives only in the required behavior sibling; image custom prose lives in `image_strategy.behavior`. Canvas / icons retain free-text edge cases, color / typography retain `name: "custom"`, and image usage remains a source-id array plus `image_notes`.- `image_ai_path` and `image_strategy` are omitted from `result.json` unless `image_usage` includes `ai`. 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-image.md`](../../references/strategist-image.md) §2 (no re-pick).-- After the user clicks the **final Confirm** (Stage 3, or single-pass), the page saves `result.json` and shuts the server down (auto-close). Stage-1 **Confirm contract & continue** and Stage-2 **Confirm solution & continue** keep the page open while it polls for the once-authored downstream stage. In the default flow, the first `--daemon --wait` returns on the stage-1 result, `--wait-only --wait-stage stage2` returns on the stage-2 result, and the final `--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.+- After the user clicks the **final Confirm** (Stage 3, or single-pass), the page saves `result.json` and shuts the server down (auto-close). Stage-1 **Confirm contract & continue** and Stage-2 **Confirm solution & continue** keep the page open while it polls for the once-authored downstream stage. In the default flow, the first `--daemon --wait` returns on the stage-1 result, `--wait-only --wait-stage stage2` returns on the stage-2 result, and the final `--wait-only` returns on the final result; the AI reads each immediately — no extra chat confirmation is required. Chat fallback shows the same initially-unselected custom proposals. 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.## Scope