diff --git a/README.md b/README.md index 789fa7b..7aa75fb 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,70 @@ +[English Document](./docs/en.md) + # ComfyUI-Only -ComfyUI自定义节点集合,最初专注于workflow解析,现已扩展至提供高级文件加载功能。 +ComfyUI自定义节点集合,最初专注于workflow解析,现已扩展至提供高级文件加载功能,旨在提升您的工作流效率和体验。 ## 🌟 主要功能 -### 1. 高级Latent加载器 (Load Latent (Advanced)) ⭐全新功能 - -- 📤 **从任意位置上传**:通过“Upload Latent”按钮,直接从您电脑的任何地方选择 `.latent` 文件。 +### 1. 高级Latent加载器 (Load Latent (Advanced)) ⭐核心功能 +- 📤 **从任意位置上传**:通过“Upload Latent”按钮,直接从您电脑的任何地方选择 `.latent` 文件,无需再放入 `input` 文件夹。 - ✨ **拖拽上传**:将 `.latent` 文件直接从您的文件管理器拖拽到节点上即可上传。 - 🔄 **智能格式兼容**:自动识别并兼容标准的 `pickle` 格式和高速的 `safetensors` 格式。 - 🤖 **智能结构解析**:自动解析多种 latent 内部结构,无论是标准的 `samples` 键,还是非标准的 `latent_tensor` 键,甚至是裸张量。 - 🔢 **智能维度处理**:自动处理3D(图像)、4D(带批次的图像)和5D(视频)的 latent 张量,确保与下游节点(如VAEDecode)的兼容性。 ### 2. Workflow图片文件加载器 (WorkflowImageFileLoader) - -- 📁 直接从文件系统加载图片文件 -- 🔍 自动解析图片中的workflow元数据信息 -- 🎯 智能提取positive和negative提示词 -- 🏷️ 提取CheckpointLoaderSimple节点的模型名称 -- 📋 支持手动输入workflow JSON作为备选 -- ✅ **解决了IMAGE类型不包含元数据的问题** +- 📁 直接从文件系统加载图片文件。 +- 🔍 **自动解析元数据**:自动解析图片中的workflow元数据信息。 +- 🎯 **智能提取提示词**:智能提取positive和negative提示词。 +- 🏷️ **智能提取模型**:提取CheckpointLoaderSimple节点的模型名称。 +- ✅ **解决核心痛点**:解决了原生 `IMAGE` 类型不包含元数据导致工作流无法复用的问题。 --- -*(为保持简洁,其他旧节点说明已折叠,您可以在旧版本中查看它们)* +*(为保持简洁,其他旧节点说明已折叠)* -## 🚀 快速开始 +## 🚀 安装与启动 -### 安装 -1. 将此项目克隆到ComfyUI的`custom_nodes`目录下。 -2. (可选)安装依赖:`pip install -r requirements.txt` -3. 重启ComfyUI。 -4. 在节点菜单中找到`ComfyUI-Only`分类。 +### 推荐方法:通过 ComfyUI Manager 安装 +1. **安装 ComfyUI Manager**:如果您尚未安装,请参照 [ComfyUI Manager的官方说明](https://github.com/ltdrdata/ComfyUI-Manager) 进行安装。 +2. **搜索节点**: + - 启动 ComfyUI。 + - 点击侧边栏的 "Manager" 按钮。 + - 点击 "Install Custom Nodes"。 + - 在搜索框中输入 `ComfyUI-Only` 或 `eric183`。 +3. **安装节点**:在搜索结果中找到本插件,点击 "Install" 按钮。 +4. **重启 ComfyUI**:安装完成后,请重启 ComfyUI。 -### 使用方法 +### 备选方法:手动安装 (Git Clone) +1. **进入目录**:打开终端,进入 ComfyUI 的 `custom_nodes` 目录。 + ```bash + cd path/to/your/ComfyUI/custom_nodes + ``` +2. **克隆项目**:使用 `git clone` 命令克隆本仓库。 + ```bash + git clone https://github.com/eric183/ComfyUI-Only.git + ``` +3. **检查依赖**:确保您的Python环境中已安装 `safetensors` 库。ComfyUI 通常已自带,但若遇到导入错误,请手动安装: + ```bash + pip install safetensors + ``` +4. **重启 ComfyUI**:重启 ComfyUI 以加载新节点。 + +## 📖 使用方法 #### ⭐ 加载Latent文件 (推荐) -1. 在菜单中添加 `Load Latent (Advanced)` 节点。 +1. 在菜单中添加 `Load Latent (Advanced)` 节点 (位于 `ComfyUI-Only/Latent` 分类下)。 2. 点击 `Upload Latent` 按钮从您的电脑中选择一个 `.latent` 文件。 3. 或者,直接将 `.latent` 文件拖拽到节点上。 4. 节点会自动处理上传、解析和格式化,然后将 `LATENT` 输出连接到下一个节点(如 `VAEDecode`)。 #### 解析图片中的Workflow -1. 添加 `Workflow图片文件加载器` 节点。 +1. 添加 `Workflow图片文件加载器` 节点 (位于 `ComfyUI-Only/Image` 分类下)。 2. 在 `image_file` 下拉菜单中选择要解析的图片文件。 3. 自动获取输出的 `positive_prompt`, `negative_prompt` 和 `checkpoint_name`。 ## 📁 项目结构 - ``` . ├── __init__.py <-- 主入口,注册节点和JS扩展 @@ -57,19 +74,23 @@ ComfyUI自定义节点集合,最初专注于workflow解析,现已扩展至 │ ├── image_processing_nodes.py │ └── latent_nodes.py ├── LICENSE -├── README.md -└── requirements.txt <-- 项目依赖 +└── README.md ``` ## ⚙️ 依赖要求 - - Python 3.8+ - ComfyUI - PyTorch -- **safetensors** (新) +- **safetensors** (核心依赖,通常随ComfyUI自动安装) ## 📝 更新日志 +### v2.1.0 - 集成与简化 (开发代号:Orion) +- 🎉 **集成**:项目已成功添加至 **ComfyUI Manager** 官方列表,实现一键安装。 +- 🚀 **简化**:**强烈推荐**通过 ComfyUI Manager 进行安装,简化用户操作。 +- 🧹 **重构**:移除了 `requirements.txt` 文件,依赖项由 ComfyUI 或用户按需管理,使项目更轻量。 +- 📚 **文档**:全面重写 `README.md`,更新安装说明、项目结构和依赖信息,使其更清晰、准确。 + ### v2.0.0 - 高级加载器版本 (开发代号:Phoenix) - 🔥 **全新**:发布 `Load Latent (Advanced)` 节点,支持从任意位置上传和拖拽 latent 文件。 - ✨ **新增**:为新节点编写了独立的前端JS扩展,实现了原生级别的UI体验。 diff --git a/docs/en.md b/docs/en.md new file mode 100644 index 0000000..9995776 --- /dev/null +++ b/docs/en.md @@ -0,0 +1,113 @@ +[Read this document in Chinese (简体中文)](../README.md) + +# ComfyUI-Only + +A collection of custom nodes for ComfyUI, initially focused on workflow parsing, now expanded to provide advanced file loading features designed to enhance your workflow efficiency and experience. + +## 🌟 Key Features + +### 1. Load Latent (Advanced) ⭐ Core Feature +- 📤 **Upload from Anywhere**: Select `.latent` files from anywhere on your computer using the "Upload Latent" button, eliminating the need to place them in the `input` folder. +- ✨ **Drag and Drop**: Upload `.latent` files by simply dragging them from your file manager onto the node. +- 🔄 **Smart Format Compatibility**: Automatically detects and supports both standard `pickle` and high-speed `safetensors` formats. +- 🤖 **Intelligent Structure Parsing**: Automatically parses various internal latent structures, whether it's the standard `samples` key, the non-standard `latent_tensor` key, or even a raw tensor. +- 🔢 **Smart Dimension Handling**: Automatically processes 3D (image), 4D (batched images), and 5D (video) latent tensors to ensure compatibility with downstream nodes like VAEDecode. + +### 2. WorkflowImageFileLoader +- 📁 **Direct File Loading**: Load image files directly from your file system. +- 🔍 **Auto-Parse Metadata**: Automatically parses workflow metadata from the image. +- 🎯 **Smart Prompt Extraction**: Intelligently extracts positive and negative prompts. +- 🏷️ **Smart Model Extraction**: Extracts the model name from the CheckpointLoaderSimple node. +- ✅ **Solves a Core Problem**: Addresses the issue where the native `IMAGE` type does not contain metadata, making workflow reuse difficult. + +--- + +*(Older node descriptions have been collapsed for brevity.)* + +## 🚀 Installation & Setup + +### Recommended Method: Install via ComfyUI Manager +1. **Install ComfyUI Manager**: If you haven't already, install it by following the [official ComfyUI Manager instructions](https://github.com/ltdrdata/ComfyUI-Manager). +2. **Search for the Node**: + - Launch ComfyUI. + - Click the "Manager" button in the sidebar. + - Click "Install Custom Nodes". + - Type `ComfyUI-Only` or `eric183` in the search bar. +3. **Install Node**: Find this extension in the search results and click the "Install" button. +4. **Restart ComfyUI**: After installation, restart ComfyUI. + +### Alternative Method: Manual Installation (Git Clone) +1. **Navigate to Directory**: Open a terminal and navigate to the `custom_nodes` directory within your ComfyUI installation. + ```bash + cd path/to/your/ComfyUI/custom_nodes + ``` +2. **Clone the Repository**: Use the `git clone` command to clone this repository. + ```bash + git clone https://github.com/eric183/ComfyUI-Only.git + ``` +3. **Check Dependencies**: Ensure that the `safetensors` library is installed in your Python environment. ComfyUI usually includes it, but if you encounter import errors, install it manually: + ```bash + pip install safetensors + ``` +4. **Restart ComfyUI**: Restart ComfyUI to load the new nodes. + +## 📖 How to Use + +#### ⭐ Loading Latent Files (Recommended) +1. Add the `Load Latent (Advanced)` node from the menu (under the `ComfyUI-Only/Latent` category). +2. Click the `Upload Latent` button to select a `.latent` file from your computer. +3. Alternatively, drag and drop the `.latent` file directly onto the node. +4. The node will automatically handle the upload, parsing, and formatting, then connect the `LATENT` output to the next node (e.g., `VAEDecode`). + +#### Parsing Workflows from Images +1. Add the `WorkflowImageFileLoader` node (under the `ComfyUI-Only/Image` category). +2. Select the image file you want to parse from the `image_file` dropdown menu. +3. The `positive_prompt`, `negative_prompt`, and `checkpoint_name` will be automatically extracted. + +## 📁 Project Structure +``` +. +├── __init__.py <-- Main entry point, registers nodes and JS extensions +├── js/ +│ └── latent_loader.js <-- Frontend UI logic for the advanced latent loader +├── nodes/ +│ ├── image_processing_nodes.py +│ └── latent_nodes.py +├── LICENSE +└── README.md +``` + +## ⚙️ Requirements +- Python 3.8+ +- ComfyUI +- PyTorch +- **safetensors** (Core dependency, typically installed with ComfyUI) + +## 📝 Changelog + +### v2.1.0 - Integration & Simplification (Codename: Orion) +- 🎉 **Integration**: The project has been successfully added to the official **ComfyUI Manager** list for one-click installation. +- 🚀 **Simplification**: **Highly recommended** to install via ComfyUI Manager for a streamlined user experience. +- 🧹 **Refactor**: Removed `requirements.txt`. Dependencies are now managed by ComfyUI or the user as needed, making the project more lightweight. +- 📚 **Documentation**: Completely rewrote `README.md` with updated installation instructions, project structure, and dependency information for clarity and accuracy. + +### v2.0.0 - Advanced Loader Edition (Codename: Phoenix) +- 🔥 **New**: Released the `Load Latent (Advanced)` node with support for uploading and dragging-and-dropping latent files from any location. +- ✨ **Added**: Developed a standalone frontend JS extension for the new node, providing a native-level UI experience. +- 🤖 **Enhanced**: The loader backend now intelligently handles format compatibility (pickle/safetensors), structure parsing, and dimension processing. +- 🧹 **Refactor**: Restructured the project, adding a `js` directory and `requirements.txt`. +- 📚 **Documentation**: Overhauled `README.md` to focus on new features and simplify older descriptions. + +### v1.2.0 +- ✅ Added: Checkpoint model name extraction from CheckpointLoaderSimple nodes. +- ✅ All nodes now have a `checkpoint_name` output. + +*(Older logs have been omitted.)* + +## 🤝 Contributing + +Issues and Pull Requests are welcome! + +## 📄 License + +MIT License - See the [LICENSE](LICENSE) file for details.