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(import-sources): same-text Markdown with different assets is not a duplicate
hugohe3104bc3c919f4
diff --git a/skills/ppt-master/scripts/project_management/cli.py b/skills/ppt-master/scripts/project_management/cli.pyindex f2682141..911b4c92 100644--- a/skills/ppt-master/scripts/project_management/cli.py+++ b/skills/ppt-master/scripts/project_management/cli.py@@ -596,11 +596,32 @@ class ProjectManager:passexisting_content = existing.read_text(encoding="utf-8", errors="replace")- if self._canonicalize_markdown_content(existing_content) == canonical_source:+ if (+ self._canonicalize_markdown_content(existing_content) == canonical_source+ and self._companion_assets_match(source_path, existing)+ ):return existingreturn None+ def _companion_assets_match(self, first: Path, second: Path) -> bool:+ """Same-text Markdown is a duplicate only if its <stem>_files/ bytes match too.++ Canonical text ignores the asset folder name, so two exports with+ different charts behind the same references used to collapse into one.+ """+ def snapshot(markdown: Path) -> dict[str, bytes] | None:+ assets = self._companion_asset_dir(markdown)+ if assets is None:+ return None+ return {+ path.relative_to(assets).as_posix(): path.read_bytes()+ for path in assets.rglob("*")+ if path.is_file()+ }++ return snapshot(first) == snapshot(second)+def _companion_asset_dir(self, source_path: Path) -> Path | None:candidate = source_path.with_name(f"{source_path.stem}_files")if candidate.exists() and candidate.is_dir():diff --git a/skills/ppt-master/scripts/tests/test_audit_r3_sources.py b/skills/ppt-master/scripts/tests/test_audit_r3_sources.pyindex 1daf8eb5..833f7bcd 100644--- a/skills/ppt-master/scripts/tests/test_audit_r3_sources.py+++ b/skills/ppt-master/scripts/tests/test_audit_r3_sources.py@@ -648,6 +648,32 @@ class TextSourceEncodingTests(unittest.TestCase):self.assertIn("收入增长和利润说明", text)+class MarkdownDuplicateAssetTests(unittest.TestCase):+ def test_same_text_with_different_companion_assets_is_not_a_duplicate(self) -> None:+ with tempfile.TemporaryDirectory() as tmp:+ root = Path(tmp)+ manager = project_cli.ProjectManager(base_dir=root / "projects")+ with contextlib.redirect_stdout(io.StringIO()):+ project = Path(manager.init_project("deck", quick_generate=True))++ def export(folder: str, stem: str, revenue: int) -> Path:+ directory = root / folder+ (directory / f"{stem}_files").mkdir(parents=True)+ (directory / f"{stem}_files" / "chart.svg").write_text(+ f"<svg><text>Revenue {revenue}</text></svg>", encoding="utf-8")+ source = directory / f"{stem}.md"+ source.write_text(f"# R\n\n\n", encoding="utf-8")+ return source++ imports = [export("a", "old", 10), export("b", "new", 20), export("c", "same", 10)]+ results = []+ with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()):+ for source in imports:+ results.append(manager.import_sources(str(project), [str(source)], copy=True))+ self.assertEqual([Path(item).name for item in results[1]["markdown"]], ["new.md"])+ self.assertEqual([Path(item).name for item in results[2]["markdown"]], ["old.md"])++class _CurlHeaders(dict):"""Represent repeated curl headers without importing optional curl_cffi."""