readme.md fix

This commit is contained in:
dseditor
2025-06-17 10:05:23 +08:00
parent 5d753b2881
commit 617a87e013
+130 -49
View File
@@ -1,9 +1,10 @@
# ComfyUI-Thread
A ComfyUI custom node package for seamless integration with Threads (Meta's social platform). This package allows you to publish posts, manage images, and retrieve post history directly from your ComfyUI workflows.
A ComfyUI custom node package for seamless integration with Threads (Meta's social platform). This package allows you to publish posts, manage images/videos, and retrieve post history directly from your ComfyUI workflows.
ComfyUI 的 Threads 整合自定義節點包,讓您能夠直接在 ComfyUI 工作流程中發布貼文、管理圖片和獲取發文歷史。
本說明由Claude產生,老實講他寫得真好,我只要補充就好了。
ComfyUI 的 Threads 整合自定義節點包,讓您能夠直接在 ComfyUI 工作流程中發布貼文、管理圖片/影片和獲取發文歷史。
> **完整功能參考**: 本節點為實現發布的簡要功能與多圖片容器,若需要設定更完整的發布節點包括圖床、伺服器與權杖管理測試,請參考 [ComfyUI Threads Uploader](https://github.com/clinno0616/comfyui-threads-uploader)
## Features | 功能特色
@@ -11,8 +12,10 @@ ComfyUI 的 Threads 整合自定義節點包,讓您能夠直接在 ComfyUI 工
- ✅ Text-only posts | 純文字發文
- ✅ Single image posts | 單圖發文
- ✅ Multi-image carousel posts | 多圖輪播發文
- ✅ Video posts with smart path detection | 支援影片發文及智能路徑檢測
- ✅ Image tensor support (from ComfyUI generators) | 支援圖片張量(來自 ComfyUI 生成器)
- ✅ External image URL support | 支援外部圖片網址
- ✅ External image/video URL support | 支援外部圖片/影片網址
- ✅ Local video file processing | 支援本地影片檔案處理
### 📊 **Analytics | 數據分析**
- ✅ Retrieve post history | 獲取發文歷史
@@ -23,20 +26,24 @@ ComfyUI 的 Threads 整合自定義節點包,讓您能夠直接在 ComfyUI 工
- ✅ Long-lived access token management | 長期訪問令牌管理
- ✅ Custom ComfyUI URL support | 支援自訂 ComfyUI 網址
- ✅ Automatic configuration persistence | 自動配置持久化
- ✅ Intelligent media processing | 智能媒體處理
## Installation | 安裝方式
**Using ComfyMananger 使用ComfyUIManager安裝**
### Using ComfyUI Manager | 使用 ComfyUI Manager 安裝
Open ComfyManager
Search For **ComfyUI-Thread**
Restart ComfyUI | 重啟 ComfyUI
1. Open ComfyUI Manager | 開啟 ComfyUI Manager
2. Search for **ComfyUI-Thread** | 搜尋 **ComfyUI-Thread**
3. Install the package | 安裝套件
4. Restart ComfyUI | 重啟 ComfyUI
## ExampleWorkflow | 範例工作流
### Manual Installation | 手動安裝
範例工作流使用了ollama-gemini節點來產生圖文提示內容,此節點需自行配置API金鑰才能使用Gemini。
https://github.com/al-swaiti/ComfyUI-OllamaGemini
有關於圖像生成模型的部分,可以修改為你自己常用的模型與節點。
```bash
cd ComfyUI/custom_nodes/
git clone https://github.com/your-repo/ComfyUI-Thread.git
pip install -r ComfyUI-Thread/requirements.txt
```
## Setup | 設置
@@ -49,14 +56,14 @@ You need to obtain the following from Meta Developers:
- `ACCESS_TOKEN` - Short-lived access token | 短期訪問令牌
- `APP_SECRET` - Your app secret | 您的應用密鑰
有關他們的取得方式,可以參考SDK的開發者網址,同時你也必須安裝**requirement.txt**中的SDK:
https://nijialin.com/2024/08/17/python-threads-sdk-introduction/
**參考資源**: 有關憑證的取得方式,可以參考 SDK 的開發者網址,同時你也必須安裝 **requirements.txt** 中的 SDK:
https://nijialin.com/2024/08/17/python-threads-sdk-introduction/
### 2. Configure API Access | 配置 API 訪問
Use the **Start With Long Live Token** node with your credentials to generate a long-lived access token.
搜尋並使用 **Start With Long Live Token** 節點輸入您的憑證來生成長期訪問令牌。
使用 **Start With Long Live Token** 節點輸入您的憑證來生成長期訪問令牌。
## Nodes | 節點說明
@@ -67,30 +74,66 @@ Initialize the Threads API connection and generate a long-lived access token.
**Inputs | 輸入:**
- `USER_ID` - Your Threads user ID | 您的 Threads 用戶 ID
- `ACCESS_TOKEN` - Short-lived access token | 短期訪問令牌
- `ACCESS_TOKEN` - Short-lived access token | 短期訪問令牌
- `APP_SECRET` - Your app secret | 您的應用密鑰
**Outputs | 輸出:**
- `result` - Configuration status message | 配置狀態訊息,成功後會產生一個token.json檔案在token資料夾下。
- `result` - Configuration status message | 配置狀態訊息
**Note | 注意**: 成功後會在 `token` 資料夾下產生一個 `thread_config.json` 檔案。
---
### 📤 **Publish Thread**
Publish posts to Threads with text and images.
Publish posts to Threads with text and images, supporting single images and multi-image carousels.
發布包含文字和圖片的 Threads 貼文。
發布包含文字和圖片的 Threads 貼文,支援單圖和多圖輪播。
**Inputs | 輸入:**
- `text` - Post content (required) | 貼文內容(必填)
- `ComfyUIHttpsURL` - Custom ComfyUI base URL (optional) | 自訂 ComfyUI 基礎網址(選填),此網址必須使用ngrok等建立https對外的網址,填入一次之後不用再次填寫,網址會記憶在url.json檔案中,如果網址變更才需要再填寫,沒有填過它就會預設為127.0.0.1,image接點會無法傳圖只能使用網址。
- `image` - Image tensor input (optional) | 圖片張量輸入(選填),一定要有https設定過才會生效。
- `image_url` - External image URLs, one per line (optional) | 外部圖片網址,每行一個(選填),可填入多行網址成為容器,狀態可以看到收集多少圖片網址。
- `text` (required) - Post content | 貼文內容(必填)
- `ComfyUIHttpsURL` (optional) - Custom ComfyUI base URL | 自訂 ComfyUI 基礎網址(選填)
- `image` (optional) - Image tensor input | 圖片張量輸入(選填)
- `image_url` (optional) - External image URLs, one per line | 外部圖片網址,每行一個(選填)
**Outputs | 輸出:**
- `result` - Post status and URL | 發文狀態和網址,失敗會傳出API錯誤訊息。
- `result` - Post status and URL | 發文狀態和網址
**Features | 特色功能:**
- Supports single and multiple images | 支援單圖和多圖
- Automatic carousel creation for multiple images | 多圖時自動創建輪播
- Image tensor processing with batch support | 支援批次圖片張量處理
---
### 🎬 **Thread Publish Video**
Publish video posts to Threads with intelligent path detection and media container status monitoring.
發布影片貼文到 Threads,具備智能路徑檢測和媒體容器狀態監控。
**Inputs | 輸入:**
- `text` (required) - Post content | 貼文內容(必填)
- `video_path` (required) - Video path or URL | 影片路徑或網址(必填)
- `ComfyUIHttpsURL` (optional) - Custom ComfyUI base URL | 自訂 ComfyUI 基礎網址(選填)
**Outputs | 輸出:**
- `result` - Post status and URL | 發文狀態和網址
**Smart Path Detection | 智能路徑檢測:**
- **Network URL**: Automatically detected if starts with `http://` or `https://` | 網路網址:以 `http://` 或 `https://` 開頭時自動檢測
- **Local Path**: All other inputs treated as local file paths | 本地路徑:其他輸入均視為本地檔案路徑
**Media Processing | 媒體處理:**
- Automatic file copying to ComfyUI output directory | 自動複製檔案到 ComfyUI 輸出目錄
- Status monitoring every 20 seconds | 每 20 秒檢查狀態
- Support for common video formats (MP4, MOV, AVI, etc.) | 支援常見影片格式
- File size validation (max 1GB) | 檔案大小驗證(最大 1GB)
---
### 📈 **Threads History**
Retrieve your post history from Threads.
Retrieve your post history from Threads with customizable date ranges.
從 Threads 獲取您的發文歷史。
從 Threads 獲取您的發文歷史,可自訂日期範圍。
**Inputs | 輸入:**
- `backfill_days` - Number of days to look back (1-365) | 回溯天數(1-365)
@@ -100,34 +143,50 @@ Retrieve your post history from Threads.
## Usage Examples | 使用範例
### Example Workflow | 範例工作流
範例工作流使用了 ollama-gemini 節點來產生圖文提示內容,此節點需自行配置 API 金鑰才能使用 Gemini:
https://github.com/al-swaiti/ComfyUI-OllamaGemini
有關圖像生成模型的部分,可以修改為你自己常用的模型與節點。
### Simple Text Post | 簡單文字發文
1. Connect **Start With Long Live Token** → Configure your API credentials | 必須先以API的token開始
2. Connect **Publish Thread** → Enter your text content | 打入文字,按下Queue就會發文
3. Execute to post
1. Configure **Start With Long Live Token** with your API credentials | 使用 API 憑證配置令牌節點
2. Connect **Publish Thread** and enter your text content | 連接發文節點並輸入文字內容
3. Execute to post | 執行發文
### Image Post with Generated Content | 使用生成內容的圖片發文
1. Create images using ComfyUI generators (Support ImageBatch/BatchSize) | 直接接入圖片節點,或使用LoadImage,不支援ImageList做為容器,會被視為多張圖,但支援ImageBatch批次,可將多張圖片MakeImageBatch後上傳
2. Connect image output to **Publish Thread** `image` input
3. Add your text content
4. Execute to post with generated images | 可組合圖片與文案至Thread
1. Create images using ComfyUI generators | 使用 ComfyUI 生成器創建圖片
2. Connect image output to **Publish Thread** `image` input | 將圖片輸出連接到發文節點的圖片輸入
3. Add your text content | 添加文字內容
4. Execute to post with generated images | 執行以發布包含生成圖片的貼文
**Note | 注意**: 支援 ImageBatch/BatchSize,不支援 ImageList 做為容器。可將多張圖片使用 MakeImageBatch 後上傳。
### Video Post | 影片發文
1. Configure **Thread Publish Video** with your content | 配置影片發文節點
2. Enter video path (local file or URL) | 輸入影片路徑(本地檔案或網址)
3. Add your text content | 添加文字內容
4. Execute and wait for processing | 執行並等待處理完成
### Multi-Image Carousel | 多圖輪播
1. In **Publish Thread**, enter multiple image URLs in `image_url` field (one per line) | 貼入多行HTTPS網址
2. Add your text content
3. Execute to create a carousel post
1. In **Publish Thread**, enter multiple image URLs in `image_url` field (one per line) | 在發文節點的圖片網址欄位輸入多行 HTTPS 網址
2. Add your text content | 添加文字內容
3. Execute to create a carousel post | 執行創建輪播貼文
### Analyze Post History | 分析歷史貼文
1. Use **Threads History** to retrieve recent posts
2. Set `backfill_days` to desired time range
3. Review formatted output for content analysis
1. Use **Threads History** to retrieve recent posts | 使用歷史節點獲取近期貼文
2. Set `backfill_days` to desired time range | 設定回溯天數
3. Review formatted output for content analysis | 查看格式化輸出進行內容分析
## File Structure | 檔案結構
```
ComfyUI-Thread/
├── __init__.py # Module initialization | 模組初始化
├── nodes.py # Main node implementations | 主要節點
└── token/ # Auto-generated config directory | 自動生成的配置目錄
├── __init__.py # Module initialization | 模組初始化
├── nodes.py # Main node implementations | 主要節點實作
├── requirements.txt # Python dependencies | Python 相依性
└── token/ # Auto-generated config directory | 自動生成的配置目錄
├── thread_config.json # API credentials | API 憑證
└── url.json # ComfyUI URL configuration | ComfyUI 網址配置
```
@@ -145,27 +204,49 @@ ComfyUI-Thread/
## API Limitations | API 限制
- **Scope**: Only works with your own Threads account | 僅適用於您自己的 Threads 帳號
- **Rate Limits**: Subject to Meta's API rate limits | 受 Meta API 速率限制約束
- **Video Support**: Currently limited due to Threads' strict video requirements | 目前沒有支援影片上傳,因 Threads 對視頻格式要求嚴格
- **Rate Limits**: Subject to Meta's API rate limits (250 posts per 24 hours) | 受 Meta API 速率限制約束(24小時內250則貼文)
- **Video Requirements**: Follows Threads' strict video format requirements | 遵循 Threads 嚴格的影片格式要求
- **Image Requirements**: Must be publicly accessible URLs or properly configured HTTPS | 圖片必須是可公開存取的網址或正確配置的 HTTPS
## Configuration Notes | 配置說明
### ComfyUI HTTPS URL | ComfyUI HTTPS 網址
- 此網址必須使用 ngrok 等建立 HTTPS 對外的網址
- 填入一次之後會記憶在 `url.json` 檔案中
- 網址變更時才需要重新填寫
- 沒有填過則預設為 127.0.0.1,image 節點會無法傳圖只能使用網址
## Troubleshooting | 疑難排解
### Common Issues | 常見問題
**"Please execute StartWithLongLiveToken node first(無法發送)"**
**"Please execute StartWithLongLiveToken node first"**
- Make sure you've run the token configuration node before posting
- 確保在發文前已執行令牌配置節點
**"Param image_url is not a valid URL"**
- Check that your image URLs are complete and accessible
- Ensure URLs start with `https://`
- 檢查圖片網址是否完整且可存取,如果使用Image,ComfyUI必須有可認證的HTTPS對外
- 檢查圖片網址是否完整且可存取
**Image not displaying in posts(發送成功圖片無法顯示,只有文字)**
**Image not displaying in posts | 發送成功圖片無法顯示,只有文字**
- Verify your ComfyUI URL is accessible from the internet
- Check the `ComfyUIHttpsURL` configuration
- 確認您的 ComfyUI 網址可從網際網路存取
- 檢查 `ComfyUIHttpsURL` 配置
**Video processing timeout | 影片處理超時**
- Check video file size (max 1GB)
- Verify video format compatibility
- Ensure stable internet connection
- 檢查影片檔案大小(最大 1GB)
- 確認影片格式相容性
**Local video file not found | 本地影片檔案未找到**
- Verify the file path is correct
- Check file permissions
- Ensure the file exists and is accessible
- 確認檔案路徑正確
- 檢查檔案權限
## License | 授權
@@ -181,4 +262,4 @@ If you encounter any issues or have questions, please open an issue on GitHub.
**Note**: This project is not officially affiliated with Meta or Threads. Use responsibly and in accordance with Threads' Terms of Service.
**注意**:此專案與 Meta 或 Threads 無官方關聯。請負責任地使用並遵守 Threads 的服務條款。
**注意**:此專案與 Meta 或 Threads 無官方關聯。請負責任地使用並遵守 Threads 的服務條款。