# AI影视梦工厂 macOS 安装包构建说明

## 构建环境

- macOS 12+（Intel 或 Apple Silicon）
- Python 3.10+
- 已安装 Xcode Command Line Tools

## 依赖安装

```bash
cd /path/to/AIVideoEditer_client
pip install -r requirements.txt
pip install pyinstaller

# 可选：安装 create-dmg 以生成更美观的 DMG
brew install create-dmg
```

## 构建 DMG 安装包

1. 将项目源码解压到任意目录（例如 `~/AIVideoEditer_client`）。
2. 把下载的 `build_macos.command` 放到项目根目录（与 `build_macos.py` 同级）。
3. 双击运行 `build_macos.command`。

构建完成后，安装包位于：

```
installer/AI影视梦工厂.dmg
```

## 输出说明

- `.app` 为 macOS 应用程序包（构建中间产物，已打包进 DMG）
- `.dmg` 为最终分发镜像，用户双击挂载后将 `.app` 拖入「应用程序」文件夹即可安装

## 安全说明

构建脚本会自动清理 `generation_settings.json` 中的 API Key，确保分发的安装包内不含任何密钥。

使用者首次运行后，需在软件内配置自己的 API Key：

- 图片生成 API Key：**设置 → 生成通用设置**
- 音频 / TokenGet 网关 API Key：**账户 → 网关配置**

## 注意事项

1. 首次运行若提示「无法打开，因为无法验证开发者」，请前往：
   **系统设置 → 隐私与安全性 → 安全性** 中点击「仍要打开」。
2. 如使用 Apple Silicon（M1/M2/M3）构建，产物仅能在 Apple Silicon 上原生运行；
   如需兼容 Intel Mac，请在 Intel Mac 上构建，或启用 Rosetta 转译。
3. 图标文件：优先使用 `app_icon.icns`；若无该文件，脚本会自动回退到 `app_icon.ico`。
