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(config): unify env lookup for skill installs
hugohe3eee69c9b30bc
diff --git a/README.md b/README.mdindex 3e6e819b..512ae2c1 100644--- a/README.md+++ b/README.md@@ -232,7 +232,16 @@ The AI handles everything — content analysis, visual design, SVG generation, aTwo paths for non-user images, mixable per row in the same deck:-**A) AI generation** — `image_gen.py`. Copy `.env.example` to `.env`, set `IMAGE_BACKEND` plus the provider's `*_API_KEY` (`OPENAI_API_KEY`, `GEMINI_API_KEY`, etc.), and the pipeline calls it automatically. Run `python3 skills/ppt-master/scripts/image_gen.py --list-backends` for the full backend list. `gpt-image-2` is currently the best default.+For API-backed features, put credentials in `.env`. Clone installs can use `cp .env.example .env`; skill marketplace installs should use a persistent user config:++```bash+mkdir -p ~/.ppt-master+cp /path/to/installed/ppt-master/.env.example ~/.ppt-master/.env+```++PPT Master reads the current process environment first, then the first `.env` found in this order: current working directory, clone repo root, `~/.ppt-master/.env`.++**A) AI generation** — `image_gen.py`. Set `IMAGE_BACKEND` plus the provider's `*_API_KEY` (`OPENAI_API_KEY`, `GEMINI_API_KEY`, etc.), and the pipeline calls it automatically. Run `python3 skills/ppt-master/scripts/image_gen.py --list-backends` for the full backend list. `gpt-image-2` is currently the best default.**B) Web image search** — `image_search.py`. **Zero-config works**, but configure `PEXELS_API_KEY` / `PIXABAY_API_KEY` (both free) for higher-quality results. Without keys, search uses Openverse / Wikimedia Commons only; this is useful as a fallback, but image quality can be uneven because many results are ordinary user uploads. With keys, the default provider chain also appends Pexels / Pixabay, which materially improves modern stock photography, people, workplace, lifestyle, and illustration coverage. The default is quality-first: CC0, Public Domain, Pexels / Pixabay no-attribution licenses, CC BY, and CC BY-SA are considered together, and Executor adds a small inline credit whenever the selected image requires attribution. Use `--strict-no-attribution` only when a slide cannot tolerate any credit line. For high-impact covers, product shots, portraits, and branded scenes, prefer this order: user-provided high-resolution assets / AI generation > web search with Pexels / Pixabay keys > zero-config web search.diff --git a/README_CN.md b/README_CN.mdindex 599a894e..be485611 100644--- a/README_CN.md+++ b/README_CN.md@@ -236,7 +236,16 @@ AI 全程处理——内容分析、视觉设计、SVG 生成、PPTX 导出。非用户自带图片有两条路径,可在同一份 deck 里按行混用:-**A) AI 生图** — `image_gen.py`。`cp .env.example .env`,设置 `IMAGE_BACKEND` 和对应 `*_API_KEY`(`OPENAI_API_KEY`、`GEMINI_API_KEY` 等),流程会自动调用。`python3 skills/ppt-master/scripts/image_gen.py --list-backends` 查看完整后端清单。`gpt-image-2` 目前综合质量最佳。+需要 API 的功能统一通过 `.env` 配置。clone 安装可以用 `cp .env.example .env`;skill marketplace 安装建议使用持久的用户级配置:++```bash+mkdir -p ~/.ppt-master+cp /path/to/installed/ppt-master/.env.example ~/.ppt-master/.env+```++PPT Master 会优先读取当前进程环境变量,然后按顺序读取第一个存在的 `.env`:当前工作目录、clone 仓库根目录、`~/.ppt-master/.env`。++**A) AI 生图** — `image_gen.py`。设置 `IMAGE_BACKEND` 和对应 `*_API_KEY`(`OPENAI_API_KEY`、`GEMINI_API_KEY` 等),流程会自动调用。`python3 skills/ppt-master/scripts/image_gen.py --list-backends` 查看完整后端清单。`gpt-image-2` 目前综合质量最佳。**B) 网络图片搜索** — `image_search.py`。**零配置**可用,但高质量使用建议配置 `PEXELS_API_KEY` / `PIXABAY_API_KEY`(都免费申请)。不配置时只使用 Openverse / Wikimedia Commons,适合作为兜底,但容易出现普通用户上传、构图随意、清晰度不稳定的图片;配置后默认搜索链会追加 Pexels / Pixabay,现代商业摄影、人物、办公、生活方式和插画类图片质量会明显更稳定。默认以图片质量和匹配度优先,直接把 CC0、公有领域、Pexels / Pixabay 免署名许可、CC BY、CC BY-SA 一起纳入候选;如果选中的图片需要署名,Executor 会在该幻灯片自动添加小字署名。只有明确不能出现署名时,才使用 `--strict-no-attribution` 限制为免署名图片。对视觉要求高的封面、产品图、人物图和品牌场景,优先级建议是:用户自带高清素材 / AI 生图 > 配置 Pexels / Pixabay 的网络搜索 > 零配置网络搜索。diff --git a/skills/ppt-master/.env.example b/skills/ppt-master/.env.examplenew file mode 100644index 00000000..c282c483--- /dev/null+++ b/skills/ppt-master/.env.example@@ -0,0 +1,176 @@+# ─────────────────────────────────────────────────────────────+# Image Generation Configuration / 图片生成配置+# ─────────────────────────────────────────────────────────────++# This file is an optional fallback config source for image_gen.py.+# Current process environment variables take precedence over this file.+# 当前文件是 image_gen.py 的可选 fallback 配置来源。+# 当前进程环境变量优先于这个文件。+#+# Resolution order (only the FIRST existing file is read; keys are NOT merged across files):+# 1. ./.env in your current working directory+# 2. <repo-root>/.env (when running from a clone)+# 3. ~/.ppt-master/.env (user-level config)+# 查找顺序(只读第一个存在的文件,多个 .env 之间不合并):+# 1. 当前工作目录下的 ./.env+# 2. 仓库根目录下的 .env(仅在 clone 模式下)+# 3. ~/.ppt-master/.env(用户级配置)++# Active backend (required) / 当前启用后端(必需)+# Recommended core backends: openai / gemini / qwen / zhipu / volcengine+# 推荐核心后端:openai / gemini / qwen / zhipu / volcengine+# IMAGE_BACKEND=openai++# You may also provide the same variables directly via the current process environment.+# 也可以不写 .env,而是直接通过当前运行进程的环境变量提供同样的配置。++# IMPORTANT:+# - IMAGE_API_KEY / IMAGE_MODEL / IMAGE_BASE_URL are no longer supported.+# - Use provider-specific keys only.+# 重要:+# - 不再支持 IMAGE_API_KEY / IMAGE_MODEL / IMAGE_BASE_URL。+# - 请只使用各提供商自己的变量。++# ─────────────────────────────────────────────────────────────+# Example: OpenAI / OpenAI 示例 (recommended / 推荐)+# ─────────────────────────────────────────────────────────────+# IMAGE_BACKEND=openai+# OPENAI_API_KEY=sk-xxx+# OPENAI_MODEL=gpt-image-2+# OPENAI_BASE_URL=http://127.0.0.1:3000/v1++# ─────────────────────────────────────────────────────────────+# Example: Gemini / Gemini 示例+# ─────────────────────────────────────────────────────────────+# IMAGE_BACKEND=gemini+# GEMINI_API_KEY=your-gemini-api-key+# GEMINI_MODEL=gemini-3.1-flash-image-preview+# GEMINI_BASE_URL=https://your-proxy-url.com++# ─────────────────────────────────────────────────────────────+# Example: MiniMax / MiniMax 示例+# ─────────────────────────────────────────────────────────────+# IMAGE_BACKEND=minimax+# MINIMAX_API_KEY=your-minimax-key+# MINIMAX_MODEL=image-01+# MINIMAX_BASE_URL=https://api.minimaxi.com/v1/image_generation # Default China endpoint / 默认国内地址+# MINIMAX_BASE_URL=https://api.minimax.io/v1/image_generation # Optional overseas endpoint / 可选海外地址++# ─────────────────────────────────────────────────────────────+# Example: Qwen / 通义生图示例+# ─────────────────────────────────────────────────────────────+# IMAGE_BACKEND=qwen+# QWEN_API_KEY=your-dashscope-key+# QWEN_MODEL=qwen-image-2.0-pro+# QWEN_BASE_URL=https://dashscope.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis++# ─────────────────────────────────────────────────────────────+# Example: Zhipu / 智谱生图示例+# ─────────────────────────────────────────────────────────────+# IMAGE_BACKEND=zhipu+# ZHIPU_API_KEY=your-zhipu-key+# ZHIPU_MODEL=glm-image+# ZHIPU_BASE_URL=https://open.bigmodel.cn/api/paas/v4/images/generations++# ─────────────────────────────────────────────────────────────+# Example: Volcengine / 火山引擎示例+# ─────────────────────────────────────────────────────────────+# IMAGE_BACKEND=volcengine+# VOLCENGINE_API_KEY=your-volcengine-key+# VOLCENGINE_MODEL=doubao-seedream-4-5-251128+# VOLCENGINE_BASE_URL=https://operator.las.cn-beijing.volces.com/api/v1/images/generations++# ─────────────────────────────────────────────────────────────+# Extended / Experimental backends+# 扩展 / 实验后端+# ─────────────────────────────────────────────────────────────+# STABILITY_API_KEY=your-stability-key+# STABILITY_MODEL=stable-image-core+# STABILITY_BASE_URL=https://api.stability.ai+#+# BFL_API_KEY=your-bfl-key+# BFL_MODEL=flux-pro-1.1-ultra+# BFL_BASE_URL=https://api.bfl.ai+#+# IDEOGRAM_API_KEY=your-ideogram-key+# IDEOGRAM_MODEL=ideogram-v3+# IDEOGRAM_BASE_URL=https://api.ideogram.ai+#+# MINIMAX_API_KEY=your-minimax-key+# MINIMAX_MODEL=image-01+# MINIMAX_BASE_URL=https://api.minimaxi.com/v1/image_generation # Default China endpoint / 默认国内地址+# MINIMAX_BASE_URL=https://api.minimax.io/v1/image_generation # Optional overseas endpoint / 可选海外地址+#+# SILICONFLOW_API_KEY=your-siliconflow-key+# SILICONFLOW_MODEL=Qwen/Qwen-Image+# SILICONFLOW_BASE_URL=https://api.siliconflow.cn/v1/images/generations+#+# FAL_KEY=your-fal-key+# FAL_MODEL=fal-ai/imagen3/fast+# FAL_BASE_URL=https://fal.run+#+# REPLICATE_API_TOKEN=r8_xxx+# REPLICATE_MODEL=black-forest-labs/flux-1.1-pro+# REPLICATE_BASE_URL=https://api.replicate.com/v1/predictions+#+# OPENROUTER_API_KEY=sk-or-v1-xxx+# OPENROUTER_MODEL=google/gemini-3.1-flash-image-preview+# OPENROUTER_BASE_URL=https://openrouter.ai/api/v1+#+# IMAGE_BACKEND=modelscope+# MODELSCOPE_API_KEY=your-modelscope-key+# MODELSCOPE_MODEL=Tongyi-MAI/Z-Image-Turbo+# MODELSCOPE_BASE_URL=https://api-inference.modelscope.cn/v1++# ─────────────────────────────────────────────────────────────+# Multi-provider example / 多提供商共存示例+# ─────────────────────────────────────────────────────────────+# IMAGE_BACKEND=openai+# OPENAI_API_KEY=sk-xxx+# OPENAI_MODEL=gpt-image-2+# GEMINI_API_KEY=your-gemini-api-key+# GEMINI_MODEL=gemini-3.1-flash-image-preview+#+# Switch providers by changing IMAGE_BACKEND only.+# 切换提供商时,只改 IMAGE_BACKEND 即可。++# ─────────────────────────────────────────────────────────────+# Audio narration TTS (notes_to_audio.py) / 旁白音频 TTS+# ─────────────────────────────────────────────────────────────+# edge-tts is the default narration backend and needs no API key.+# Use cloud providers only when you want high-quality or cloned voices —+# all four (ElevenLabs / MiniMax / Qwen / CosyVoice) accept a cloned voice_id.+# Clone the voice in the provider's console first, then pass --voice-id to+# notes_to_audio.py. See docs/audio-narration.md "Use a cloned voice".+# edge-tts 是默认旁白后端,无需 API Key。+# 需要高质量云端旁白或复刻音色时再配置云端提供商——+# ElevenLabs / MiniMax / Qwen / CosyVoice 四家都支持传入复刻 voice_id。+# 先在 provider 控制台复刻得到 voice_id,再用 --voice-id 传给 notes_to_audio.py。+# 详见 docs/zh/audio-narration.md "使用复刻音色"。+#+# ELEVENLABS_API_KEY=your-elevenlabs-api-key+# MINIMAX_API_KEY=your-minimax-key+# QWEN_API_KEY=your-dashscope-key+# COSYVOICE_API_KEY=your-dashscope-key+# DASHSCOPE_API_KEY=your-dashscope-key+#+# Optional provider-specific TTS endpoint overrides.+# 可选:按提供商覆盖 TTS 接入点。+# MINIMAX_TTS_BASE_URL=https://api.minimaxi.com/v1/t2a_v2 # Default China endpoint / 默认国内地址+# MINIMAX_TTS_BASE_URL=https://api.minimax.io/v1/t2a_v2 # Optional overseas endpoint / 可选海外地址+# QWEN_TTS_BASE_URL=https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation+# COSYVOICE_TTS_BASE_URL=https://dashscope.aliyuncs.com/api/v1/services/audio/tts/SpeechSynthesizer++# ─────────────────────────────────────────────────────────────+# Web image search (image_search.py) / 网络图片搜索+# ─────────────────────────────────────────────────────────────+# Used by scripts/image_search.py — separate from IMAGE_BACKEND above.+# image_search.py 用,与上面的 IMAGE_BACKEND 互不影响。+#+# Openverse and Wikimedia work with no key, but image quality can be uneven.+# For polished stock-style PPT images, configure Pexels and/or Pixabay.+# Openverse 和 Wikimedia 无需 Key,但图片质量不稳定。+# 如需更稳定的商业图库风格 PPT 配图,建议配置 Pexels 和/或 Pixabay。+#+# PEXELS_API_KEY=your-pexels-key # signup: https://www.pexels.com/api/+# PIXABAY_API_KEY=your-pixabay-key # signup: https://pixabay.com/api/docs/diff --git a/skills/ppt-master/references/image-generator.md b/skills/ppt-master/references/image-generator.mdindex 8531d162..fc2402c6 100644--- a/skills/ppt-master/references/image-generator.md+++ b/skills/ppt-master/references/image-generator.md@@ -242,7 +242,7 @@ python3 scripts/image_gen.py "your prompt" \**Configuration sources**:- Current process environment variables-- Project-root `.env` as fallback+- First `.env` found in this order: current working directory, clone repo root, `~/.ppt-master/.env`Precedence:- Current process environment wins@@ -255,7 +255,7 @@ Precedence:| `{PROVIDER}_BASE_URL` | Optional | Provider-specific custom endpoint || `{PROVIDER}_MODEL` | Optional | Provider-specific model override |-> Use provider-specific names only (e.g. `GEMINI_API_KEY`, `OPENAI_API_KEY`). See `.env.example` for the full set per backend.+> Use provider-specific names only (e.g. `GEMINI_API_KEY`, `OPENAI_API_KEY`). See `.env.example` in clone mode or `${SKILL_DIR}/.env.example` in skill-install mode for the full set per backend.> `IMAGE_API_KEY`, `IMAGE_MODEL`, and `IMAGE_BASE_URL` are intentionally unsupported.diff --git a/skills/ppt-master/scripts/config.py b/skills/ppt-master/scripts/config.pyindex c7418c7b..8f24af62 100644--- a/skills/ppt-master/scripts/config.py+++ b/skills/ppt-master/scripts/config.py@@ -17,6 +17,7 @@ Usage:from pathlib import Pathfrom typing import Dict, List, Optional, Anyimport json+import os# ============================================================@@ -41,6 +42,92 @@ PROJECTS_DIR = REPO_ROOT / 'projects'CHART_TEMPLATES_DIR = TEMPLATES_DIR / 'charts'+# ============================================================+# Environment Configuration+# ============================================================++USER_CONFIG_DIR = Path.home() / '.ppt-master'+USER_ENV_FILE = USER_CONFIG_DIR / '.env'+++def get_env_candidates() -> list[Path]:+ """Return the supported .env lookup order."""+ return [+ Path.cwd() / '.env',+ REPO_ROOT / '.env',+ USER_ENV_FILE,+ ]+++def resolve_env_path() -> Path:+ """+ Return the first existing .env path.++ If no candidate exists, return the CWD .env path so callers can no-op+ consistently while still showing a useful default location in messages.+ """+ candidates = get_env_candidates()+ for candidate in candidates:+ if candidate.exists():+ return candidate+ return candidates[0]+++def strip_env_quotes(value: str) -> str:+ """Strip matching surrounding quotes from a .env value."""+ if len(value) >= 2 and value[0] == value[-1] and value[0] in ("'", '"'):+ return value[1:-1]+ return value+++def load_prefixed_env_file(+ prefixes: tuple[str, ...],+ *,+ deprecated_keys: Optional[dict[str, str]] = None,+) -> Optional[Path]:+ """+ Load matching keys from the first supported .env file.++ Existing process environment variables always win. Keys outside the+ requested prefixes are ignored so one shared .env can hold image, search,+ and narration credentials without leaking unrelated values into the+ process.+ """+ env_path = resolve_env_path()+ if not env_path.exists():+ return None++ deprecated_keys = deprecated_keys or {}+ with env_path.open('r', encoding='utf-8') as fh:+ for lineno, raw_line in enumerate(fh, start=1):+ line = raw_line.strip()+ if not line or line.startswith('#'):+ continue+ if line.startswith('export '):+ line = line[7:].lstrip()+ if '=' not in line:+ raise ValueError(+ f"Invalid line in {env_path}:{lineno}. Expected KEY=VALUE."+ )++ key, value = line.split('=', 1)+ key = key.strip()+ if not key:+ raise ValueError(+ f"Invalid line in {env_path}:{lineno}. Missing variable name."+ )+ if not any(key.startswith(prefix) for prefix in prefixes):+ continue+ if key in deprecated_keys:+ raise ValueError(+ f"Unsupported key in {env_path}:{lineno}: {key}\n"+ f"{deprecated_keys[key]}"+ )+ os.environ.setdefault(key, strip_env_quotes(value.strip()))++ return env_path++# ============================================================# Canvas Format Configuration# ============================================================diff --git a/skills/ppt-master/scripts/docs/image.md b/skills/ppt-master/scripts/docs/image.mdindex 728ec2cf..0bdfcff4 100644--- a/skills/ppt-master/scripts/docs/image.md+++ b/skills/ppt-master/scripts/docs/image.md@@ -31,7 +31,10 @@ python3 scripts/image_gen.py "A product KV in cinematic style" --backend volcengConfiguration sources:1. Current process environment variables-2. Repo-root `.env` as a fallback+2. First `.env` found in this order:+ - Current working directory+ - Clone repo root+ - `~/.ppt-master/.env`The active backend must always be selected explicitly via `IMAGE_BACKEND`.@@ -54,7 +57,7 @@ export OPENAI_MODEL=gpt-image-2Current process environment wins over `.env`.-Use provider-specific keys only (e.g. `GEMINI_API_KEY`, `OPENAI_API_KEY`). See `.env.example` for the full list per backend.+Use provider-specific keys only (e.g. `GEMINI_API_KEY`, `OPENAI_API_KEY`). See `.env.example` in clone mode or `${SKILL_DIR}/.env.example` in skill-install mode for the full list per backend.`IMAGE_API_KEY`, `IMAGE_MODEL`, and `IMAGE_BASE_URL` are intentionally unsupported.@@ -107,6 +110,8 @@ Providers (Openverse and Wikimedia work with no key; configure Pexels / PixabayDefault search chain (when `--provider` is unset): zero-config providers first, then keyed providers whose API key is set in the environment. Keyed providers without a key are silently skipped. For polished visual decks, configure at least one keyed provider.+`image_search.py` uses the same `.env` lookup order as `image_gen.py`, so skill installs can keep `PEXELS_API_KEY` / `PIXABAY_API_KEY` in `~/.ppt-master/.env`.+Query guidance:| Case | Pattern |diff --git a/skills/ppt-master/scripts/image_gen.py b/skills/ppt-master/scripts/image_gen.pyindex 723b7233..3eccb983 100644--- a/skills/ppt-master/scripts/image_gen.py+++ b/skills/ppt-master/scripts/image_gen.py@@ -44,27 +44,10 @@ Usage:import osimport sysimport argparse-from pathlib import Path-def _resolve_env_path() -> Path:- """- Locate a `.env` file across the deploy modes PPT Master supports.+from config import load_prefixed_env_file, resolve_env_path- Returns the first existing candidate; if none exist, returns the CWD path- (used purely as a non-existent fallback so `_load_image_env_file` no-ops).- """- candidates = [- Path.cwd() / ".env", # working directory (skill mode)- Path(__file__).resolve().parents[3] / ".env", # repo root (clone mode)- Path.home() / ".ppt-master" / ".env", # user-level config- ]- for candidate in candidates:- if candidate.exists():- return candidate- return candidates[0]---ENV_PATH = _resolve_env_path()+ENV_PATH = resolve_env_path()IMAGE_ENV_PREFIXES = ("IMAGE_","GEMINI_",@@ -217,64 +200,25 @@ TIER_ORDER = {"core": 0, "extended": 1, "experimental": 2}SUPPORTED_BACKENDS = tuple(sorted(BACKEND_REGISTRY))-def _is_image_env_key(name: str) -> bool:- """Return whether an env var name belongs to image generation config."""- return name.startswith(IMAGE_ENV_PREFIXES)---def _strip_env_quotes(value: str) -> str:- """Strip matching surrounding quotes from a `.env` value."""- if len(value) >= 2 and value[0] == value[-1] and value[0] in ("'", '"'):- return value[1:-1]- return value--def _load_image_env_file() -> None:"""Load image generation config from the resolved `.env` as a fallback layer.Existing process environment variables win over `.env`."""- if not ENV_PATH.exists():- return-- with ENV_PATH.open("r", encoding="utf-8") as fh:- for lineno, raw_line in enumerate(fh, start=1):- line = raw_line.strip()- if not line or line.startswith("#"):- continue-- if line.startswith("export "):- line = line[7:].lstrip()-- if "=" not in line:- raise ValueError(- f"Invalid line in {ENV_PATH}:{lineno}. Expected KEY=VALUE."- )-- key, value = line.split("=", 1)- key = key.strip()- if not key:- raise ValueError(- f"Invalid line in {ENV_PATH}:{lineno}. Missing variable name."- )-- if not _is_image_env_key(key):- continue-- if key in DEPRECATED_IMAGE_KEYS:- replacement = {- "IMAGE_API_KEY": "GEMINI_API_KEY / OPENAI_API_KEY / QWEN_API_KEY / ZHIPU_API_KEY / ...",- "IMAGE_MODEL": "GEMINI_MODEL / OPENAI_MODEL / QWEN_MODEL / ZHIPU_MODEL / ...",- "IMAGE_BASE_URL": "GEMINI_BASE_URL / OPENAI_BASE_URL / QWEN_BASE_URL / ZHIPU_BASE_URL / ...",- }[key]- raise ValueError(- f"Unsupported key in {ENV_PATH}:{lineno}: {key}\n"- "Global image config keys have been removed.\n"- f"Use IMAGE_BACKEND plus provider-specific keys instead, such as {replacement}."- )-- os.environ.setdefault(key, _strip_env_quotes(value.strip()))+ replacements = {+ "IMAGE_API_KEY": "GEMINI_API_KEY / OPENAI_API_KEY / QWEN_API_KEY / ZHIPU_API_KEY / ...",+ "IMAGE_MODEL": "GEMINI_MODEL / OPENAI_MODEL / QWEN_MODEL / ZHIPU_MODEL / ...",+ "IMAGE_BASE_URL": "GEMINI_BASE_URL / OPENAI_BASE_URL / QWEN_BASE_URL / ZHIPU_BASE_URL / ...",+ }+ deprecated_messages = {+ key: (+ "Global image config keys have been removed.\n"+ f"Use IMAGE_BACKEND plus provider-specific keys instead, such as {replacement}."+ )+ for key, replacement in replacements.items()+ }+ load_prefixed_env_file(IMAGE_ENV_PREFIXES, deprecated_keys=deprecated_messages)def _validate_runtime_config() -> None:diff --git a/skills/ppt-master/scripts/image_search.py b/skills/ppt-master/scripts/image_search.pyindex 7bc07e1e..8e07f395 100644--- a/skills/ppt-master/scripts/image_search.py+++ b/skills/ppt-master/scripts/image_search.py@@ -54,6 +54,7 @@ _SCRIPTS_DIR = Path(__file__).resolve().parentif str(_SCRIPTS_DIR) not in sys.path:sys.path.insert(0, str(_SCRIPTS_DIR))+from config import load_prefixed_env_file # noqa: E402from image_backends.backend_common import download_image # noqa: E402from image_sources.provider_common import ( # noqa: E402AssetCandidate,@@ -86,23 +87,13 @@ ORIENTATION_CHOICES = ("any", "landscape", "portrait", "square")# ----------------------------------------------------------------------------# .env loading (lightweight; matches image_gen.py behavior)+# .env loading# ----------------------------------------------------------------------------def _load_dotenv_if_available() -> None:- """Best-effort .env loading: cwd then repo root. Silently no-op if- python-dotenv isn't installed or no file is found."""- try:- from dotenv import load_dotenv # type: ignore- except ImportError:- return- cwd_env = Path.cwd() / ".env"- if cwd_env.is_file():- load_dotenv(cwd_env, override=False)- repo_env = _SCRIPTS_DIR.parent.parent.parent / ".env"- if repo_env.is_file():- load_dotenv(repo_env, override=False)+def _load_search_env_file() -> None:+ """Load image-search keys from the shared PPT Master .env locations."""+ load_prefixed_env_file(("PEXELS_", "PIXABAY_"))# ---------------------------------------------------------------------------@@ -651,7 +642,7 @@ def _default_provider_chain() -> list[str]:def main(argv: Optional[list[str]] = None) -> int:- _load_dotenv_if_available()+ _load_search_env_file()parser = build_parser()args = parser.parse_args(argv)diff --git a/skills/ppt-master/scripts/notes_to_audio.py b/skills/ppt-master/scripts/notes_to_audio.pyindex 6d06f478..c277f16a 100644--- a/skills/ppt-master/scripts/notes_to_audio.py+++ b/skills/ppt-master/scripts/notes_to_audio.py@@ -30,6 +30,7 @@ import sysfrom dataclasses import dataclassfrom pathlib import Path+from config import load_prefixed_env_filefrom tts_backends import (backend_cosyvoice,backend_edge,@@ -47,42 +48,15 @@ class AudioBackend:voice_id: str = ""-def _resolve_env_path() -> Path:- candidates = [- Path.cwd() / ".env",- Path(__file__).resolve().parents[3] / ".env",- Path.home() / ".ppt-master" / ".env",- ]- for candidate in candidates:- if candidate.exists():- return candidate- return candidates[0]--def _load_tts_env_file() -> None:"""Load TTS-related keys from the first .env file, without overriding shell env."""- env_path = _resolve_env_path()- if not env_path.exists():- return-- prefixes = (+ load_prefixed_env_file(("ELEVENLABS_","MINIMAX_","QWEN_","DASHSCOPE_","COSYVOICE_",- )- for raw in env_path.read_text(encoding="utf-8").splitlines():- line = raw.strip()- if not line or line.startswith("#") or "=" not in line:- continue- key, value = line.split("=", 1)- key = key.strip()- if not any(key.startswith(prefix) for prefix in prefixes):- continue- if key in os.environ:- continue- os.environ[key] = value.strip().strip("\"'")+ ))def spoken_text(markdown: str) -> str:diff --git a/skills/ppt-master/workflows/generate-audio.md b/skills/ppt-master/workflows/generate-audio.mdindex 04257ce2..b8877762 100644--- a/skills/ppt-master/workflows/generate-audio.md+++ b/skills/ppt-master/workflows/generate-audio.md@@ -17,6 +17,7 @@ This workflow is **independent**: it reads `notes/*.md` and queries the selected- MiniMax: `MINIMAX_API_KEY`- Qwen: `QWEN_API_KEY` or `DASHSCOPE_API_KEY`- CosyVoice: `COSYVOICE_API_KEY` or `DASHSCOPE_API_KEY`+ - Keys may live in the current process environment or the first `.env` found in this order: current working directory, clone repo root, `~/.ppt-master/.env`- The deck is in a single dominant language (mixed-language decks: pick the dominant one — the AI uses judgment, not a heuristic).If `notes/*.md` are missing, run `total_md_split.py <project_path>` first.