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: 导入源材料时按工作空间边界决定移动或复制
hugohe387d15d2d5e51
diff --git a/AGENTS.md b/AGENTS.mdindex da942069..06b04c7a 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -82,6 +82,7 @@ python3 tools/project_manager.py import-sources <项目路径> <源文件或URL.- 所有源材料统一归档到 `<项目路径>/sources/`- 如需直接移动原文件而不是复制,可追加 `--move`+- 若源文件本来就在当前工作空间内,工具会直接移动到 `sources/`,不会再额外复制一份---diff --git a/README.md b/README.mdindex dbd8ed05..d0c16fce 100644--- a/README.md+++ b/README.md@@ -171,6 +171,8 @@ python3 tools/project_manager.py init <项目名> --format ppt169# 将源材料归档到项目目录python3 tools/project_manager.py import-sources <项目路径> <源文件或URL...>+# 说明:工作空间外文件默认复制;工作空间内文件会直接移动到 sources/+# PDF 转 Markdownpython3 tools/pdf_to_md.py <PDF文件>diff --git a/README_EN.md b/README_EN.mdindex 32490b8b..142bc5f2 100644--- a/README_EN.md+++ b/README_EN.md@@ -171,6 +171,8 @@ python3 tools/project_manager.py init <project_name> --format ppt169# Archive source materials into the project folderpython3 tools/project_manager.py import-sources <project_path> <source_file_or_url...>+# Note: files outside the workspace are copied by default; files already in the workspace are moved into sources/+# PDF to Markdownpython3 tools/pdf_to_md.py <PDF_file>diff --git a/tools/README.md b/tools/README.mdindex 8b6a780c..05efe703 100644--- a/tools/README.md+++ b/tools/README.md@@ -304,6 +304,11 @@ python3 tools/project_manager.py validate <project_path>python3 tools/project_manager.py info <project_path>```+说明:+- 工作空间外文件默认复制到 `sources/`+- 使用 `--move` 时,工作空间外文件改为移动到 `sources/`+- 如果文件已位于当前工作空间内,会直接移动到 `sources/`+**支持的画布格式**:- `ppt169` - PPT 16:9 (1280×720)diff --git a/tools/project_manager.py b/tools/project_manager.pyindex 6141f87d..5daa53ff 100644--- a/tools/project_manager.py+++ b/tools/project_manager.py@@ -70,6 +70,14 @@ def derive_url_basename(url: str) -> str:return "_".join(part for part in parts if part) or "web_source"+def is_within_path(path: Path, parent: Path) -> bool:+ try:+ path.resolve().relative_to(parent.resolve())+ return True+ except ValueError:+ return False++class ProjectManager:"""Create, inspect, validate, and populate project folders."""@@ -152,6 +160,12 @@ class ProjectManager:counter += 1def _copy_or_move_file(self, source: Path, destination: Path, move: bool) -> Path:+ try:+ if source.resolve() == destination.resolve():+ return destination+ except FileNotFoundError:+ pass+destination = self._ensure_unique_path(destination)if move:shutil.move(str(source), str(destination))@@ -262,10 +276,11 @@ class ProjectManager:summary["skipped"].append(f"{item}: directories are not supported")continue+ effective_move = move or is_within_path(source_path, REPO_ROOT)archived_path = self._copy_or_move_file(source_path,sources_dir / source_path.name,- move=move,+ move=effective_move,)summary["archived"].append(str(archived_path))