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

fix(ppt): unify SVG editor preview lifecycle

hugohe3dd76b8a1464d
diff --git a/AGENTS.md b/AGENTS.md
index 9a1bb320..828d92b0 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -8,7 +8,7 @@ Before any PPT generation task, **you MUST first read [`skills/ppt-master/SKILL.
PPT Master is an AI-driven presentation generation system. Multi-role collaboration (Strategist → Image_Generator → Executor) converts source documents (PDF/DOCX/URL/Markdown) into natively editable PPTX with real PowerPoint shapes (DrawingML).
-**Core Pipeline**: `Source Document → Create Project → [Template] → Strategist Eight Confirmations → [Image_Generator] → Executor → Quality Check → Post-processing → Export PPTX`
+**Core Pipeline**: `Source Document → Create Project → [Template] → Strategist Eight Confirmations → [Image_Generator] → Executor Live Preview → Quality Check → Post-processing → Export PPTX`
> Topic-only requests with no source material: run the standalone [`topic-research`](skills/ppt-master/workflows/topic-research.md) workflow before SKILL.md Step 1 to gather web materials.
>
@@ -20,7 +20,7 @@ PPT Master is an AI-driven presentation generation system. Multi-role collaborat
>
> Object-level animation tuning: when the user asks to change animation order, effect, timing, or a specific object's reveal behavior, run the standalone [`customize-animations`](skills/ppt-master/workflows/customize-animations.md) workflow. Default export already has global animations; do not create `animations.json` unless customization was requested.
>
-> Post-export iteration: whenever the user asks to change anything on a generated slide ("改一下", "调字号", "那里看着不对", "把图片换大点"), the [`visual-edit`](skills/ppt-master/workflows/visual-edit.md) workflow is available — surface it as an option. If the user describes the change with enough specificity to apply directly ("第 3 页副标题字号改 32"), edit the SVG directly instead; if they're vaguely pointing at "somewhere" on the deck, run the workflow.
+> Finished-deck re-entry: the main pipeline starts the live preview during Executor. If the deck has been exported, the editor was closed, and the user later wants another visual edit pass, run [`visual-edit`](skills/ppt-master/workflows/visual-edit.md) to reopen the editor, apply annotations, re-export, and reopen again.
## Execution Requirements
@@ -58,6 +58,7 @@ python3 skills/ppt-master/scripts/project_manager.py validate <project_path>
# Image tools and SVG quality check
python3 skills/ppt-master/scripts/analyze_images.py <project_path>/images
python3 skills/ppt-master/scripts/image_gen.py "prompt" --aspect_ratio 16:9 --image_size 1K -o <project_path>/images
+python3 skills/ppt-master/scripts/svg_editor/server.py <project_path> --live
python3 skills/ppt-master/scripts/svg_quality_checker.py <project_path>
python3 skills/ppt-master/scripts/animation_config.py scaffold <project_path> # optional, only for custom object-level animation
python3 skills/ppt-master/scripts/animation_config.py validate <project_path> # optional, before re-export
diff --git a/CLAUDE.md b/CLAUDE.md
index 9fe0f2e5..9270a082 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -8,7 +8,7 @@ Before any PPT generation task, **you MUST first read [`skills/ppt-master/SKILL.
PPT Master is an AI-driven presentation generation system. Multi-role collaboration (Strategist → Image_Generator → Executor) converts source documents (PDF/DOCX/URL/Markdown) into natively editable PPTX with real PowerPoint shapes (DrawingML).
-**Core Pipeline**: `Source Document → Create Project → [Template] → Strategist Eight Confirmations → [Image_Generator] → Executor → Quality Check → Post-processing → Export PPTX`
+**Core Pipeline**: `Source Document → Create Project → [Template] → Strategist Eight Confirmations → [Image_Generator] → Executor Live Preview → Quality Check → Post-processing → Export PPTX`
> Topic-only requests with no source material: run the standalone [`topic-research`](skills/ppt-master/workflows/topic-research.md) workflow before SKILL.md Step 1 to gather web materials.
>
@@ -18,7 +18,9 @@ PPT Master is an AI-driven presentation generation system. Multi-role collaborat
>
> Recorded narration / video export: run the standalone [`generate-audio`](skills/ppt-master/workflows/generate-audio.md) workflow after post-processing.
>
-> Post-export iteration: whenever the user asks to change anything on a generated slide ("改一下", "调字号", "那里看着不对", "把图片换大点"), the [`visual-edit`](skills/ppt-master/workflows/visual-edit.md) workflow is available — surface it as an option. If the user describes the change with enough specificity to apply directly ("第 3 页副标题字号改 32"), edit the SVG directly instead; if they're vaguely pointing at "somewhere" on the deck, run the workflow.
+> Object-level animation tuning: when the user asks to change animation order, effect, timing, or a specific object's reveal behavior, run the standalone [`customize-animations`](skills/ppt-master/workflows/customize-animations.md) workflow. Default export already has global animations; do not create `animations.json` unless customization was requested.
+>
+> Finished-deck re-entry: the main pipeline starts the live preview during Executor. If the deck has been exported, the editor was closed, and the user later wants another visual edit pass, run [`visual-edit`](skills/ppt-master/workflows/visual-edit.md) to reopen the editor, apply annotations, re-export, and reopen again.
## Execution Requirements
@@ -44,6 +46,7 @@ Convenience summary only — full workflow in [`skills/ppt-master/SKILL.md`](ski
# Source content conversion
python3 skills/ppt-master/scripts/source_to_md/pdf_to_md.py <PDF_file>
python3 skills/ppt-master/scripts/source_to_md/doc_to_md.py <DOCX_or_other_file>
+python3 skills/ppt-master/scripts/source_to_md/excel_to_md.py <XLSX_or_XLSM_file>
python3 skills/ppt-master/scripts/source_to_md/ppt_to_md.py <PPTX_file>
python3 skills/ppt-master/scripts/source_to_md/web_to_md.py <URL>
@@ -55,7 +58,10 @@ python3 skills/ppt-master/scripts/project_manager.py validate <project_path>
# Image tools and SVG quality check
python3 skills/ppt-master/scripts/analyze_images.py <project_path>/images
python3 skills/ppt-master/scripts/image_gen.py "prompt" --aspect_ratio 16:9 --image_size 1K -o <project_path>/images
+python3 skills/ppt-master/scripts/svg_editor/server.py <project_path> --live
python3 skills/ppt-master/scripts/svg_quality_checker.py <project_path>
+python3 skills/ppt-master/scripts/animation_config.py scaffold <project_path> # optional, only for custom object-level animation
+python3 skills/ppt-master/scripts/animation_config.py validate <project_path> # optional, before re-export
# Post-processing pipeline: run sequentially, one command at a time
python3 skills/ppt-master/scripts/total_md_split.py <project_path>
@@ -63,7 +69,7 @@ python3 skills/ppt-master/scripts/finalize_svg.py <project_path>
python3 skills/ppt-master/scripts/svg_to_pptx.py <project_path>
```
-## Architecture
+## Core Directories
- `skills/ppt-master/SKILL.md` — main workflow authority.
- `skills/ppt-master/references/` — role definitions and technical specifications.
diff --git a/skills/ppt-master/SKILL.md b/skills/ppt-master/SKILL.md
index 1cb78e0b..63c9187c 100644
--- a/skills/ppt-master/SKILL.md
+++ b/skills/ppt-master/SKILL.md
@@ -11,7 +11,7 @@ description: >
> AI-driven multi-format SVG content generation system. Converts source documents into high-quality SVG pages through multi-role collaboration and exports to PPTX.
-**Core Pipeline**: `Source Document → Create Project → [Template] → Strategist → [Image_Generator] → Executor → Post-processing → Export`
+**Core Pipeline**: `Source Document → Create Project → [Template] → Strategist → [Image_Generator] → Executor Live Preview → Quality Check → Post-processing → Export`
> [!CAUTION]
> ## 🚨 Global Execution Discipline (MANDATORY)
@@ -77,7 +77,7 @@ For complete tool documentation, see `${SKILL_DIR}/scripts/README.md`.
| `resume-execute` | `workflows/resume-execute.md` | Phase B entry — resume execution in a fresh chat after Phase A (Step 1–5) completed in another session (split mode) |
| `verify-charts` | `workflows/verify-charts.md` | Chart coordinate calibration — run after SVG generation if the deck contains data charts |
| `customize-animations` | `workflows/customize-animations.md` | Object-level PPTX animation customization — run only when the user explicitly asks to tune animation order/effects/timing |
-| `visual-edit` | `workflows/visual-edit.md` | Browser-based visual editor for fine-grained edits — run only when the user explicitly requests it after export |
+| `visual-edit` | `workflows/visual-edit.md` | Browser-based re-entry editor for finished/exported decks — reopen after edits are applied, not the main generation viewer |
---
@@ -289,6 +289,19 @@ Read references/executor-consultant-top.md # Top consulting style (MBB level)
**Design Parameter Confirmation (Mandatory)**: before the first SVG, output key design parameters from the spec (canvas dimensions, color scheme, font plan, body font size). See executor-base.md §2.
+**Live Preview Auto-Startup (Mandatory)**: before the first SVG, automatically start the browser editor in live mode and keep it running through Executor + Export:
+```bash
+python3 ${SKILL_DIR}/scripts/svg_editor/server.py <project_path> --live
+```
+- This is the main generation preview, not the finished-deck `visual-edit` workflow.
+- Start it immediately when Executor begins; `svg_output/` may be empty.
+- Run it as a long-running side process/session; do not wait for the server process to exit before generating SVG pages.
+- The editor opens `http://localhost:5050` by default and polls for new SVG pages in live mode.
+- **Add annotation** creates a local annotation; **Submit annotations** writes annotations to disk and keeps the service running; **Exit preview** is the only UI action that stops Flask.
+- If the user clicks **Exit preview**, generation should continue without preview unless the user asks to reopen it.
+- If port `5050` is occupied, pass `--port <other>` and report the actual URL.
+- Do not wait for user confirmation after startup; continue the serial Executor pipeline.
+
**Pre-generation Batch Read (Mandatory)**: before the first SVG, batch-read every distinct layout SVG referenced in `spec_lock.page_layouts` and every distinct chart SVG referenced in `spec_lock.page_charts` (plus any §VII backup charts). One read per file, up front — do not re-read these during page generation. See executor-base.md §1.0.
**Per-page spec_lock re-read (Mandatory)**: before **each** SVG page, `read_file <project_path>/spec_lock.md` and use only its colors / fonts / icons / images, plus the per-page `page_rhythm` / `page_layouts` / `page_charts` lookups (resolves to template SVGs already loaded in the batch read above). Resists context-compression drift on long decks. See executor-base.md §2.1.
@@ -298,6 +311,14 @@ Read references/executor-consultant-top.md # Top consulting style (MBB level)
**Visual Construction Phase**: generate SVG pages sequentially, one at a time, in one continuous pass → `<project_path>/svg_output/`
+**Live Annotation Handling (Mandatory)**: after each page generation and before Step 7, check for submitted annotations:
+```bash
+python3 ${SKILL_DIR}/scripts/check_annotations.py <project_path>
+```
+- If no annotations are found, continue.
+- If annotations are found, apply them to the targeted SVG elements, remove `data-edit-target` / `data-edit-annotation`, then run `svg_quality_checker.py`.
+- Do not proceed past a touched page with quality-check `error`s.
+
**Quality Check Gate (Mandatory)** — after all SVGs, BEFORE speaker notes:
```bash
python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path>
@@ -311,7 +332,9 @@ python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path>
**✅ Checkpoint — Confirm all SVGs and notes are fully generated and quality-checked. Proceed directly to Step 7 post-processing**:
```markdown
## ✅ Executor Phase Complete
+- [x] Live preview started and kept available at the reported URL
- [x] All SVGs generated to svg_output/
+- [x] Submitted live annotations checked/applied or confirmed absent
- [x] svg_quality_checker.py passed (0 errors)
- [x] Speaker notes generated at notes/total.md
```
@@ -383,7 +406,7 @@ Full effect list, anchor logic, and limits: [`references/animations.md`](referen
> ❌ **NEVER** force `-s output` for the legacy/preview pptx (PowerPoint's internal SVG parser drops icons and rounded corners). The default auto-split already gives native the high-fidelity source it needs without touching legacy.
> ❌ **NEVER** use `--only` (it suppresses one of the two output files)
-> Post-export iteration: whenever the user asks to change anything on a generated slide ("改一下", "调字号", "那里看着不对", "把图片换大点"), the [`visual-edit`](workflows/visual-edit.md) workflow is available — surface it as an option. If the user describes the change with enough specificity to apply directly ("第 3 页副标题字号改 32"), edit the SVG directly instead; if they're vaguely pointing at "somewhere" on the deck, run the workflow.
+> Finished-deck re-entry: the main pipeline automatically starts live preview in Step 6. If the deck has been exported and the user later wants another visual edit pass, run [`visual-edit`](workflows/visual-edit.md); that workflow automatically reopens the same editor service in finished-deck mode, applies annotations, re-exports, and reopens again.
---
diff --git a/skills/ppt-master/scripts/svg_editor/server.py b/skills/ppt-master/scripts/svg_editor/server.py
index 121c94bc..743bd351 100644
--- a/skills/ppt-master/scripts/svg_editor/server.py
+++ b/skills/ppt-master/scripts/svg_editor/server.py
@@ -11,6 +11,7 @@ Usage:
Examples:
python3 scripts/svg_editor/server.py projects/my-project
python3 scripts/svg_editor/server.py projects/my-project --port 8080
+ python3 scripts/svg_editor/server.py projects/my-project --live
Dependencies:
flask>=3.0.0
@@ -89,7 +90,7 @@ def _inline_icons(content: str) -> str:
return new_content
-def create_app(project_dir: str, idle_timeout: int = 900) -> Flask:
+def create_app(project_dir: str, idle_timeout: int = 900, live: bool = False) -> Flask:
"""Create and configure the Flask app for a given project directory."""
project_path = Path(project_dir).resolve()
svg_dir = project_path / 'svg_output'
@@ -99,6 +100,7 @@ def create_app(project_dir: str, idle_timeout: int = 900) -> Flask:
app = Flask(__name__, static_folder='static', static_url_path='/static')
app.config['PROJECT_PATH'] = project_path
app.config['SVG_DIR'] = svg_dir
+ app.config['LIVE_MODE'] = live
# In-memory annotation store: {filename: {element_id: annotation_text}}
app.config['ANNOTATIONS'] = {}
@@ -111,6 +113,8 @@ def create_app(project_dir: str, idle_timeout: int = 900) -> Flask:
app.config['LAST_REQUEST_TIME'] = time.time()
def _idle_watchdog():
+ if idle_timeout <= 0:
+ return
while True:
time.sleep(10)
elapsed = time.time() - app.config['LAST_REQUEST_TIME']
@@ -125,9 +129,12 @@ def create_app(project_dir: str, idle_timeout: int = 900) -> Flask:
@app.route('/api/shutdown', methods=['POST'])
def shutdown():
+ data = request.get_json(silent=True) or {}
+ reason = data.get('reason') or 'shutdown'
+
def _stop():
time.sleep(0.5) # Let HTTP response flush before killing the process
- print("SVG Editor shutting down (user saved annotations).")
+ print(f"SVG Editor shutting down ({reason}).")
# os._exit: save-all already wrote to disk; 0.5s delay ensures response is sent.
os._exit(0)
threading.Thread(target=_stop, daemon=True).start()
@@ -137,6 +144,12 @@ def create_app(project_dir: str, idle_timeout: int = 900) -> Flask:
def index():
return send_from_directory(app.static_folder, 'index.html')
+ @app.route('/api/config')
+ def get_config():
+ return jsonify({
+ 'live': app.config['LIVE_MODE'],
+ })
+
@app.route('/images/<path:filename>')
def serve_image(filename: str):
"""Serve images referenced by SVGs as `../images/*.png`.
@@ -178,22 +191,20 @@ def create_app(project_dir: str, idle_timeout: int = 900) -> Flask:
annotations = app.config['ANNOTATIONS']
slides = []
for svg_file in sorted(svg_dir.glob('*.svg')):
- has_disk_anns = False
+ disk_annotations = []
try:
tree = ET.parse(str(svg_file))
- for elem in tree.getroot().iter():
- if elem.get('data-edit-target') == 'true':
- has_disk_anns = True
- break
+ disk_annotations = parse_annotations(tree.getroot())
except ET.ParseError:
pass
- has_mem_anns = svg_file.name in annotations and len(annotations[svg_file.name]) > 0
+ mem_count = len(annotations.get(svg_file.name, {}))
+ annotation_count = max(len(disk_annotations), mem_count)
slides.append({
'name': svg_file.name,
- 'annotated': has_disk_anns or has_mem_anns,
- 'annotation_count': len(annotations.get(svg_file.name, {})),
+ 'annotated': annotation_count > 0,
+ 'annotation_count': annotation_count,
})
return jsonify({'slides': slides})
@@ -354,7 +365,17 @@ def build_parser() -> argparse.ArgumentParser:
parser.add_argument('project_dir', help='Path to project directory (contains svg_output/)')
parser.add_argument('--port', type=int, default=5050, help='Port to listen on (default: 5050)')
parser.add_argument('--no-browser', action='store_true', help='Do not auto-open browser')
- parser.add_argument('--timeout', type=int, default=900, help='Idle timeout in seconds (default: 900 = 15min)')
+ parser.add_argument(
+ '--live',
+ action='store_true',
+ help='Run as Executor live preview: allow empty svg_output/ and keep serving after annotation submit',
+ )
+ parser.add_argument(
+ '--timeout',
+ type=int,
+ default=None,
+ help='Idle timeout in seconds (default: 900; live mode default: 0 = disabled)',
+ )
return parser
@@ -363,17 +384,29 @@ def main(argv: Optional[list[str]] = None) -> int:
args = parser.parse_args(argv)
project_path = Path(args.project_dir).resolve()
- if not (project_path / 'svg_output').exists():
- print(f"Error: {project_path / 'svg_output'} does not exist", file=sys.stderr)
+ svg_output = project_path / 'svg_output'
+ if not svg_output.exists():
+ if args.live:
+ svg_output.mkdir(parents=True, exist_ok=True)
+ else:
+ print(f"Error: {svg_output} does not exist", file=sys.stderr)
+ return 1
+ elif not svg_output.is_dir():
+ print(f"Error: {svg_output} is not a directory", file=sys.stderr)
return 1
- app = create_app(str(project_path), idle_timeout=args.timeout)
+ idle_timeout = args.timeout
+ if idle_timeout is None:
+ idle_timeout = 0 if args.live else 900
+
+ app = create_app(str(project_path), idle_timeout=idle_timeout, live=args.live)
url = f'http://localhost:{args.port}'
if not args.no_browser:
webbrowser.open(url)
- print(f"SVG Editor running at {url}")
+ mode = "live preview" if args.live else "visual edit"
+ print(f"SVG Editor running at {url} ({mode})")
print(f"Project: {project_path}")
app.run(host='127.0.0.1', port=args.port, debug=False)
return 0
diff --git a/skills/ppt-master/scripts/svg_editor/static/app.js b/skills/ppt-master/scripts/svg_editor/static/app.js
index cd3da177..c0102e78 100644
--- a/skills/ppt-master/scripts/svg_editor/static/app.js
+++ b/skills/ppt-master/scripts/svg_editor/static/app.js
@@ -15,6 +15,7 @@
var btnAddAnnotation = document.getElementById("btn-add-annotation");
var annotationsEl = document.getElementById("annotations");
var btnSave = document.getElementById("btn-save");
+ var btnExitPreview = document.getElementById("btn-exit-preview");
var modalOverlay = document.getElementById("modal-overlay");
var modalMessage = document.getElementById("modal-message");
var modalConfirm = document.getElementById("modal-confirm");
@@ -25,16 +26,40 @@
var currentSlide = null; // filename, e.g. "slide_01.svg"
var selectedElementIds = new Set(); // id attrs of selected SVG elements
var slideAnnotations = {}; // {element_id: annotation_text} for current slide
+ var liveMode = false;
+ var slidePollTimer = null;
+ var pendingModalAction = "submit";
// ================================================================
// 1. loadSlides -- GET /api/slides
// ================================================================
function loadSlides() {
- fetch("/api/slides")
+ return fetch("/api/slides")
.then(function (res) { return res.json(); })
.then(function (data) {
slideListEl.innerHTML = "";
- (data.slides || []).forEach(function (s) {
+ var slides = data.slides || [];
+
+ if (slides.length === 0) {
+ var empty = document.createElement("div");
+ empty.className = "slide-list-empty";
+ empty.textContent = liveMode
+ ? "Waiting for generated slides..."
+ : "No slides found";
+ slideListEl.appendChild(empty);
+ if (!currentSlide) {
+ svgPlaceholder.style.display = "block";
+ svgPlaceholder.textContent = liveMode
+ ? "Live preview is ready. Generated slides will appear here."
+ : "No slides found";
+ svgContent.style.display = "none";
+ }
+ return;
+ }
+
+ var currentExists = false;
+ slides.forEach(function (s) {
+ if (s.name === currentSlide) currentExists = true;
var item = document.createElement("div");
item.className = "slide-item" + (s.name === currentSlide ? " active" : "");
item.setAttribute("data-name", s.name);
@@ -56,6 +81,10 @@
});
slideListEl.appendChild(item);
});
+
+ if (!currentSlide || !currentExists) {
+ selectSlide(slides[0].name);
+ }
})
.catch(function (err) {
console.error("loadSlides:", err);
@@ -86,6 +115,12 @@
.then(function (data) {
if (data.error) {
console.error("selectSlide:", data.error);
+ if (liveMode) {
+ currentSlide = null;
+ svgPlaceholder.style.display = "block";
+ svgPlaceholder.textContent = "Slide is still being written. Waiting for the next refresh...";
+ svgContent.style.display = "none";
+ }
return;
}
// Render SVG
@@ -546,21 +581,51 @@
}
// ================================================================
- // 10. Save all -- two-step: confirm then save + shutdown
+ // 10. Save all -- two-step: confirm then save
// ================================================================
- var CONFIRM_MSG = "Submitting will close this page. Make sure you've added all the annotations you want.";
- var SUCCESS_MSG = "Annotations submitted.\n\nReturn to the chat and tell the AI you're ready — it will apply your edits.";
+ var CONFIRM_MSG = "Submit annotations to disk?\n\nThe preview service will stay open. Use Exit preview when you want to stop it.";
+ var SUCCESS_MSG = "Annotations submitted.\n\nReturn to the chat and tell the AI you're ready — it will apply your edits. The preview service is still running.";
+ var EXIT_CONFIRM_MSG = "Exit preview and stop the local server?\n\nUnsaved annotations will be discarded.";
+ var EXIT_SUCCESS_MSG = "Preview stopped.\n\nYou can close this tab and return to the chat.";
btnSave.addEventListener("click", function () {
- // Step 1: show confirmation
+ pendingModalAction = "submit";
modalMessage.textContent = CONFIRM_MSG;
+ modalConfirm.textContent = "Submit";
+ modalConfirm.style.display = "";
+ modalCancel.style.display = "";
+ modalOverlay.style.display = "flex";
+ });
+
+ btnExitPreview.addEventListener("click", function () {
+ pendingModalAction = "exit";
+ modalMessage.textContent = EXIT_CONFIRM_MSG;
+ modalConfirm.textContent = "Exit preview";
modalConfirm.style.display = "";
modalCancel.style.display = "";
modalOverlay.style.display = "flex";
});
modalConfirm.addEventListener("click", function () {
- // Step 2: save + shutdown
+ if (pendingModalAction === "exit") {
+ modalConfirm.style.display = "none";
+ modalCancel.style.display = "none";
+ modalMessage.textContent = "Stopping preview server...";
+ fetch("/api/shutdown", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ reason: "exit-preview" })
+ })
+ .then(function () {
+ modalMessage.textContent = EXIT_SUCCESS_MSG;
+ })
+ .catch(function () {
+ modalMessage.textContent = EXIT_SUCCESS_MSG;
+ });
+ return;
+ }
+
+ // Step 2: save annotations. Service lifetime is controlled only by Exit preview.
modalConfirm.style.display = "none";
modalCancel.style.display = "none";
@@ -571,7 +636,7 @@
modalMessage.textContent = "Save failed: " + data.error;
} else {
modalMessage.textContent = SUCCESS_MSG;
- fetch("/api/shutdown", { method: "POST" }).catch(function () {});
+ loadSlides();
}
})
.catch(function (err) {
@@ -580,15 +645,17 @@
});
modalCancel.addEventListener("click", function () {
+ modalConfirm.textContent = "Submit";
modalOverlay.style.display = "none";
});
// Close modal on overlay click
modalOverlay.addEventListener("click", function (e) {
- if (e.target === modalOverlay) {
- modalOverlay.style.display = "none";
- }
- });
+ if (e.target === modalOverlay) {
+ modalConfirm.textContent = "Submit";
+ modalOverlay.style.display = "none";
+ }
+ });
// ================================================================
// Utility
@@ -634,6 +701,30 @@
});
}
+ function loadConfig() {
+ return fetch("/api/config")
+ .then(function (res) { return res.json(); })
+ .then(function (data) {
+ liveMode = !!data.live;
+ if (liveMode) {
+ document.title = "PPT Master - Live Preview";
+ } else {
+ document.title = "PPT Master - Visual Editor";
+ }
+ btnSave.textContent = "Submit annotations";
+ })
+ .catch(function () {
+ liveMode = false;
+ });
+ }
+
+ function startSlidePolling() {
+ if (!liveMode || slidePollTimer) return;
+ slidePollTimer = window.setInterval(function () {
+ loadSlides();
+ }, 2000);
+ }
+
// ================================================================
// Property extraction & rendering
// ================================================================
@@ -758,7 +849,10 @@
// ================================================================
// Boot
// ================================================================
- loadSlides();
+ loadConfig().then(function () {
+ loadSlides();
+ startSlidePolling();
+ });
initRubberBand();
initKeyboardShortcuts();
})();
diff --git a/skills/ppt-master/scripts/svg_editor/static/index.html b/skills/ppt-master/scripts/svg_editor/static/index.html
index 77dcd2d5..a9c35a39 100644
--- a/skills/ppt-master/scripts/svg_editor/static/index.html
+++ b/skills/ppt-master/scripts/svg_editor/static/index.html
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>PPT Master - Visual Edit</title>
+ <title>PPT Master - Live Preview</title>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
@@ -35,7 +35,10 @@
<div class="section-label">Annotations on this slide</div>
<div id="annotations"></div>
</div>
- <button id="btn-save" class="btn-save">Submit annotations</button>
+ <div id="preview-actions">
+ <button id="btn-save" class="btn-save">Submit annotations</button>
+ <button id="btn-exit-preview" class="btn-exit-preview">Exit preview</button>
+ </div>
</div>
</div>
<div id="modal-overlay" style="display:none;">
diff --git a/skills/ppt-master/scripts/svg_editor/static/style.css b/skills/ppt-master/scripts/svg_editor/static/style.css
index 465fa762..68968d55 100644
--- a/skills/ppt-master/scripts/svg_editor/static/style.css
+++ b/skills/ppt-master/scripts/svg_editor/static/style.css
@@ -50,6 +50,13 @@ html, body {
padding: 8px 0;
}
+.slide-list-empty {
+ padding: 12px 16px;
+ color: #5a5a7a;
+ font-size: 13px;
+ line-height: 1.5;
+}
+
/* Scrollbar */
#slide-list::-webkit-scrollbar {
width: 6px;
@@ -369,9 +376,16 @@ html, body {
font-style: italic;
}
-/* --- Save button --- */
+/* --- Action buttons --- */
+#preview-actions {
+ padding: 12px 16px 16px;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ flex-shrink: 0;
+}
+
#btn-save {
- margin: 12px 16px 16px;
padding: 11px 0;
font-size: 14px;
font-weight: 600;
@@ -392,6 +406,28 @@ html, body {
background: #d5a522;
}
+#btn-exit-preview {
+ padding: 10px 0;
+ font-size: 13px;
+ font-weight: 600;
+ color: #c0c0d8;
+ background: transparent;
+ border: 1px solid #3a3a5a;
+ border-radius: 6px;
+ cursor: pointer;
+ transition: background 0.15s, border-color 0.15s, color 0.15s;
+}
+
+#btn-exit-preview:hover {
+ color: #ffffff;
+ background: #2a2a4a;
+ border-color: #5a5a7a;
+}
+
+#btn-exit-preview:active {
+ background: #1e1e36;
+}
+
/* ======================== MODAL ======================== */
#modal-overlay {
position: fixed;
diff --git a/skills/ppt-master/workflows/visual-edit.md b/skills/ppt-master/workflows/visual-edit.md
index f7b72413..bea7a0cd 100644
--- a/skills/ppt-master/workflows/visual-edit.md
+++ b/skills/ppt-master/workflows/visual-edit.md
@@ -1,21 +1,22 @@
---
-description: Launch a local browser-based visual editor so the user can pinpoint elements they want changed; AI applies the annotations and re-exports the PPTX
+description: Reopen the browser-based visual editor for a finished/exported deck; AI applies annotations, re-exports, and reopens the editor for another pass
---
# Visual Edit Workflow
-> Standalone post-export step. Whenever the user asks to change something on a generated slide — "改一下这里", "字号小了", "那张图不对", "把背景颜色调暖一点", or any similar wording — this workflow is the go-to **when the user can't precisely name what to change**. If the user describes the change concretely enough that you can edit the SVG directly (e.g. "第 3 页副标题字号改 32"), do that instead — don't force them through the editor.
+> Standalone finished-deck re-entry step. The main pipeline automatically starts the editor in live mode during Executor; use this workflow only after a deck has been generated/exported and the editor needs to be reopened for another visual edit pass.
-This workflow is **independent**: it operates on `<project_path>/svg_output/` and re-runs the same post-processing scripts the main pipeline uses. Safe to invoke in a fresh session as long as the project has reached Step 7.
+This workflow is **independent**: it operates on `<project_path>/svg_output/`, applies submitted annotations, and re-runs the same post-processing scripts the main pipeline uses. Safe to invoke in a fresh session as long as the project has reached Step 7.
## When to Run
-- The deck has been exported once (Steps 1–7 of the main workflow are complete).
+- The deck has been exported once (Steps 1–7 of the main workflow are complete), or the main live preview was closed after generation.
- The user wants to change one or more specific visual elements **and either can't pinpoint them in words or would benefit from clicking the slide directly**.
- A browser is reachable — either the host has a local desktop, or you can forward the port from a remote Linux server (see "Remote Linux access" below). Truly headless with no forwarding option: skip and apply edits via conversation instead.
## When NOT to Run
+- The main Executor phase is still running with `--live` preview available — use that existing editor session instead.
- The user gave a precise edit you can apply right now ("change page 3 title font-size to 32") — just edit the SVG.
- The user wants a full regeneration ("redo this slide", "换个风格") — use the main workflow.
@@ -24,14 +25,18 @@ This workflow is **independent**: it operates on `<project_path>/svg_output/` an
## Step 1: Start the editor
```bash
-python3 ${SKILL_DIR}/scripts/svg_editor/server.py <project_path> --no-browser
+python3 ${SKILL_DIR}/scripts/svg_editor/server.py <project_path>
```
-The server binds to `127.0.0.1:5050` and edits `<project_path>/svg_output/` in place. `svg_to_pptx` already snapshots `svg_output` into `backup/<timestamp>/` on every export, so prior versions are recoverable from there.
+The server binds to `127.0.0.1:5050`, opens the browser automatically on local desktop environments, and edits `<project_path>/svg_output/` in place. **Submit annotations** only writes annotations to disk; it never stops the server. The preview UI includes **Exit preview** for closing the Flask server without saving pending annotations. `svg_to_pptx` already snapshots `svg_output` into `backup/<timestamp>/` on every export, so prior versions are recoverable from there.
### Remote Linux access
-If the project lives on a remote Linux server, the editor only listens on `127.0.0.1` for safety. Forward port 5050 from your local machine using one of:
+If the project lives on a remote Linux server, run the editor with `--no-browser`; it still listens only on `127.0.0.1` for safety. Forward port 5050 from your local machine using one of:
+
+```bash
+python3 ${SKILL_DIR}/scripts/svg_editor/server.py <project_path> --no-browser
+```
- **VS Code / Cursor Remote-SSH**: open the **PORTS** panel (`Ctrl+Shift+P` → `Ports: Focus on Ports View`), click **Forward a Port**, enter `5050`. The workspace remembers it.
- **Termius**: open the **Port Forwarding** module from the left sidebar (it's a top-level module, not nested under the host). Add a rule with **Type = Local** (not Remote — Remote forwards the opposite direction), Host = your remote, Binding `127.0.0.1:5050`, Destination `127.0.0.1:5050`. Save, then **start the rule** (▶ button) — saving alone does not activate it.
@@ -43,7 +48,7 @@ After the server prints `SVG Editor running at http://localhost:5050`, tell the
- the editor is running at `http://localhost:5050`
- they should open it in a browser, click the element they want changed, write the change as a short instruction, then click **Submit annotations**
-- after saving, the server auto-shuts and they should return to the conversation
+- after submitting annotations, they should return to the conversation; the server remains open until they click **Exit preview**
- if they'd rather just describe the edit in chat, they can say so and you'll apply it directly without the editor
Do **not** wait for the user to confirm before launching — they already asked for fine-grained edits, so launching is the response. The "describe in chat instead" line is the escape hatch.
@@ -52,7 +57,7 @@ Do **not** wait for the user to confirm before launching — they already asked
Triggered when the user signals (in any wording) that they have submitted annotations and want them applied.
-1. If the server is somehow still running, kill the process.
+1. Leave the preview server running unless the user clicked **Exit preview**.
2. Discover annotations:
```bash
python3 ${SKILL_DIR}/scripts/check_annotations.py <project_path>
@@ -67,8 +72,8 @@ Triggered when the user signals (in any wording) that they have submitted annota
python3 ${SKILL_DIR}/scripts/finalize_svg.py <project_path>
python3 ${SKILL_DIR}/scripts/svg_to_pptx.py <project_path>
```
-6. Restart the editor (same command as Step 1).
-7. Tell the user (in their language) that annotations have been applied, the PPT is updated, and the editor is running again at `http://localhost:5050`.
+6. If the preview server is still running, keep using it; if it was closed, restart the editor with the Step 1 command.
+7. Tell the user (in their language) that annotations have been applied, the PPT is updated, and the editor is available at `http://localhost:5050`. If their browser still shows an old slide, ask them to refresh or reselect the slide.
8. Wait for the user's next message:
- If they indicate they're done, the loop ends.
- If they submit more annotations, return to step 1.