diff --git a/GEMINI.md b/GEMINI.md deleted file mode 100644 index c0239352..00000000 --- a/GEMINI.md +++ /dev/null @@ -1,84 +0,0 @@ -# ComfyUI LoRA Manager - -## Project Overview - -ComfyUI LoRA Manager is a comprehensive extension for ComfyUI that streamlines the organization, downloading, and application of LoRA models. It functions as both a custom node within ComfyUI and a standalone application. - -**Key Features:** -* **Model Management:** Browse, organize, and download LoRA models (and Checkpoints/Embeddings) from Civitai and CivArchive. -* **Visualization:** Preview images, videos, and trigger words. -* **Workflow Integration:** "One-click" integration into ComfyUI workflows, preserving generation parameters. -* **Recipe System:** Save and share LoRA combinations as "recipes". -* **Architecture:** Hybrid Python backend (API, file management) and JavaScript/HTML frontend (Web UI). - -## Directory Structure - -* `py/`: Core Python backend source code. - * `lora_manager.py`: Main entry point for the ComfyUI node. - * `routes/`: API route definitions (using `aiohttp` in standalone, or ComfyUI's server). - * `services/`: Business logic (downloading, metadata, scanning). - * `nodes/`: ComfyUI custom node implementations. -* `static/`: Frontend static assets (CSS, JS, Images). -* `templates/`: HTML templates (Jinja2). -* `locales/`: Internationalization JSON files. -* `web/comfyui/`: JavaScript extensions specifically for the ComfyUI interface. -* `standalone.py`: Entry point for running the manager as a standalone web app. -* `tests/`: Backend tests. -* `requirements.txt`: Python runtime dependencies. -* `package.json`: Frontend development dependencies and test scripts. - -## Building and Running - -### Prerequisites -* Python 3.8+ -* Node.js (only for running frontend tests) - -### Backend Setup -1. Install Python dependencies: - ```bash - pip install -r requirements.txt - ``` - -### Running in Standalone Mode -You can run the manager independently of ComfyUI for development or management purposes. -```bash -python standalone.py --port 8188 -``` - -### Running in ComfyUI -Ensure the folder is located in `ComfyUI/custom_nodes/`. ComfyUI will automatically load it upon startup. - -## Testing - -### Backend Tests (Pytest) -1. Install development dependencies: - ```bash - pip install -r requirements-dev.txt - ``` -2. Run tests: - ```bash - pytest - ``` - * Coverage reports are generated in `coverage/backend/`. - -### Frontend Tests (Vitest) -1. Install Node dependencies: - ```bash - npm install - ``` -2. Run tests: - ```bash - npm run test - ``` -3. Run coverage: - ```bash - npm run test:coverage - ``` - -## Development Conventions - -* **Python Style:** Follow PEP 8. Use snake_case for files/functions and PascalCase for classes. -* **Frontend:** Standard ES modules. UI components often end in `_widget.js`. -* **Configuration:** User settings are stored in `settings.json`. Developers should reference `settings.json.example`. -* **Localization:** Update `locales/.json` and run `scripts/sync_translation_keys.py` when changing UI text. -* **Documentation:** Architecture details are in `docs/architecture/` and `IFLOW.md`. diff --git a/IFLOW.md b/IFLOW.md deleted file mode 100644 index 456b278a..00000000 --- a/IFLOW.md +++ /dev/null @@ -1,103 +0,0 @@ -# ComfyUI LoRA Manager - iFlow 上下文 - -## 项目概述 - -ComfyUI LoRA Manager 是一个全面的工具集,用于简化 ComfyUI 中 LoRA 模型的组织、下载和应用。它提供了强大的功能,如配方管理、检查点组织和一键工作流集成,使模型操作更快、更流畅、更简单。 - -该项目是一个 Python 后端与 JavaScript 前端结合的 Web 应用程序,既可以作为 ComfyUI 的自定义节点运行,也可以作为独立应用程序运行。 - -## 项目结构 - -``` -D:\Workspace\ComfyUI\custom_nodes\ComfyUI-Lora-Manager\ -├── py/ # Python 后端代码 -│ ├── config.py # 全局配置 -│ ├── lora_manager.py # 主入口点 -│ ├── controllers/ # 控制器 -│ ├── metadata_collector/ # 元数据收集器 -│ ├── middleware/ # 中间件 -│ ├── nodes/ # ComfyUI 节点 -│ ├── recipes/ # 配方相关 -│ ├── routes/ # API 路由 -│ ├── services/ # 业务逻辑服务 -│ ├── utils/ # 工具函数 -│ └── validators/ # 验证器 -├── static/ # 静态资源 (CSS, JS, 图片) -├── templates/ # HTML 模板 -├── locales/ # 国际化文件 -├── tests/ # 测试代码 -├── standalone.py # 独立模式入口 -├── requirements.txt # Python 依赖 -├── package.json # Node.js 依赖和脚本 -└── README.md # 项目说明 -``` - -## 核心组件 - -### 后端 (Python) - -- **主入口**: `py/lora_manager.py` 和 `standalone.py` -- **配置**: `py/config.py` 管理全局配置和路径 -- **路由**: `py/routes/` 目录下包含各种 API 路由 -- **服务**: `py/services/` 目录下包含业务逻辑,如模型扫描、下载管理等 -- **模型管理**: 使用 `ModelServiceFactory` 来管理不同类型的模型 (LoRA, Checkpoint, Embedding) - -### 前端 (JavaScript) - -- **构建工具**: 使用 Node.js 和 npm 进行依赖管理和测试 -- **测试**: 使用 Vitest 进行前端测试 - -## 构建和运行 - -### 安装依赖 - -```bash -# Python 依赖 -pip install -r requirements.txt - -# Node.js 依赖 (用于测试) -npm install -``` - -### 运行 (ComfyUI 模式) - -作为 ComfyUI 的自定义节点安装后,在 ComfyUI 中启动即可。 - -### 运行 (独立模式) - -```bash -# 使用默认配置运行 -python standalone.py - -# 指定主机和端口 -python standalone.py --host 127.0.0.1 --port 9000 -``` - -### 测试 - -#### 后端测试 - -```bash -# 安装开发依赖 -pip install -r requirements-dev.txt - -# 运行测试 -pytest -``` - -#### 前端测试 - -```bash -# 运行测试 -npm run test - -# 运行测试并生成覆盖率报告 -npm run test:coverage -``` - -## 开发约定 - -- **代码风格**: Python 代码应遵循 PEP 8 规范 -- **测试**: 新功能应包含相应的单元测试 -- **配置**: 使用 `settings.json` 文件进行用户配置 -- **日志**: 使用 Python 标准库 `logging` 模块进行日志记录 \ No newline at end of file diff --git a/VUE_WIDGETS_SETUP.md b/VUE_WIDGETS_SETUP.md deleted file mode 100644 index 224bbebb..00000000 --- a/VUE_WIDGETS_SETUP.md +++ /dev/null @@ -1,181 +0,0 @@ -# Vue + PrimeVue Widget Development Setup - -This guide explains the Vue + PrimeVue widget development scaffold for ComfyUI LoRA Manager. - -## Overview - -The project now supports developing custom ComfyUI widgets using Vue 3 + PrimeVue, providing a modern reactive framework for building rich UI components. - -## Architecture - -``` -ComfyUI-Lora-Manager/ -├── vue-widgets/ # Vue widget source code (TypeScript) -│ ├── src/ -│ │ ├── main.ts # Extension registration -│ │ └── components/ # Vue components -│ ├── package.json -│ ├── vite.config.mts # Build to web/comfyui/vue-widgets/ -│ └── tsconfig.json -│ -├── web/comfyui/ # ComfyUI web directory -│ ├── vue-widgets/ # Compiled Vue widgets (gitignored) -│ │ ├── lora-manager-widgets.js # Built JavaScript -│ │ └── assets/ # CSS and other assets -│ └── *.js # Existing vanilla JS widgets -│ -├── py/nodes/ # Python node definitions -│ ├── demo_vue_widget_node.py # Demo node -│ └── ... -│ -└── __init__.py # Node registration -``` - -## Quick Start - -### 1. Install Dependencies - -```bash -cd vue-widgets -npm install -``` - -### 2. Build the Demo Widget - -```bash -npm run build -``` - -This compiles the TypeScript/Vue code and outputs to `web/comfyui/vue-widgets/`. - -### 3. Test in ComfyUI - -1. Start/restart ComfyUI -2. Open the ComfyUI interface -3. Add the "LoRA Manager Demo (Vue)" node from the node menu -4. You should see a Vue-powered widget with PrimeVue components: - - Text input for model name - - Number input for strength (with +/- buttons) - - Apply and Reset buttons - - Result card showing current configuration - -## Development Workflow - -### Watch Mode for Development - -```bash -cd vue-widgets -npm run dev -``` - -This watches for file changes and automatically rebuilds. You'll need to refresh ComfyUI's browser page to see changes. - -### Project Structure - -**Python Side (`py/nodes/demo_vue_widget_node.py`):** -- Defines the ComfyUI node class -- Specifies input types (including the custom widget type) -- Implements the processing logic -- The widget type name must match the key in the frontend's `getCustomWidgets()` - -**Frontend Side (`vue-widgets/src/`):** -- `main.ts` - Registers the extension with ComfyUI and creates Vue apps -- `components/DemoWidget.vue` - The actual Vue component with PrimeVue UI - -### Data Flow - -1. **Widget Creation:** - - ComfyUI calls `getCustomWidgets()` when creating a node - - Creates a container DOM element - - Mounts a Vue app with the component inside the container - -2. **Widget State:** - - Component props receive `widget` and `node` objects from ComfyUI - - Use Vue's reactive state management within the component - -3. **Serialization:** - - Implement `widget.serializeValue()` in `onMounted()` - - This function is called when the workflow is saved or executed - - Return the data that should be passed to the Python node - -4. **Processing:** - - Python node receives the serialized data in its `process()` method - - Process the data and return results to the workflow - -## Creating Your Own Widget - -See the detailed guide in `vue-widgets/README.md`. - -Quick checklist: -- [ ] Create Python node in `py/nodes/` -- [ ] Create Vue component in `vue-widgets/src/components/` -- [ ] Register widget in `vue-widgets/src/main.ts` -- [ ] Register node in `__init__.py` -- [ ] Build with `npm run build` -- [ ] Test in ComfyUI - -## Key Technologies - -- **Vue 3**: Modern reactive framework with Composition API -- **PrimeVue 4**: Rich UI component library with 90+ components -- **TypeScript**: Type-safe development -- **Vite**: Fast build tool with HMR support - -## Build Configuration - -The build is configured to: -- Output ES modules to `../web/comfyui/vue-widgets/` -- Mark ComfyUI's `app.js` as external (not bundled) -- Generate source maps for debugging -- Keep code unminified for easier debugging -- Split vendor code into separate chunks - -## PrimeVue Components - -The demo widget showcases several PrimeVue components: -- `Button` - Styled buttons with icons -- `InputText` - Text input fields -- `InputNumber` - Number inputs with spinners -- `Card` - Container component - -For the full component library, see [PrimeVue Documentation](https://primevue.org/). - -## Troubleshooting - -### Build fails with module errors -- Make sure you're in the `vue-widgets` directory -- Run `npm install` to ensure all dependencies are installed -- Check that Node.js version is 18+ (`node --version`) - -### Widget doesn't appear in ComfyUI -- Verify the build completed successfully (`web/comfyui/vue-widgets/lora-manager-widgets.js` exists) -- Check that the Python node is registered in `__init__.py` -- Restart ComfyUI completely (not just refresh browser) -- Check browser console for JavaScript errors - -### Widget type mismatch error -- Ensure the widget type in Python (e.g., `"LORA_DEMO_WIDGET"`) matches the key in `getCustomWidgets()` -- Type names are case-sensitive - -### Changes not reflected after rebuild -- Hard refresh the browser (Ctrl+Shift+R / Cmd+Shift+R) -- Clear browser cache -- Restart ComfyUI server - -## Next Steps - -Now that the scaffold is set up, you can: - -1. **Extend the demo widget** - Add more PrimeVue components and functionality -2. **Create production widgets** - Build widgets for actual LoRA management features -3. **Add styling** - Customize the look with CSS/Tailwind -4. **Add i18n** - Implement vue-i18n for internationalization -5. **Add state management** - Use Pinia if you need shared state across widgets - -## References - -- [ComfyUI Custom Nodes Documentation](https://docs.comfy.org/essentials/custom_node_server) -- [PrimeVue Documentation](https://primevue.org/) -- [Vue 3 Documentation](https://vuejs.org/) -- [Vite Documentation](https://vitejs.dev/) -- Reference implementation: `/refs/ComfyUI_frontend_vue_basic`