Skip to content

Commit 819890b

Browse files
authored
Add workflow template section (#350)
* Add workflow template section * Fix link * Add missing models screenshot * Add save location
1 parent f1b1bd2 commit 819890b

File tree

6 files changed

+292
-0
lines changed

6 files changed

+292
-0
lines changed

docs.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"pages": [
6464
"interface/overview",
6565
"interface/maskeditor",
66+
"interface/features/template",
6667
"interface/features/subgraph",
6768
"interface/features/partial-execution",
6869
{
@@ -609,6 +610,7 @@
609610
"pages": [
610611
"zh-CN/interface/overview",
611612
"zh-CN/interface/maskeditor",
613+
"zh-CN/interface/features/template",
612614
"zh-CN/interface/features/subgraph",
613615
"zh-CN/interface/features/partial-execution",
614616
{
129 KB
Loading
236 KB
Loading
56.4 KB
Loading

interface/features/template.mdx

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
---
2+
title: "Templates - ComfyUI Built-in Workflow Templates"
3+
description: "Templates provide model workflows natively supported by ComfyUI and example workflows from custom nodes. You can find and use workflows for currently supported models here."
4+
sidebarTitle: "Workflow Templates"
5+
icon: "clone"
6+
---
7+
8+
Workflow Templates is the browser for ComfyUI's natively supported model workflows and also some example workflows from custom nodes.
9+
10+
In ComfyUI’s Workflow Templates, you can find:
11+
12+
- Natively supported model workflows
13+
- Example workflows from custom nodes
14+
15+
![Template](/images/interface/features/template/template-dialog.jpg)
16+
17+
## How to open Templates in ComfyUI
18+
19+
Open via the menu `Workflow` --> `Browse Workflow Templates`.
20+
![Template](/images/interface/features/template/template.jpg)
21+
22+
## How to use templates
23+
24+
1. Load a template: Click any template you want to load its workflow.
25+
2. Download models: When loading a template, ComfyUI automatically checks whether all required model files exist. If anything is missing, it will prompt you to download the models.
26+
3. Run the workflow: Once all requirements—such as models, input images, and prompts—are ready, click the Run button to start using the workflow.
27+
28+
### Model storage location
29+
30+
Each workflow template embeds links to the required models. On first use, if the corresponding model files are not detected, you will see a download prompt.
31+
32+
![Missing Models](/images/interface/features/template/missing_models.jpg)
33+
34+
1. For desktop version, when you click the `Download` button, the desktop program will automatically download the model files for you.
35+
2. For other versions, the browser will be used to download the corresponding model. You need to download the model and save it to the corresponding folder under `ComfyUI/models`. For example, the model in the screenshot should be saved in the following location:
36+
37+
```
38+
📂 ComfyUI/
39+
├── 📂 models/
40+
│ ├── 📂 diffusion_models/
41+
│ │ └── qwen_image_fp8_e4m3fn.safetensors
42+
│ ├── 📂 vae/
43+
│ │ └── qwen_image_vae.safetensors
44+
│ └── 📂 text_encoders/
45+
│ └── qwen_2.5_vl_7b_fp8_scaled.safetensors
46+
```
47+
48+
In the current version, missing-file detection only checks whether there is a file with the same name in the corresponding top-level directory. For example, the file must exist directly under `ComfyUI/models/diffusion_models`.
49+
If you have already downloaded the model into a subfolder such as `ComfyUI/models/diffusion_models/wan_video`, you can ignore the popup and simply ensure the correct model is selected in the corresponding model loader node.
50+
51+
If you're curious how model links are embedded, we add a `models` field under the node’s `properties`. Below is a complete snippet of a `DualCLIPLoader` node with embedded model information:
52+
```json
53+
{
54+
"id": 40,
55+
"type": "DualCLIPLoader",
56+
"pos": [
57+
-320,
58+
290
59+
],
60+
"size": [
61+
270,
62+
130
63+
],
64+
"flags": {},
65+
"order": 0,
66+
"mode": 0,
67+
"inputs": [],
68+
"outputs": [
69+
{
70+
"name": "CLIP",
71+
"type": "CLIP",
72+
"links": [
73+
64
74+
]
75+
}
76+
],
77+
"properties": {
78+
"Node name for S&R": "DualCLIPLoader",
79+
"cnr_id": "comfy-core",
80+
"ver": "0.3.40",
81+
"models": [
82+
{
83+
"name": "clip_l.safetensors",
84+
"url": "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors",
85+
"directory": "text_encoders"
86+
},
87+
{
88+
"name": "t5xxl_fp16.safetensors",
89+
"url": "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp16.safetensors",
90+
"directory": "text_encoders"
91+
}
92+
]
93+
},
94+
"widgets_values": [
95+
"clip_l.safetensors",
96+
"t5xxl_fp16.safetensors",
97+
"flux",
98+
"default"
99+
]
100+
}
101+
```
102+
103+
The `models` field inside `properties` includes `name`, `url`, and `directory`.
104+
105+
- `name`: the model file name
106+
- `url`: a direct download link to the file (not a repository page)
107+
- `directory`: which subfolder under `ComfyUI/models` to store the file, e.g. `vae` means `ComfyUI/models/vae`
108+
109+
Currently, only links from Hugging Face and Civitai are supported. The model format must be a safe format such as `.safetensors` or `.sft`. Formats like `.gguf` are considered unsafe; when embedded they will be flagged as unsafe and the link will not be shown.
110+
111+
You can use [this tool](https://comfyui-wiki.github.io/ComfyUI-Workflow-JSON-Editor/) to edit the model information in workflow templates. At the moment, [@ComfyUI-Wiki](https://github.com/ComfyUI-Wiki) only adds support for native nodes.
112+
113+
## How to update templates?
114+
115+
Templates are managed and updated as a separate dependency: [`comfyui-workflow-templates`](https://pypi.org/project/comfyui-workflow-templates/).
116+
117+
If, after updating ComfyUI, you don’t see the documentation or newly announced templates, you may need to update the corresponding dependency. You can check versions in [`ComfyUI/requirements.txt`](https://github.com/comfyanonymous/ComfyUI/blob/master/requirements.txt).
118+
119+
Typically, the following three dependencies may be upgraded together when ComfyUI is updated:
120+
121+
```
122+
comfyui-frontend-package==1.24.4
123+
comfyui-workflow-templates==0.1.52
124+
comfyui-embedded-docs==0.2.4
125+
```
126+
127+
If you’re not sure how to update correctly, see [Update ComfyUI](/installation/update_comfyui) for how to update ComfyUI and its dependencies.
128+
129+
## How to contribute templates to the ComfyUI repository?
130+
131+
All templates are hosted in the [workflow_templates](https://github.com/Comfy-Org/workflow_templates/) repository. You can contribute templates by submitting a PR. For official templates, we require the following:
132+
133+
1. Do not use any third-party nodes (to avoid extra installations for users who lack those nodes).
134+
2. The template must not duplicate existing ones and should target supported model capabilities.
135+
3. You may open an issue in the repository to ask questions.
136+
137+
## Custom node templates
138+
139+
If a custom node author provides templates and example workflows, you can also find them in the Templates browser. Usually, you can locate all templates by finding the category named after the node.
140+
141+
If you are a custom node author, note that we currently only support a single directory level under the `templates` folder (no nested subdirectories), and only JSON-format templates are supported.
142+
143+
## How to add templates for custom nodes?
144+
145+
See [Custom Node Templates](/custom-nodes/workflow_templates) for how to add workflow templates for your custom nodes.
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
---
2+
title: "工作流模板 - ComfyUI 内置工作流模板"
3+
description: "模板中提供了 ComfyUI 原生支持的模型工作流以及自定义节点提供的示例工作流,你可以在模板中找到目前已被支持的相关模型的工作流并进行使用"
4+
sidebarTitle: "工作流模板"
5+
icon: "clone"
6+
---
7+
8+
工作流模板是 ComfyUI 中原生支持的模型工作流及自定义节点提供的模型工作流的浏览窗口。
9+
10+
在 ComfyUI 的工作流模板功能中,你可以找到以下内容:
11+
12+
- 原生支持的模型工作流
13+
- 自定义节点提供的示例工作流
14+
15+
![Template](/images/interface/features/template/template-dialog.jpg)
16+
17+
## 如何打开 ComfyUI 的模板
18+
19+
通过菜单 `工作流` --> `浏览工作流模板` 即可打开工作流模板
20+
![Template](/images/interface/features/template/template.jpg)
21+
22+
## 如何使用模板
23+
24+
1. 加载模板: 点击你需要使用的任意模板以加载对应的模板工作流
25+
2. 下载模型: 在加载模板时,ComfyUI 会自动检查模型文件是否存在,如果模型文件不完整,则会提示你下载模型
26+
3. 使用工作流: 确定工作流的需要的各种要素如模型、输入图片、提示词等是完整的,即可点击运行按钮开始使用工作流
27+
28+
### 模型保存位置
29+
30+
每个工作流模板都嵌入了对应的模型链接,在首次使用时如果没有检测到对应的模型文件,则会提示下载信息
31+
32+
![Missing Models](/images/interface/features/template/missing_models.jpg)
33+
34+
1. 对于桌面版,当你点击`下载`按钮后, 桌面程序会自动为你完成模型文件的下载
35+
2. 其它版本则会通过浏览器下载对应模型,你需要下载后将对应的模型保存到 `ComfyUI/models` 对应的文件夹,比如截图中对应的模型应保存的位置为:
36+
37+
```
38+
📂 ComfyUI/
39+
├── 📂 models/
40+
│ ├── 📂 diffusion_models/
41+
│ │ └── qwen_image_fp8_e4m3fn.safetensors
42+
│ ├── 📂 vae/
43+
│ │ └── qwen_image_vae.safetensors
44+
│ └── 📂 text_encoders/
45+
│ └── qwen_2.5_vl_7b_fp8_scaled.safetensors
46+
```
47+
48+
在目前版本中,模板的缺失文件检测仅支持检测模型是否在对应的一级目录下是否有同名文件,也就是文件需要在 `ComfyUI/models/diffusion_models` 下存在,
49+
如果你已经下载好了模型并存放在类似:`ComfyUI/models/diffusion_models/wan_video` 的子文件夹,那么你可以忽略弹窗提示,在对应的模型加载节点确保对应的模型被加载选择即可。
50+
51+
如果你好奇我们是如何做到嵌入模型链接的,我们在对应节点的 `properties` 中添加了 `models` 信息, 下面是嵌入了模型信息的 `DualCLIPLoader` 节点的完整片段:
52+
```json
53+
{
54+
"id": 40,
55+
"type": "DualCLIPLoader",
56+
"pos": [
57+
-320,
58+
290
59+
],
60+
"size": [
61+
270,
62+
130
63+
],
64+
"flags": {},
65+
"order": 0,
66+
"mode": 0,
67+
"inputs": [],
68+
"outputs": [
69+
{
70+
"name": "CLIP",
71+
"type": "CLIP",
72+
"links": [
73+
64
74+
]
75+
}
76+
],
77+
"properties": {
78+
"Node name for S&R": "DualCLIPLoader",
79+
"cnr_id": "comfy-core",
80+
"ver": "0.3.40",
81+
"models": [
82+
{
83+
"name": "clip_l.safetensors",
84+
"url": "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors",
85+
"directory": "text_encoders"
86+
},
87+
{
88+
"name": "t5xxl_fp16.safetensors",
89+
"url": "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp16.safetensors",
90+
"directory": "text_encoders"
91+
}
92+
]
93+
},
94+
"widgets_values": [
95+
"clip_l.safetensors",
96+
"t5xxl_fp16.safetensors",
97+
"flux",
98+
"default"
99+
]
100+
}
101+
```
102+
103+
`properties` 中新增了 `models`, 对应的模型信息包含了对应的 `name``url` 以及 `directory` 信息。
104+
105+
- `name` 对应了模型文件的名称
106+
- `url` 对应了模型文件的下载链接(可直接下载的文件链接,而不是仓库地址)
107+
- `directory` 对应了模型文件的下载后应存储到的 ComfyUI/models 目录下的哪个子目录, 如 `vae` 则对应 `ComfyUI/models/vae` 目录
108+
109+
目前模型链接仅支持 huggingface 和 civitai 来源的链接,并且要求模型格式为安全的模型格式如 `.safetensors`, `.sft` 格式等,类似 `.gguf`, 不安全格式在嵌入后会提示不安全并不显示链接
110+
111+
你可以使用[这个工具](https://comfyui-wiki.github.io/ComfyUI-Workflow-JSON-Editor/)来编辑工作流模板中的模型信息,但目前 [@ComfyUI-Wiki](https://github.com/ComfyUI-Wiki) 仅对原生的节点增加了支持。
112+
113+
## 如何更新模板?
114+
115+
目前模板是通过一个单独依赖的形式进行管理和更新的,对应的地址为:[comfyui-workflow-templates](https://pypi.org/project/comfyui-workflow-templates/)
116+
117+
如果你在更新 ComfyUI 后发现没有文档或者我们的更新说明中新增的模板,那么可能是你没有在更新 ComfyUI 之后更新对应的依赖, 你可以访问 [ComfyUI/requirements.txt](https://github.com/comfyanonymous/ComfyUI/blob/master/requirements.txt) 来查看对应的依赖版本
118+
119+
通常下面的三个依赖是每次更新 ComfyUI 时我们也可能会同时升级的
120+
121+
```
122+
comfyui-frontend-package==1.24.4
123+
comfyui-workflow-templates==0.1.52
124+
comfyui-embedded-docs==0.2.4
125+
```
126+
127+
如果你不了解如何正确更新,请参考 [更新 ComfyUI](/zh-CN/installation/update_comfyui) 章节了解如何更新 ComfyUI 和对应的依赖
128+
129+
## 如何向 ComfyUI 官方贡献模板?
130+
131+
目前所有的模板都托管在 [workflow_templates](https://github.com/Comfy-Org/workflow_templates/) 仓库中,你可以通过提交 PR 的方式来贡献模板,对于官方模板我们要求如下:
132+
133+
1. 不使用任何的第三方节点(避免用户因为缺失节点导致需要额外的安装)
134+
2. 对应的模板不与已有模板重复, 需要是已支持的相关模型功能
135+
3. 你可以在对应的仓库提交 issue 进行提问
136+
137+
## 自定义节点模板
138+
139+
如果自定义节点作者有提供了模板和示例工作流,你也可以在模板浏览里找到,通常只需要找到对应的节点名称的分类即可看到作者提供的所有目录。
140+
141+
如果你是自定义节点作者,请注意目前我们仅支持模板文件夹下的一级目录,并不支持多级目录,且仅支持 JSON 格式的模板
142+
143+
## 如何为自定义节点添加模板?
144+
145+
[自定义节点模板](/zh-CN/custom-nodes/workflow_templates) 中介绍了如何为你开发的自定义节点添加工作流模板,你也可以向自定义节点作者提交 PR 来贡献自定义节点模板

0 commit comments

Comments
 (0)