trans to en

This commit is contained in:
iSuneast
2025-04-05 15:44:16 +08:00
parent 96366bea25
commit 1a50f03eca
2 changed files with 43 additions and 43 deletions
+36 -36
View File
@@ -1,44 +1,44 @@
# ComfyUI-WebhookNotifier
ComfyUI的Webhook通知插件,用于在图像生成完成时发送webhook通知。
Webhook notification plugin for ComfyUI, used to send webhook notifications when image generation is completed.
## 功能特点
## Features
- 在生成图像后自动发送webhook通知
- 通知中包含图像数量、尺寸等基本信息
- 支持传递ComfyUI的unique_id、prompt和extra_pnginfo
- 可添加自定义附加信息
- 简单易用,只需连接图像输出即可
- Automatically sends webhook notifications after generating images
- Notifications include basic information such as image count, dimensions, etc.
- Supports passing ComfyUI's unique_id, prompt, and extra_pnginfo
- Can add custom additional information
- Simple to use, just connect to the image output
## 安装方法
## Installation
1. 克隆此仓库到ComfyUI的`custom_nodes`目录:
1. Clone this repository to ComfyUI's `custom_nodes` directory:
```bash
cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/yourusername/ComfyUI-WebhookNotifier.git
```
2. 安装依赖项:
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. 重启ComfyUI服务
3. Restart ComfyUI service
## 使用方法
## Usage
插件提供了 Webhook Notifier 节点,可以连接到图像输出,当生成完成时发送通知。
The plugin provides a Webhook Notifier node that can be connected to image output to send notifications when generation is complete.
参数说明:
- `images`: 输入图像(必填,连接到图像生成节点的输出)
- `webhook_url`: Webhook URL地址(必填,默认为"https://example.com/webhook")
- `additional_info`: 附加信息,JSON格式(可选,默认为空)
Parameter description:
- `images`: Input images (required, connect to the output of an image generation node)
- `webhook_url`: Webhook URL address (required, default is "https://example.com/webhook")
- `additional_info`: Additional information in JSON format (optional, default is empty)
## Webhook通知格式
## Webhook Notification Format
WebhookNotifier节点发送的数据格式示例:
Example of data format sent by the WebhookNotifier node:
```json
{
@@ -51,32 +51,32 @@ WebhookNotifier节点发送的数据格式示例:
"unique_id": "12345678-1234-5678-abcd-1234567890ab",
"prompt": {...},
"extra_pnginfo": {...},
"custom_field1": "自定义值1",
"custom_field2": "自定义值2"
"custom_field1": "Custom value 1",
"custom_field2": "Custom value 2"
}
```
其中:
- `status`: 始终为"completed",表示任务完成
- `timestamp`: 任务完成的时间戳
- `images`: 包含图像数量和尺寸信息
- `unique_id`: ComfyUI的任务ID
- `prompt`: ComfyUI的完整提示信息
- `extra_pnginfo`: 来自ComfyUI的额外PNG信息
- 其他字段: 来自additional_info参数的自定义字段
Where:
- `status`: Always "completed", indicating the task is finished
- `timestamp`: Timestamp of when the task completed
- `images`: Contains image count and dimension information
- `unique_id`: ComfyUI's task ID
- `prompt`: Complete prompt information from ComfyUI
- `extra_pnginfo`: Additional PNG information from ComfyUI
- Other fields: Custom fields from the additional_info parameter
## 示例
## Example
将图像生成节点的输出连接到WebhookNotifier节点的images输入,设置您的webhook URL,就可以在图像生成完成时收到通知。
Connect the output of an image generation node to the WebhookNotifier node's images input, set your webhook URL, and you will receive notifications when image generation is complete.
## 调试
## Debugging
节点会打印调试信息,包括是否成功发送webhook通知,以及接收到的hidden参数情况。
The node prints debug information, including whether the webhook notification was sent successfully and the status of received hidden parameters.
## 许可证
## License
MIT
## 贡献
## Contributions
欢迎提交问题和拉取请求!
Issues and pull requests are welcome!
+7 -7
View File
@@ -26,18 +26,18 @@ class WebhookNotifierNode:
def notify(self, images, webhook_url, additional_info="{}"):
try:
# 尝试解析额外信息
# Try to parse additional information
try:
extra_info = json.loads(additional_info) if additional_info else {}
except json.JSONDecodeError:
extra_info = {}
# 构造payload
# Construct payload
payload = {
**extra_info
}
# 发送webhook
# Send webhook
response = requests.post(
webhook_url,
json=payload,
@@ -45,12 +45,12 @@ class WebhookNotifierNode:
)
if response.status_code >= 400:
print(f"Webhook通知失败: {response.status_code} - {response.text}")
print(f"Webhook notification failed: {response.status_code} - {response.text}")
else:
print(f"Webhook通知成功: {response.status_code}")
print(f"Webhook notification successful: {response.status_code}")
except Exception as e:
print(f"发送webhook时出错: {str(e)}")
print(f"Error sending webhook: {str(e)}")
# 不返回任何内容
# No return value
return ()