Files
AnyImage/docs/internals/operators/ai-setup.md
nan 32bcd45d7b Add new node asset scripts for geometry and shader operations
- Implemented `build_mesh_plane.py` to create a geometry node group for mesh planes with customizable parameters.
- Created `build_shadeless.py` for a shader node group that displays color without scene lighting while preserving shadows and reflections.
- Added `validate.py` to validate the integrity of the newly created node groups and their inputs.
- Introduced `validate_cutout.py` to ensure the functionality of cutout node groups and their dependencies.
- Developed `validate_mesh_plane.py` to test the mesh plane creation and its modifier settings.
2026-08-30 00:17:29 +08:00

1.7 KiB

AI 环境管理

本页对应 src/anyimage/operators/ai_setup.py。该模块把环境安装、必需模型下载和模型缓存清理组织成 Blender 可调用的 Operator。

对应文件

src/anyimage/
├── operators/ai_setup.py        # 环境与模型管理入口
├── preferences.py               # 环境位置和扩展级设置
├── properties.py                # 环境状态与模型目录
├── runtime.py                   # BlendJob Runtime 访问入口
└── server/
    ├── app.py                   # 下载 Job 注册
    ├── model_catalog.py         # 模型元数据
    ├── model_download.py        # 模型文件下载
    └── model_manager.py         # 模型资源与 Session 缓存

主流程

flowchart TD
    Entry["Set Up AI Environment"] --> Status["读取环境与必需模型状态"]
    Status --> Ready{"是否全部就绪?"}
    Ready -- "是" --> Done["结束"]
    Ready -- "否" --> Environment{"运行环境是否就绪?"}
    Environment -- "否" --> Install["安装隔离 Python 环境"]
    Environment -- "是" --> Download["下载缺失的必需模型"]
    Install --> Download
    Download --> Done

SetupAIEnvironment 是统一入口:首次使用时选择普通源或镜像安装隔离环境;环境已存在时,只补齐必需模型。单模型下载和必需模型批量下载都通过 Job Server 执行,因此状态、错误与进度沿用同一套 Runtime 通道。

OpenAIEnvironmentSettings 将用户带到扩展首选项。ClearModels 清除 Runtime 中的 model_manager 资源,使已加载的模型 Session 释放;它不负责删除磁盘上的模型文件。