Skip to content

Commit

Permalink
feat: Add ComfyUI tool for Stable Diffusion (#8160)
Browse files Browse the repository at this point in the history
  • Loading branch information
QunBB authored Sep 18, 2024
1 parent e896d1e commit cf645c3
Show file tree
Hide file tree
Showing 6 changed files with 853 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions api/core/tools/provider/builtin/comfyui/comfyui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from typing import Any

from core.tools.errors import ToolProviderCredentialValidationError
from core.tools.provider.builtin.comfyui.tools.comfyui_stable_diffusion import ComfyuiStableDiffusionTool
from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController


class ComfyUIProvider(BuiltinToolProviderController):
def _validate_credentials(self, credentials: dict[str, Any]) -> None:
try:
ComfyuiStableDiffusionTool().fork_tool_runtime(
runtime={
"credentials": credentials,
}
).validate_models()
except Exception as e:
raise ToolProviderCredentialValidationError(str(e))
42 changes: 42 additions & 0 deletions api/core/tools/provider/builtin/comfyui/comfyui.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
identity:
author: Qun
name: comfyui
label:
en_US: ComfyUI
zh_Hans: ComfyUI
pt_BR: ComfyUI
description:
en_US: ComfyUI is a tool for generating images which can be deployed locally.
zh_Hans: ComfyUI 是一个可以在本地部署的图片生成的工具。
pt_BR: ComfyUI is a tool for generating images which can be deployed locally.
icon: icon.png
tags:
- image
credentials_for_provider:
base_url:
type: text-input
required: true
label:
en_US: Base URL
zh_Hans: ComfyUI服务器的Base URL
pt_BR: Base URL
placeholder:
en_US: Please input your ComfyUI server's Base URL
zh_Hans: 请输入你的 ComfyUI 服务器的 Base URL
pt_BR: Please input your ComfyUI server's Base URL
model:
type: text-input
required: true
label:
en_US: Model with suffix
zh_Hans: 模型, 需要带后缀
pt_BR: Model with suffix
placeholder:
en_US: Please input your model
zh_Hans: 请输入你的模型名称
pt_BR: Please input your model
help:
en_US: The checkpoint name of the ComfyUI server, e.g. xxx.safetensors
zh_Hans: ComfyUI服务器的模型名称, 比如 xxx.safetensors
pt_BR: The checkpoint name of the ComfyUI server, e.g. xxx.safetensors
url: https://docs.dify.ai/tutorials/tool-configuration/comfyui
Loading

0 comments on commit cf645c3

Please sign in to comment.