Compare commits

...

29 Commits

Author SHA1 Message Date
Will Miao
40d9f8d0aa feat: lazy hash calculation for checkpoints
Checkpoints are typically large (10GB+). This change delays SHA256
hash calculation until metadata fetch from Civitai is requested,
significantly improving initial scan performance.

- Add hash_status field to BaseModelMetadata
- CheckpointScanner skips hash during initial scan
- On-demand hash calculation during Civitai fetch
- Background bulk hash calculation support
2026-02-26 22:41:44 +08:00
Will Miao
9f15c1fc06 feat: Add Extra Folder Paths feature with improved layout
- Add Extra Folder Paths section in Library settings for configuring
  additional model folders (LoRA, Checkpoint, Diffusion Model, Embedding)
- Implement dynamic path input rows with add/remove functionality
- Add dedicated CSS styles with flex-based layout for better UX
- Add translations for 10 languages (DE, EN, ES, FR, HE, JA, KO, RU, ZH-CN, ZH-TW)
- Integrate settings loading and saving via SettingsManager

Closes layout issues with single-input path rows
2026-02-26 19:31:10 +08:00
Will Miao
87b462192b feat: Add extra folder paths support for LoRA Manager
Introduce extra_folder_paths feature to allow users to add additional
model roots that are managed by LoRA Manager but not shared with ComfyUI.

Changes:
- Add extra_folder_paths support in SettingsManager (stored per library)
- Add extra path attributes in Config class (extra_loras_roots, etc.)
- Merge folder_paths with extra_folder_paths when applying library settings
- Update LoraScanner, CheckpointScanner, EmbeddingScanner to include
  extra paths in their model roots
- Add comprehensive tests for the new functionality

This enables users to manage models from additional directories without
modifying ComfyUI's model folder configuration.
2026-02-25 18:16:17 +08:00
Will Miao
8ecdd016e6 Increase trigger words limit from 30 to 100 2026-02-25 17:11:21 +08:00
Will Miao
71b347b4bb fix(settings): Auto-scroll to first search match in settings modal
When searching in settings, the view now automatically scrolls to the
first matching element after switching to the matching section.

- Modified performSearch() to track and scroll to first match
- Modified highlightSearchMatches() to return the first highlight element
- Uses requestAnimationFrame and scrollIntoView with block: 'center'
2026-02-25 13:26:59 +08:00
Will Miao
41d2f9d8b4 i18n: Update settings navigation and section translations
- Restructure settings.sections and settings.nav in en.json
- Restore translations for existing keys across all locales (de, es, fr, he, ja, ko, ru, zh-CN, zh-TW)
- Add translations for new keys: metadata, library
- Translate autoOrganize section titles
- Complete all TODO translations in settings.search
2026-02-25 13:16:38 +08:00
Will Miao
0f5b442ec4 refactor(settings): restructure Language, Auto-organize and Metadata settings for better searchability 2026-02-25 11:13:41 +08:00
Will Miao
1d32f1b24e refactor(settings): shorten folder settings labels for better readability
- Rename section title: 'Folder Settings' → 'Default Roots'
- Remove 'Default' prefix from root directory labels:
  - 'Default LoRA Root' → 'LoRA Root'
  - 'Default Checkpoint Root' → 'Checkpoint Root'
  - 'Default Diffusion Model Root' → 'Diffusion Model Root'
  - 'Default Embedding Root' → 'Embedding Root'
- Update translations for all supported languages (en, zh-CN, zh-TW, ja, ko, ru, de, fr, es, he)
2026-02-25 08:20:05 +08:00
Will Miao
ede97f3f3e Fix calculate_recipe_fingerprint to handle non-string hash and invalid strength values
- Handle non-string hash values by converting to string before lower()
- Add try-except for strength conversion to handle invalid values like empty strings
- Fixes hypothesis test failures when random data generates unexpected types
2026-02-25 00:11:38 +08:00
Will Miao
099f885c87 Fix pytest import errors and i18n translation keys
- Add missing mocks for comfy.sd and comfy.utils modules in conftest.py
- Fix i18n translation keys: use .help instead of .description for tooltip keys
2026-02-25 00:07:18 +08:00
Will Miao
fc98c752dc Fix Windows FileNotFoundError when loading LoRAs from lora_stack
lora_stack stores relative paths (e.g., 'Illustrious/style/file.safetensors'),
but comfy.utils.load_torch_file requires absolute paths. Previously, when
loading LoRAs from lora_stack, the relative path was passed directly to the
low-level API, causing FileNotFoundError on Windows.

This fix extracts the lora name from the relative path and uses
get_lora_info_absolute() to resolve the full absolute path before passing
it to load_torch_file(). This maintains compatibility with the lora_stack
format while ensuring correct file loading across all platforms.

Fixes: FileNotFoundError for relative paths in LoraLoaderLM and LoraTextLoaderLM
when processing lora_stack input.
2026-02-25 00:01:41 +08:00
Will Miao
c2754ea937 feat(ui): improve settings layout with inline help tooltips
- Remove bottom margin from setting items and last-child override
- Add flex layout to setting-info for inline label and info icon alignment
- Replace label opacity with rgba color for better tooltip visibility
- Add info-icon styling with hover tooltips using data-tooltip attribute
- Move help text from separate divs to inline tooltips on labels and section headers
- Improve tooltip positioning with edge case handling for left-aligned icons
2026-02-24 23:28:42 +08:00
Will Miao
f0cbe55040 refactor(settings): improve settings modal visual hierarchy and alignment
- Remove sidebar micro-transparent background for cleaner look
- Align Settings header with nav items using consistent left padding
- Enhance section headers: 18px, 700 weight for better visual hierarchy
- Mute setting labels: 400 weight, 0.85 opacity to de-emphasize
- Remove duplicate CSS rules and clean up styling
2026-02-24 15:44:33 +08:00
Will Miao
1f8ab377f7 refactor(settings): Move Priority Tags into Download Path Templates section
- Move Priority Tags setting from separate section to bottom of Download Path Templates
- Fix help link button position to be inline with label using flexbox layout
- Add CSS styles for .priority-tags-header-row and .priority-tags-header
2026-02-24 14:57:28 +08:00
Will Miao
de53ab9304 refactor(settings): restructure settings modal with subsection headers
- Replace duplicate section headers with meaningful subsection titles
- Group settings under logical subsections using existing i18n keys
- Add new translation key 'settings.sections.apiConfiguration'
- Update CSS for subsection styling with proper visual hierarchy
- Improve UX by making settings organization clearer

Subsections now use familiar titles from existing translations:
- API Configuration, Storage Location, Language (General)
- Content Filtering, Video Settings, Layout Settings (Interface)
- Folder Settings, Download Path Templates, Priority Tags,
  Update Flags, Example Images (Download)
- Auto-organize Exclusions, Metadata Refresh Skip Paths (Organization)
- Metadata Archive, Misc (System)
- Proxy Settings (Network)
2026-02-24 14:33:09 +08:00
Will Miao
8d7e861458 fix: correct i18n keys in settings modal for metadata archive and proxy settings
- Fix metadata archive DB setting to use correct i18n keys (enableArchiveDb, etc.)
- Restore metadata archive status display and management buttons
- Fix proxy settings to use correct i18n keys (enableProxy, proxyType, proxyHost, etc.)
- Add missing help text for proxy settings
- Add SOCKS4 proxy option
- Add onblur/onkeydown handlers for proxy input fields
- Update locales for new nav items (organization, system, network)
2026-02-24 11:30:43 +08:00
Will Miao
60674feb10 feat(ui): increase settings modal width and adjust height for better responsiveness
- Increase modal width from 800px to 1000px to accommodate more content
- Change height from fixed 600px to dynamic calculation based on viewport height
- Maintain responsive constraints with max-width and max-height properties
2026-02-24 09:12:07 +08:00
Will Miao
a221682a0d refactor(settings): implement macOS Settings style for settings modal
- Reorganize settings into 4 sections: General, Interface, Download, Advanced
- Implement section switching instead of scrolling (macOS Settings style)
- Remove collapsible/expandable sections and redundant 'SETTINGS' label
- Add accent-colored underline for section headers
- Update navigation with larger, more prominent active state
- Add fade-in animation for section transitions
- Update search to auto-switch to matching section
- Refactor CSS: 800x600 fixed modal size, remove collapse styles
- Refactor JS: simplify navigation logic, remove scroll spy and collapse code

Refs: Phase 0 settings modal optimization
2026-02-24 07:19:32 +08:00
Will Miao
3f0227ba9d feat(settings): add search functionality to settings modal (P2)
Implement Phase 2 search bar feature for settings modal:

- Add search input to settings modal header with icon and clear button
- Implement real-time filtering with 150ms debounce for performance
- Add visual highlighting for matched search terms using accent color
- Implement empty search results state with user-friendly message
- Add keyboard shortcuts (Escape to clear search)
- Auto-expand sections containing matching content during search
- Fix header layout to prevent overlap with close button
- Update progress tracker documenting P2 completion
- Add translation keys for search feature (placeholder, clear, no results)
- Sync translations across all language files

Files changed:
- templates/components/modals/settings_modal.html
- static/css/components/modal/settings-modal.css
- static/js/managers/SettingsManager.js
- locales/*.json (10 language files)
- docs/ui-ux-optimization/progress-tracker.md
2026-02-24 06:36:49 +08:00
Will Miao
528225ffbd feat(settings): add left navigation sidebar to settings modal
Implement two-column layout for improved settings navigation:
- Add 200px fixed navigation sidebar with 4 groups (General, Interface, Download, Advanced)
- Implement scroll spy to highlight current section during scroll
- Add smooth scrolling when clicking navigation items
- Extend modal width from 700px to 950px for better content display
- Add responsive mobile layout (switches to stacked view below 768px)
- Add i18n keys for navigation group titles
- Create documentation for optimization phases and progress tracking

Files changed:
- settings-modal.css: Add sidebar, navigation, and responsive styles
- settings_modal.html: Restructure with two-column layout and section IDs
- SettingsManager.js: Add initializeNavigation() with scroll spy
- locales/*.json: Add settings.nav translations (en, zh-CN, zh-TW, ja, ru, de, fr, es, ko, he)
- docs/ui-ux-optimization/: Add proposal and progress tracker documentation
2026-02-23 21:12:15 +08:00
Will Miao
916bfb0ab0 Allow adaptive multi-line model names in cards
- Remove fixed min-height from card-footer for adaptive sizing
- Increase model-name max-height to 5.6em (4 lines)

Enables full display of long custom-trained LoRA filenames
2026-02-23 18:19:02 +08:00
Will Miao
70398ed985 feat(lora-loader): Load LoRAs using lower-level API to bypass folder_paths validation
- Add get_lora_info_absolute() function to return absolute file paths
- Replace LoraLoader().load_lora() with comfy.utils.load_torch_file() +
  comfy.sd.load_lora_for_models() to enable loading LoRAs from any path
- This allows LoRA Manager to load LoRAs from non-standard paths (multi-library support)
- Fixes #805
2026-02-23 18:06:15 +08:00
Will Miao
1f5baec7fd docs: add recipe batch import feature requirements document 2026-02-23 17:07:03 +08:00
Will Miao
f1eb89af7a refactor: Extract isNodeEnabled helper to eliminate mode check duplication
Consolidate node enabled state checks into isNodeEnabled() helper function
to improve code clarity and maintainability. Follows DRY principle.
2026-02-23 16:47:09 +08:00
pixelpaws
7a04cec08d Merge pull request #825 from RanKaze/main
feat: filter node with mode:0
2026-02-23 16:39:45 +08:00
Will Miao
ec5fd923ba fix(randomizer): Initialize RANDOMIZER_CONFIG widget with default config
Initialize internalValue with default RandomizerConfig object instead of
undefined to prevent frontend from sending empty string to backend when
widget is first created.

This fixes the 'str' object has no attribute 'get' error that occurred
when running a newly created Lora Randomizer node before any user
interaction.

Fixes #4
2026-02-23 14:25:55 +08:00
Will Miao
26b139884c perf(usage-stats): prevent unnecessary writes when idle
- Add is_dirty flag to track if statistics have changed
- Only write stats file when data actually changes
- Add enable_usage_statistics setting in ComfyUI settings
- Skip backend requests when usage statistics is disabled
- Fix standalone mode compatibility for MetadataRegistry

Fixes #826
2026-02-23 14:00:00 +08:00
Will Miao
ec76ac649b Fix long model name display issues in modal and cards
- Add overflow-wrap: anywhere to modal title for proper wrapping of hyphenated names
- Add tooltip to model cards showing full filename on hover

Fixes overlap issues with long filenames like s0r4B35G_Zibv3_Prodigy_ID_Version2_Final_00800
2026-02-23 08:53:33 +08:00
K1einB1ue
60324c1299 feat: filter node with mode:0 2026-02-22 07:19:08 +08:00
45 changed files with 4192 additions and 1003 deletions

View File

@@ -0,0 +1,170 @@
# Recipe Batch Import Feature Requirements
## Overview
Enable users to import multiple images as recipes in a single operation, rather than processing them individually. This feature addresses the need for efficient bulk recipe creation from existing image collections.
## User Stories
### US-1: Directory Batch Import
As a user with a folder of reference images or workflow screenshots, I want to import all images from a directory at once so that I don't have to import them one by one.
**Acceptance Criteria:**
- User can specify a local directory path containing images
- System discovers all supported image files in the directory
- Each image is analyzed for metadata and converted to a recipe
- Results show which images succeeded, failed, or were skipped
### US-2: URL Batch Import
As a user with a list of image URLs (e.g., from Civitai or other sources), I want to import multiple images by URL in one operation.
**Acceptance Criteria:**
- User can provide multiple image URLs (one per line or as a list)
- System downloads and processes each image
- URL-specific metadata (like Civitai info) is preserved when available
- Failed URLs are reported with clear error messages
### US-3: Concurrent Processing Control
As a user with varying system resources, I want to control how many images are processed simultaneously to balance speed and system load.
**Acceptance Criteria:**
- User can configure the number of concurrent operations (1-10)
- System provides sensible defaults based on common hardware configurations
- Processing respects the concurrency limit to prevent resource exhaustion
### US-4: Import Results Summary
As a user performing a batch import, I want to see a clear summary of the operation results so I understand what succeeded and what needs attention.
**Acceptance Criteria:**
- Total count of images processed is displayed
- Number of successfully imported recipes is shown
- Number of failed imports with error details is provided
- Number of skipped images (no metadata) is indicated
- Results can be exported or saved for reference
### US-5: Progress Visibility
As a user importing a large batch, I want to see the progress of the operation so I know it's working and can estimate completion time.
**Acceptance Criteria:**
- Progress indicator shows current status (e.g., "Processing image 5 of 50")
- Real-time updates as each image completes
- Ability to view partial results before completion
- Clear indication when the operation is finished
## Functional Requirements
### FR-1: Image Discovery
The system shall discover image files in a specified directory recursively or non-recursively based on user preference.
**Supported formats:** JPG, JPEG, PNG, WebP, GIF, BMP
### FR-2: Metadata Extraction
For each image, the system shall:
- Extract EXIF metadata if present
- Parse embedded workflow data (ComfyUI PNG metadata)
- Fetch external metadata for known URL patterns (e.g., Civitai)
- Generate recipes from extracted information
### FR-3: Concurrent Processing
The system shall support concurrent processing of multiple images with:
- Configurable concurrency limit (default: 3)
- Resource-aware execution
- Graceful handling of individual failures without stopping the batch
### FR-4: Error Handling
The system shall handle various error conditions:
- Invalid directory paths
- Inaccessible files
- Network errors for URL imports
- Images without extractable metadata
- Malformed or corrupted image files
### FR-5: Recipe Persistence
Successfully analyzed images shall be persisted as recipes with:
- Extracted generation parameters
- Preview image association
- Tags and metadata
- Source information (file path or URL)
## Non-Functional Requirements
### NFR-1: Performance
- Batch operations should complete in reasonable time (< 5 seconds per image on average)
- UI should remain responsive during batch operations
- Memory usage should scale gracefully with batch size
### NFR-2: Scalability
- Support batches of 1-1000 images
- Handle mixed success/failure scenarios gracefully
- No hard limits on concurrent operations (configurable)
### NFR-3: Usability
- Clear error messages for common failure cases
- Intuitive UI for configuring import options
- Accessible from the main Recipes interface
### NFR-4: Reliability
- Failed individual imports should not crash the entire batch
- Partial results should be preserved on unexpected termination
- All operations should be idempotent (re-importing same image doesn't create duplicates)
## API Requirements
### Batch Import Endpoints
The system should expose endpoints for:
1. **Directory Import**
- Accept directory path and configuration options
- Return operation ID for status tracking
- Async or sync operation support
2. **URL Import**
- Accept list of URLs and configuration options
- Support URL validation before processing
- Return operation ID for status tracking
3. **Status/Progress**
- Query operation status by ID
- Get current progress and partial results
- Retrieve final results after completion
## UI/UX Requirements
### UIR-1: Entry Point
Batch import should be accessible from the Recipes page via a clearly labeled button in the toolbar.
### UIR-2: Import Modal
A modal dialog should provide:
- Tab or section for Directory import
- Tab or section for URL import
- Configuration options (concurrency, options)
- Start/Stop controls
- Results display area
### UIR-3: Results Display
Results should be presented with:
- Summary statistics (total, success, failed, skipped)
- Expandable details for each category
- Export or copy functionality for results
- Clear visual distinction between success/failure/skip
## Future Considerations
- **Scheduled Imports**: Ability to schedule batch imports for later execution
- **Import Templates**: Save import configurations for reuse
- **Cloud Storage**: Import from cloud storage services (Google Drive, Dropbox)
- **Duplicate Detection**: Advanced duplicate detection based on image hash
- **Tag Suggestions**: AI-powered tag suggestions for imported recipes
- **Batch Editing**: Apply tags or organization to multiple imported recipes at once
## Dependencies
- Recipe analysis service (metadata extraction)
- Recipe persistence service (storage)
- Image download capability (for URL imports)
- Recipe scanner (for refresh after import)
- Civitai client (for enhanced URL metadata)
---
*Document Version: 1.0*
*Status: Requirements Definition*

View File

@@ -0,0 +1,196 @@
# Settings Modal Optimization Progress Tracker
## Project Overview
**Goal**: Optimize Settings Modal UI/UX with left navigation sidebar
**Started**: 2026-02-23
**Current Phase**: P2 - Search Bar (Completed)
---
## Phase 0: Left Navigation Sidebar (P0)
### Status: Completed ✓
### Completion Notes
- All CSS changes implemented
- HTML structure restructured successfully
- JavaScript navigation functionality added
- Translation keys added and synchronized
- Ready for testing and review
### Tasks
#### 1. CSS Changes
- [x] Add two-column layout styles
- [x] `.settings-modal` flex layout
- [x] `.settings-nav` sidebar styles
- [x] `.settings-content` content area styles
- [x] `.settings-nav-item` navigation item styles
- [x] `.settings-nav-item.active` active state styles
- [x] Adjust modal width to 950px
- [x] Add smooth scroll behavior
- [x] Add responsive styles for mobile
- [x] Ensure dark theme compatibility
#### 2. HTML Changes
- [x] Restructure modal HTML
- [x] Wrap content in two-column container
- [x] Add navigation sidebar structure
- [x] Add navigation items for each section
- [x] Add ID anchors to each section
- [x] Update section grouping if needed
#### 3. JavaScript Changes
- [x] Add navigation click handlers
- [x] Implement smooth scroll to section
- [x] Add scroll spy for active nav highlighting
- [x] Handle nav item click events
- [x] Update SettingsManager initialization
#### 4. Translation Keys
- [x] Add translation keys for navigation groups
- [x] `settings.nav.general`
- [x] `settings.nav.interface`
- [x] `settings.nav.download`
- [x] `settings.nav.advanced`
#### 4. Testing
- [x] Verify navigation clicks work
- [x] Verify active highlighting works
- [x] Verify smooth scrolling works
- [ ] Test on mobile viewport (deferred to final QA)
- [ ] Test dark/light theme (deferred to final QA)
- [x] Verify all existing settings work
- [x] Verify save/load functionality
### Blockers
None currently
### Notes
- Started implementation on 2026-02-23
- Following existing design system and CSS variables
---
## Phase 1: Section Collapse/Expand (P1)
### Status: Completed ✓
### Completion Notes
- All sections now have collapse/expand functionality
- Chevron icon rotates smoothly on toggle
- State persistence via localStorage working correctly
- CSS animations for smooth height transitions
- Settings order reorganized to match sidebar navigation
### Tasks
- [x] Add collapse/expand toggle to section headers
- [x] Add chevron icon with rotation animation
- [x] Implement localStorage for state persistence
- [x] Add CSS animations for smooth transitions
- [x] Reorder settings sections to match sidebar navigation
---
## Phase 2: Search Bar (P1)
### Status: Completed ✓
### Completion Notes
- Search input added to settings modal header with icon and clear button
- Real-time filtering with debounced input (150ms delay)
- Highlight matching terms with accent color background
- Handle empty search results with user-friendly message
- Keyboard shortcuts: Escape to clear search
- Sections with matches are automatically expanded
- All translation keys added and synchronized across languages
### Tasks
- [x] Add search input to header area
- [x] Implement real-time filtering
- [x] Add highlight for matched terms
- [x] Handle empty search results
---
## Phase 3: Visual Hierarchy (P2)
### Status: Planned
### Tasks
- [ ] Add accent border to section headers
- [ ] Bold setting labels
- [ ] Increase section spacing
---
## Phase 4: Quick Actions (P3)
### Status: Planned
### Tasks
- [ ] Add reset to defaults button
- [ ] Add export config button
- [ ] Add import config button
- [ ] Implement corresponding functionality
---
## Change Log
### 2026-02-23 (P2)
- Completed Phase 2: Search Bar
- Added search input to settings modal header with search icon and clear button
- Implemented real-time filtering with 150ms debounce for performance
- Added visual highlighting for matched search terms using accent color
- Implemented empty search results state with user-friendly message
- Added keyboard shortcuts (Escape to clear search)
- Sections with matching content are automatically expanded during search
- Updated SettingsManager.js with search initialization and filtering logic
- Added comprehensive CSS styles for search input, highlights, and responsive design
- Added translation keys for search feature (placeholder, clear, no results)
- Synchronized translations across all language files
### 2026-02-23 (P1)
- Completed Phase 1: Section Collapse/Expand
- Added collapse/expand functionality to all settings sections
- Implemented chevron icon with smooth rotation animation
- Added localStorage persistence for collapse state
- Reorganized settings sections to match sidebar navigation order
- Updated SettingsManager.js with section collapse initialization
- Added CSS styles for smooth transitions and animations
### 2026-02-23 (P0)
- Created project documentation
- Started Phase 0 implementation
- Analyzed existing code structure
- Implemented two-column layout with left navigation sidebar
- Added CSS styles for navigation and responsive design
- Restructured HTML to support new layout
- Added JavaScript navigation functionality with scroll spy
- Added translation keys for navigation groups
- Synchronized translations across all language files
- Tested in browser - navigation working correctly
---
## Testing Checklist
### Functional Testing
- [ ] All settings save correctly
- [ ] All settings load correctly
- [ ] Navigation scrolls to correct section
- [ ] Active nav updates on scroll
- [ ] Mobile responsive layout
### Visual Testing
- [ ] Design matches existing UI
- [ ] Dark theme looks correct
- [ ] Light theme looks correct
- [ ] Animations are smooth
- [ ] No layout shifts or jumps
### Cross-browser Testing
- [ ] Chrome/Chromium
- [ ] Firefox
- [ ] Safari (if available)

View File

@@ -0,0 +1,331 @@
# Settings Modal UI/UX Optimization
## Overview
当前Settings Modal采用单列表长页面设计随着设置项不断增加已难以高效浏览和定位。本方案采用 **macOS Settings 模式**(左侧导航 + 右侧单Section独占显示在保持原有设计语言的前提下重构信息架构大幅提升用户体验。
## Goals
1. **提升浏览效率**:用户能够快速定位和修改设置
2. **保持设计一致性**:延续现有的颜色、间距、动画系统
3. **简化交互模型**移除冗余元素SETTINGS label、折叠功能
4. **清晰的视觉层次**Section级导航右侧独占显示
5. **向后兼容**:不影响现有功能逻辑
## Design Principles
- **macOS Settings模式**点击左侧导航右侧仅显示该Section内容
- **贴近原有设计语言**使用现有CSS变量和样式模式
- **最小化风格改动**在提升UX的同时保持视觉风格稳定
- **简化优于复杂**:移除不必要的折叠/展开交互
---
## New Design Architecture
### Layout Structure
```
┌─────────────────────────────────────────────────────────────┐
│ Settings [×] │
├──────────────┬──────────────────────────────────────────────┤
│ NAVIGATION │ CONTENT │
│ │ │
│ General → │ ┌─────────────────────────────────────────┐ │
│ Interface │ │ General │ │
│ Download │ │ ═══════════════════════════════════════ │ │
│ Advanced │ │ │ │
│ │ │ ┌─────────────────────────────────────┐ │ │
│ │ │ │ Civitai API Key │ │ │
│ │ │ │ [ ] [?] │ │ │
│ │ │ └─────────────────────────────────────┘ │ │
│ │ │ │ │
│ │ │ ┌─────────────────────────────────────┐ │ │
│ │ │ │ Settings Location │ │ │
│ │ │ │ [/path/to/settings] [Browse] │ │ │
│ │ │ └─────────────────────────────────────┘ │ │
│ │ └─────────────────────────────────────────┘ │
│ │ │
│ │ [Cancel] [Save Changes] │
└──────────────┴──────────────────────────────────────────────┘
```
### Key Design Decisions
#### 1. 移除冗余元素
- ❌ 删除 sidebar 中的 "SETTINGS" label
-**取消折叠/展开功能**(增加交互成本,无实际收益)
- ❌ 不再在左侧导航显示具体设置项(减少认知负荷)
#### 2. 导航简化
- 左侧仅显示 **4个Section**General / Interface / Download / Advanced
- 当前选中项用 accent 色 background highlight
- 无需滚动监听,点击即切换
#### 3. 右侧单Section独占
- 点击左侧导航右侧仅显示该Section的所有设置项
- Section标题作为页面标题大号字体 + accent色下划线
- 所有设置项平铺展示,无需折叠
#### 4. 视觉层次
```
Section Header (20px, bold, accent underline)
├── Setting Group (card container, subtle border)
│ ├── Setting Label (14px, semibold)
│ ├── Setting Description (12px, muted color)
│ └── Setting Control (input/select/toggle)
```
---
## Optimization Phases
### Phase 0: macOS Settings模式重构 (P0)
**Status**: Ready for Development
**Priority**: High
#### Goals
- 重构为两栏布局(左侧导航 + 右侧内容)
- 实现Section级导航切换
- 优化视觉层次和间距
- 移除冗余元素
#### Implementation Details
##### Layout Specifications
| Element | Specification |
|---------|--------------|
| Modal Width | 800px (比原700px稍宽) |
| Modal Height | 600px (固定高度) |
| Left Sidebar | 200px 固定宽度 |
| Right Content | flex: 1自动填充 |
| Content Padding | --space-3 (24px) |
##### Navigation Structure
```
General (通用)
├── Language
├── Civitai API Key
└── Settings Location
Interface (界面)
├── Layout Settings
├── Video Settings
└── Content Filtering
Download (下载)
├── Folder Settings
├── Download Path Templates
├── Example Images
└── Update Flags
Advanced (高级)
├── Priority Tags
├── Auto-organize exclusions
├── Metadata refresh skip paths
├── Metadata Archive Database
├── Proxy Settings
└── Misc
```
##### CSS Style Guide
**Section Header**
```css
.settings-section-header {
font-size: 20px;
font-weight: 600;
padding-bottom: var(--space-2);
border-bottom: 2px solid var(--lora-accent);
margin-bottom: var(--space-3);
}
```
**Setting Group (Card)**
```css
.settings-group {
background: var(--card-bg);
border: 1px solid var(--lora-border);
border-radius: var(--border-radius-sm);
padding: var(--space-3);
margin-bottom: var(--space-3);
}
```
**Setting Item**
```css
.setting-item {
margin-bottom: var(--space-3);
}
.setting-item:last-child {
margin-bottom: 0;
}
.setting-label {
font-size: 14px;
font-weight: 500;
margin-bottom: var(--space-1);
}
.setting-description {
font-size: 12px;
color: var(--text-muted);
margin-bottom: var(--space-2);
}
```
**Sidebar Navigation**
```css
.settings-nav-item {
padding: var(--space-2) var(--space-3);
border-radius: var(--border-radius-xs);
cursor: pointer;
transition: background 0.2s ease;
}
.settings-nav-item:hover {
background: rgba(255, 255, 255, 0.05);
}
.settings-nav-item.active {
background: var(--lora-accent);
color: white;
}
```
#### Files to Modify
1. **static/css/components/modal/settings-modal.css**
- [ ] 新增两栏布局样式
- [ ] 新增侧边栏导航样式
- [ ] 新增Section标题样式
- [ ] 调整设置项卡片样式
- [ ] 移除折叠相关的CSS
2. **templates/components/modals/settings_modal.html**
- [ ] 重构为两栏HTML结构
- [ ] 添加4个导航项
- [ ] 将Section改为独立内容区域
- [ ] 移除折叠按钮HTML
3. **static/js/managers/SettingsManager.js**
- [ ] 添加导航点击切换逻辑
- [ ] 添加Section显示/隐藏控制
- [ ] 移除折叠/展开相关代码
- [ ] 默认显示第一个Section
---
### Phase 1: 搜索功能 (P1)
**Status**: Planned
**Priority**: Medium
#### Goals
- 快速定位特定设置项
- 支持关键词搜索设置标签和描述
#### Implementation
- 搜索框保持在顶部右侧
- 实时过滤显示匹配的Section和设置项
- 高亮匹配的关键词
- 无结果时显示友好提示
---
### Phase 2: 操作按钮优化 (P2)
**Status**: Planned
**Priority**: Low
#### Goals
- 增强功能完整性
- 提供批量操作能力
#### Implementation
- 底部固定操作栏position: sticky
- [Cancel] 和 [Save Changes] 按钮
- 可选:重置为默认、导出配置、导入配置
---
## Migration Notes
### Removed Features
| Feature | Reason |
|---------|--------|
| Section折叠/展开 | 单Section独占显示后不再需要 |
| 滚动监听高亮 | 改为点击切换,无需监听滚动 |
| 长页面平滑滚动 | 内容不再超长,无需滚动 |
| "SETTINGS" label | 冗余信息移除以简化UI |
### Preserved Features
- 所有设置项功能和逻辑
- 表单验证
- 设置项描述和提示
- 原有的CSS变量系统
---
## Success Criteria
### Phase 0
- [ ] Modal显示为两栏布局
- [ ] 左侧显示4个Section导航
- [ ] 点击导航切换右侧显示的Section
- [ ] 当前选中导航项高亮显示
- [ ] Section标题有accent色下划线
- [ ] 设置项以卡片形式分组展示
- [ ] 移除所有折叠/展开功能
- [ ] 移动端响应式正常(单栏堆叠)
- [ ] 所有现有设置功能正常工作
- [ ] 设计风格与原有UI一致
### Phase 1
- [ ] 搜索框可输入关键词
- [ ] 实时过滤显示匹配项
- [ ] 高亮匹配的关键词
### Phase 2
- [ ] 底部有固定操作按钮栏
- [ ] Cancel和Save Changes按钮工作正常
---
## Timeline
| Phase | Estimated Time | Status |
|-------|---------------|--------|
| P0 | 3-4 hours | Ready for Development |
| P1 | 2-3 hours | Planned |
| P2 | 1-2 hours | Planned |
---
## Reference
### Design Inspiration
- **macOS System Settings**: 左侧导航 + 右侧单Section独占
- **VS Code Settings**: 清晰的视觉层次和搜索体验
- **Linear**: 简洁的两栏布局设计
### CSS Variables Reference
```css
/* Colors */
--lora-accent: #007AFF;
--lora-border: rgba(255, 255, 255, 0.1);
--card-bg: rgba(255, 255, 255, 0.05);
--text-color: #ffffff;
--text-muted: rgba(255, 255, 255, 0.6);
/* Spacing */
--space-1: 8px;
--space-2: 12px;
--space-3: 16px;
--space-4: 24px;
/* Border Radius */
--border-radius-xs: 4px;
--border-radius-sm: 8px;
```
---
**Last Updated**: 2025-02-24
**Author**: AI Assistant
**Status**: Ready for Implementation

View File

@@ -0,0 +1,191 @@
# Settings Modal Optimization Progress
**Project**: Settings Modal UI/UX Optimization
**Status**: Phase 0 - Ready for Development
**Last Updated**: 2025-02-24
---
## Phase 0: macOS Settings模式重构
### Overview
重构Settings Modal为macOS Settings模式左侧Section导航 + 右侧单Section独占显示。移除冗余元素优化视觉层次。
### Tasks
#### 1. CSS Updates ✅
**File**: `static/css/components/modal/settings-modal.css`
- [x] **Layout Styles**
- [x] Modal固定尺寸 800x600px
- [x] 左侧 sidebar 固定宽度 200px
- [x] 右侧 content flex: 1 自动填充
- [x] **Navigation Styles**
- [x] `.settings-nav` 容器样式
- [x] `.settings-nav-item` 基础样式更大字体更醒目的active状态
- [x] `.settings-nav-item.active` 高亮样式accent背景
- [x] `.settings-nav-item:hover` 悬停效果
- [x] 隐藏 "SETTINGS" label
- [x] 隐藏 group titles
- [x] **Content Area Styles**
- [x] `.settings-section` 默认隐藏(仅当前显示)
- [x] `.settings-section.active` 显示状态
- [x] `.settings-section-header` 标题样式20px + accent下划线
- [x] 添加 fadeIn 动画效果
- [x] **Cleanup**
- [x] 移除折叠相关样式
- [x] 移除 `.settings-section-toggle` 按钮样式
- [x] 移除展开/折叠动画样式
**Status**: ✅ Completed
---
#### 2. HTML Structure Update ✅
**File**: `templates/components/modals/settings_modal.html`
- [x] **Navigation Items**
- [x] General (通用)
- [x] Interface (界面)
- [x] Download (下载)
- [x] Advanced (高级)
- [x] 移除 "SETTINGS" label
- [x] 移除 group titles
- [x] **Content Sections**
- [x] 重组为4个Section (general/interface/download/advanced)
- [x] 每个section添加 `data-section` 属性
- [x] 添加Section标题带accent下划线
- [x] 移除所有折叠按钮chevron图标
- [x] 平铺显示所有设置项
**Status**: ✅ Completed
---
#### 3. JavaScript Logic Update ✅
**File**: `static/js/managers/SettingsManager.js`
- [x] **Navigation Logic**
- [x] `initializeNavigation()` 改为Section切换模式
- [x] 点击导航项显示对应Section
- [x] 更新导航高亮状态
- [x] 默认显示第一个Section
- [x] **Remove Legacy Code**
- [x] 移除 `initializeSectionCollapse()` 方法
- [x] 移除滚动监听相关代码
- [x] 移除 `localStorage` 折叠状态存储
- [x] **Search Function**
- [x] 更新搜索功能以适配新显示模式
- [x] 搜索时自动切换到匹配的Section
- [x] 高亮匹配的关键词
**Status**: ✅ Completed
---
### Testing Checklist
#### Visual Testing
- [ ] 两栏布局正确显示
- [ ] 左侧导航4个Section正确显示
- [ ] 点击导航切换右侧内容
- [ ] 当前导航项高亮显示accent背景
- [ ] Section标题有accent色下划线
- [ ] 设置项以卡片形式分组
- [ ] 无"SETTINGS" label
- [ ] 无折叠/展开按钮
#### Functional Testing
- [ ] 所有设置项可正常编辑
- [ ] 设置保存功能正常
- [ ] 设置加载功能正常
- [ ] 表单验证正常工作
- [ ] 帮助提示tooltip正常显示
#### Responsive Testing
- [ ] 桌面端(>768px两栏布局
- [ ] 移动端(<768px单栏堆叠
- [ ] 移动端导航可正常切换
#### Cross-Browser Testing
- [ ] Chrome/Edge
- [ ] Firefox
- [ ] Safari如适用
---
## Phase 1: 搜索功能
### Tasks
- [ ] 搜索框UI更新
- [ ] 搜索逻辑实现
- [ ] 实时过滤显示
- [ ] 关键词高亮
**Estimated Time**: 2-3 hours
**Status**: 📋 Planned
---
## Phase 2: 操作按钮优化
### Tasks
- [ ] 底部操作栏样式
- [ ] 固定定位sticky
- [ ] Cancel/Save按钮功能
- [ ] 可选Reset/Export/Import
**Estimated Time**: 1-2 hours
**Status**: 📋 Planned
---
## Progress Summary
| Phase | Progress | Status |
|-------|----------|--------|
| Phase 0 | 100% | Completed |
| Phase 1 | 0% | 📋 Planned |
| Phase 2 | 0% | 📋 Planned |
**Overall Progress**: 100% (Phase 0)
---
## Development Log
### 2025-02-24
- 创建优化提案文档macOS Settings模式
- 创建进度追踪文档
- Phase 0 开发完成
- CSS重构完成新增macOS Settings样式移除折叠相关样式
- HTML重构完成重组为4个Section移除所有折叠按钮
- JavaScript重构完成实现Section切换逻辑更新搜索功能
---
## Notes
### Design Decisions
- 采用macOS Settings模式而非长页面滚动模式
- 左侧仅显示4个Section不显示具体设置项
- 移除折叠/展开功能简化交互
- Section标题使用accent色下划线强调
### Technical Notes
- 优先使用现有CSS变量
- 保持向后兼容不破坏现有设置存储逻辑
- 移动端响应式小屏幕单栏堆叠
### Blockers
None
---
**Next Action**: Start Phase 0 - CSS Updates

View File

@@ -258,17 +258,27 @@
"contentFiltering": "Inhaltsfilterung",
"videoSettings": "Video-Einstellungen",
"layoutSettings": "Layout-Einstellungen",
"folderSettings": "Ordner-Einstellungen",
"priorityTags": "Prioritäts-Tags",
"downloadPathTemplates": "Download-Pfad-Vorlagen",
"exampleImages": "Beispielbilder",
"updateFlags": "Update-Markierungen",
"autoOrganize": "Auto-organize",
"misc": "Verschiedenes",
"metadataArchive": "Metadaten-Archiv-Datenbank",
"storageLocation": "Einstellungsort",
"folderSettings": "Standard-Roots",
"extraFolderPaths": "Zusätzliche Ordnerpfade",
"downloadPathTemplates": "Download-Pfad-Vorlagen",
"priorityTags": "Prioritäts-Tags",
"updateFlags": "Update-Markierungen",
"exampleImages": "Beispielbilder",
"autoOrganize": "Auto-Organisierung",
"metadata": "Metadaten",
"proxySettings": "Proxy-Einstellungen"
},
"nav": {
"general": "Allgemein",
"interface": "Oberfläche",
"library": "Bibliothek"
},
"search": {
"placeholder": "Einstellungen durchsuchen...",
"clear": "Suche löschen",
"noResults": "Keine Einstellungen gefunden für \"{query}\""
},
"storage": {
"locationLabel": "Portabler Modus",
"locationHelp": "Aktiviere, um settings.json im Repository zu belassen; deaktiviere, um es im Benutzerkonfigurationsordner zu speichern."
@@ -341,13 +351,13 @@
"activeLibraryHelp": "Zwischen den konfigurierten Bibliotheken wechseln, um die Standardordner zu aktualisieren. Eine Änderung der Auswahl lädt die Seite neu.",
"loadingLibraries": "Bibliotheken werden geladen...",
"noLibraries": "Keine Bibliotheken konfiguriert",
"defaultLoraRoot": "Standard-LoRA-Stammordner",
"defaultLoraRoot": "LoRA-Stammordner",
"defaultLoraRootHelp": "Legen Sie den Standard-LoRA-Stammordner für Downloads, Importe und Verschiebungen fest",
"defaultCheckpointRoot": "Standard-Checkpoint-Stammordner",
"defaultCheckpointRoot": "Checkpoint-Stammordner",
"defaultCheckpointRootHelp": "Legen Sie den Standard-Checkpoint-Stammordner für Downloads, Importe und Verschiebungen fest",
"defaultUnetRoot": "Standard-Diffusion-Modell-Stammordner",
"defaultUnetRoot": "Diffusion-Modell-Stammordner",
"defaultUnetRootHelp": "Legen Sie den Standard-Diffusion-Modell-(UNET)-Stammordner für Downloads, Importe und Verschiebungen fest",
"defaultEmbeddingRoot": "Standard-Embedding-Stammordner",
"defaultEmbeddingRoot": "Embedding-Stammordner",
"defaultEmbeddingRootHelp": "Legen Sie den Standard-Embedding-Stammordner für Downloads, Importe und Verschiebungen fest",
"noDefault": "Kein Standard"
},
@@ -475,6 +485,23 @@
"proxyPassword": "Passwort (optional)",
"proxyPasswordPlaceholder": "passwort",
"proxyPasswordHelp": "Passwort für die Proxy-Authentifizierung (falls erforderlich)"
},
"extraFolderPaths": {
"title": "Zusätzliche Ordnerpfade",
"help": "Fügen Sie zusätzliche Modellordner außerhalb der Standardpfade von ComfyUI hinzu. Diese Pfade werden separat gespeichert und zusammen mit den Standardordnern gescannt.",
"description": "Konfigurieren Sie zusätzliche Ordner zum Scannen von Modellen. Diese Pfade sind spezifisch für LoRA Manager und werden mit den Standardpfaden von ComfyUI zusammengeführt.",
"modelTypes": {
"lora": "LoRA-Pfade",
"checkpoint": "Checkpoint-Pfade",
"unet": "Diffusionsmodell-Pfade",
"embedding": "Embedding-Pfade"
},
"pathPlaceholder": "/pfad/zu/extra/modellen",
"saveSuccess": "Zusätzliche Ordnerpfade aktualisiert.",
"saveError": "Fehler beim Aktualisieren der zusätzlichen Ordnerpfade: {message}",
"validation": {
"duplicatePath": "Dieser Pfad ist bereits konfiguriert"
}
}
},
"loras": {
@@ -1624,4 +1651,4 @@
"retry": "Wiederholen"
}
}
}
}

View File

@@ -258,17 +258,27 @@
"contentFiltering": "Content Filtering",
"videoSettings": "Video Settings",
"layoutSettings": "Layout Settings",
"folderSettings": "Folder Settings",
"priorityTags": "Priority Tags",
"misc": "Miscellaneous",
"folderSettings": "Default Roots",
"extraFolderPaths": "Extra Folder Paths",
"downloadPathTemplates": "Download Path Templates",
"exampleImages": "Example Images",
"priorityTags": "Priority Tags",
"updateFlags": "Update Flags",
"exampleImages": "Example Images",
"autoOrganize": "Auto-organize",
"misc": "Misc.",
"metadataArchive": "Metadata Archive Database",
"storageLocation": "Settings Location",
"metadata": "Metadata",
"proxySettings": "Proxy Settings"
},
"nav": {
"general": "General",
"interface": "Interface",
"library": "Library"
},
"search": {
"placeholder": "Search settings...",
"clear": "Clear search",
"noResults": "No settings found matching \"{query}\""
},
"storage": {
"locationLabel": "Portable mode",
"locationHelp": "Enable to keep settings.json inside the repository; disable to store it in your user config directory."
@@ -341,16 +351,33 @@
"activeLibraryHelp": "Switch between configured libraries to update default folders. Changing the selection reloads the page.",
"loadingLibraries": "Loading libraries...",
"noLibraries": "No libraries configured",
"defaultLoraRoot": "Default LoRA Root",
"defaultLoraRoot": "LoRA Root",
"defaultLoraRootHelp": "Set default LoRA root directory for downloads, imports and moves",
"defaultCheckpointRoot": "Default Checkpoint Root",
"defaultCheckpointRoot": "Checkpoint Root",
"defaultCheckpointRootHelp": "Set default checkpoint root directory for downloads, imports and moves",
"defaultUnetRoot": "Default Diffusion Model Root",
"defaultUnetRoot": "Diffusion Model Root",
"defaultUnetRootHelp": "Set default diffusion model (UNET) root directory for downloads, imports and moves",
"defaultEmbeddingRoot": "Default Embedding Root",
"defaultEmbeddingRoot": "Embedding Root",
"defaultEmbeddingRootHelp": "Set default embedding root directory for downloads, imports and moves",
"noDefault": "No Default"
},
"extraFolderPaths": {
"title": "Extra Folder Paths",
"help": "Add additional model folders outside of ComfyUI's standard paths. These paths are stored separately and scanned alongside the default folders.",
"description": "Configure additional folders to scan for models. These paths are specific to LoRA Manager and will be merged with ComfyUI's default paths.",
"modelTypes": {
"lora": "LoRA Paths",
"checkpoint": "Checkpoint Paths",
"unet": "Diffusion Model Paths",
"embedding": "Embedding Paths"
},
"pathPlaceholder": "/path/to/extra/models",
"saveSuccess": "Extra folder paths updated.",
"saveError": "Failed to update extra folder paths: {message}",
"validation": {
"duplicatePath": "This path is already configured"
}
},
"priorityTags": {
"title": "Priority Tags",
"description": "Customize the tag priority order for each model type (e.g., character, concept, style(toon|toon_style))",

View File

@@ -258,17 +258,27 @@
"contentFiltering": "Filtrado de contenido",
"videoSettings": "Configuración de video",
"layoutSettings": "Configuración de diseño",
"folderSettings": "Configuración de carpetas",
"priorityTags": "Etiquetas prioritarias",
"downloadPathTemplates": "Plantillas de rutas de descarga",
"exampleImages": "Imágenes de ejemplo",
"updateFlags": "Indicadores de actualización",
"autoOrganize": "Auto-organize",
"misc": "Varios",
"metadataArchive": "Base de datos de archivo de metadatos",
"storageLocation": "Ubicación de ajustes",
"folderSettings": "Raíces predeterminadas",
"extraFolderPaths": "Rutas de carpetas adicionales",
"downloadPathTemplates": "Plantillas de rutas de descarga",
"priorityTags": "Etiquetas prioritarias",
"updateFlags": "Indicadores de actualización",
"exampleImages": "Imágenes de ejemplo",
"autoOrganize": "Organización automática",
"metadata": "Metadatos",
"proxySettings": "Configuración de proxy"
},
"nav": {
"general": "General",
"interface": "Interfaz",
"library": "Biblioteca"
},
"search": {
"placeholder": "Buscar ajustes...",
"clear": "Limpiar búsqueda",
"noResults": "No se encontraron ajustes que coincidan con \"{query}\""
},
"storage": {
"locationLabel": "Modo portátil",
"locationHelp": "Activa para mantener settings.json dentro del repositorio; desactívalo para guardarlo en tu directorio de configuración de usuario."
@@ -341,13 +351,13 @@
"activeLibraryHelp": "Alterna entre las bibliotecas configuradas para actualizar las carpetas predeterminadas. Cambiar la selección recarga la página.",
"loadingLibraries": "Cargando bibliotecas...",
"noLibraries": "No hay bibliotecas configuradas",
"defaultLoraRoot": "Raíz predeterminada de LoRA",
"defaultLoraRoot": "Raíz de LoRA",
"defaultLoraRootHelp": "Establecer el directorio raíz predeterminado de LoRA para descargas, importaciones y movimientos",
"defaultCheckpointRoot": "Raíz predeterminada de checkpoint",
"defaultCheckpointRoot": "Raíz de checkpoint",
"defaultCheckpointRootHelp": "Establecer el directorio raíz predeterminado de checkpoint para descargas, importaciones y movimientos",
"defaultUnetRoot": "Raíz predeterminada de Diffusion Model",
"defaultUnetRoot": "Raíz de Diffusion Model",
"defaultUnetRootHelp": "Establecer el directorio raíz predeterminado de Diffusion Model (UNET) para descargas, importaciones y movimientos",
"defaultEmbeddingRoot": "Raíz predeterminada de embedding",
"defaultEmbeddingRoot": "Raíz de embedding",
"defaultEmbeddingRootHelp": "Establecer el directorio raíz predeterminado de embedding para descargas, importaciones y movimientos",
"noDefault": "Sin predeterminado"
},
@@ -475,6 +485,23 @@
"proxyPassword": "Contraseña (opcional)",
"proxyPasswordPlaceholder": "contraseña",
"proxyPasswordHelp": "Contraseña para autenticación de proxy (si es necesario)"
},
"extraFolderPaths": {
"title": "Rutas de carpetas adicionales",
"help": "Agregue carpetas de modelos adicionales fuera de las rutas estándar de ComfyUI. Estas rutas se almacenan por separado y se escanean junto con las carpetas predeterminadas.",
"description": "Configure carpetas adicionales para escanear modelos. Estas rutas son específicas de LoRA Manager y se fusionarán con las rutas predeterminadas de ComfyUI.",
"modelTypes": {
"lora": "Rutas de LoRA",
"checkpoint": "Rutas de Checkpoint",
"unet": "Rutas de modelo de difusión",
"embedding": "Rutas de Embedding"
},
"pathPlaceholder": "/ruta/a/modelos/extra",
"saveSuccess": "Rutas de carpetas adicionales actualizadas.",
"saveError": "Error al actualizar las rutas de carpetas adicionales: {message}",
"validation": {
"duplicatePath": "Esta ruta ya está configurada"
}
}
},
"loras": {
@@ -1624,4 +1651,4 @@
"retry": "Reintentar"
}
}
}
}

View File

@@ -258,17 +258,27 @@
"contentFiltering": "Filtrage du contenu",
"videoSettings": "Paramètres vidéo",
"layoutSettings": "Paramètres d'affichage",
"folderSettings": "Paramètres des dossiers",
"priorityTags": "Étiquettes prioritaires",
"downloadPathTemplates": "Modèles de chemin de téléchargement",
"exampleImages": "Images d'exemple",
"updateFlags": "Indicateurs de mise à jour",
"autoOrganize": "Auto-organize",
"misc": "Divers",
"metadataArchive": "Base de données d'archive des métadonnées",
"storageLocation": "Emplacement des paramètres",
"folderSettings": "Racines par défaut",
"extraFolderPaths": "Chemins de dossiers supplémentaires",
"downloadPathTemplates": "Modèles de chemin de téléchargement",
"priorityTags": "Étiquettes prioritaires",
"updateFlags": "Indicateurs de mise à jour",
"exampleImages": "Images d'exemple",
"autoOrganize": "Organisation automatique",
"metadata": "Métadonnées",
"proxySettings": "Paramètres du proxy"
},
"nav": {
"general": "Général",
"interface": "Interface",
"library": "Bibliothèque"
},
"search": {
"placeholder": "Rechercher dans les paramètres...",
"clear": "Effacer la recherche",
"noResults": "Aucun paramètre trouvé correspondant à \"{query}\""
},
"storage": {
"locationLabel": "Mode portable",
"locationHelp": "Activez pour garder settings.json dans le dépôt ; désactivez pour le placer dans votre dossier de configuration utilisateur."
@@ -341,13 +351,13 @@
"activeLibraryHelp": "Basculer entre les bibliothèques configurées pour mettre à jour les dossiers par défaut. Changer la sélection recharge la page.",
"loadingLibraries": "Chargement des bibliothèques...",
"noLibraries": "Aucune bibliothèque configurée",
"defaultLoraRoot": "Racine LoRA par défaut",
"defaultLoraRoot": "Racine LoRA",
"defaultLoraRootHelp": "Définir le répertoire racine LoRA par défaut pour les téléchargements, imports et déplacements",
"defaultCheckpointRoot": "Racine Checkpoint par défaut",
"defaultCheckpointRoot": "Racine Checkpoint",
"defaultCheckpointRootHelp": "Définir le répertoire racine checkpoint par défaut pour les téléchargements, imports et déplacements",
"defaultUnetRoot": "Racine Diffusion Model par défaut",
"defaultUnetRoot": "Racine Diffusion Model",
"defaultUnetRootHelp": "Définir le répertoire racine Diffusion Model (UNET) par défaut pour les téléchargements, imports et déplacements",
"defaultEmbeddingRoot": "Racine Embedding par défaut",
"defaultEmbeddingRoot": "Racine Embedding",
"defaultEmbeddingRootHelp": "Définir le répertoire racine embedding par défaut pour les téléchargements, imports et déplacements",
"noDefault": "Aucun par défaut"
},
@@ -475,6 +485,23 @@
"proxyPassword": "Mot de passe (optionnel)",
"proxyPasswordPlaceholder": "mot_de_passe",
"proxyPasswordHelp": "Mot de passe pour l'authentification proxy (si nécessaire)"
},
"extraFolderPaths": {
"title": "Chemins de dossiers supplémentaires",
"help": "Ajoutez des dossiers de modèles supplémentaires en dehors des chemins standard de ComfyUI. Ces chemins sont stockés séparément et analysés aux côtés des dossiers par défaut.",
"description": "Configurez des dossiers supplémentaires pour l'analyse de modèles. Ces chemins sont spécifiques à LoRA Manager et seront fusionnés avec les chemins par défaut de ComfyUI.",
"modelTypes": {
"lora": "Chemins LoRA",
"checkpoint": "Chemins Checkpoint",
"unet": "Chemins de modèle de diffusion",
"embedding": "Chemins Embedding"
},
"pathPlaceholder": "/chemin/vers/modèles/supplémentaires",
"saveSuccess": "Chemins de dossiers supplémentaires mis à jour.",
"saveError": "Échec de la mise à jour des chemins de dossiers supplémentaires: {message}",
"validation": {
"duplicatePath": "Ce chemin est déjà configuré"
}
}
},
"loras": {
@@ -1624,4 +1651,4 @@
"retry": "Réessayer"
}
}
}
}

View File

@@ -258,17 +258,27 @@
"contentFiltering": "סינון תוכן",
"videoSettings": "הגדרות וידאו",
"layoutSettings": "הגדרות פריסה",
"folderSettings": "הגדרות תיקייה",
"priorityTags": "תגיות עדיפות",
"downloadPathTemplates": "תבניות נתיב הורדה",
"exampleImages": "תמונות דוגמה",
"updateFlags": "תגי עדכון",
"autoOrganize": "Auto-organize",
"misc": "שונות",
"metadataArchive": "מסד נתונים של ארכיון מטא-דאטה",
"storageLocation": "מיקום ההגדרות",
"folderSettings": "תיקיות ברירת מחדל",
"extraFolderPaths": "נתיבי תיקיות נוספים",
"downloadPathTemplates": "תבניות נתיב הורדה",
"priorityTags": "תגיות עדיפות",
"updateFlags": "תגי עדכון",
"exampleImages": "תמונות דוגמה",
"autoOrganize": "ארגון אוטומטי",
"metadata": "מטא-נתונים",
"proxySettings": "הגדרות פרוקסי"
},
"nav": {
"general": "כללי",
"interface": "ממשק",
"library": "ספרייה"
},
"search": {
"placeholder": "חיפוש בהגדרות...",
"clear": "נקה חיפוש",
"noResults": "לא נמצאו הגדרות תואמות ל-\"{query}\""
},
"storage": {
"locationLabel": "מצב נייד",
"locationHelp": "הפעל כדי לשמור את settings.json בתוך המאגר; בטל כדי לשמור אותו בתיקיית ההגדרות של המשתמש."
@@ -341,13 +351,13 @@
"activeLibraryHelp": "החלפה בין הספריות המוגדרות לעדכן את תיקיות ברירת המחדל. שינוי הבחירה ירענן את הדף.",
"loadingLibraries": "טוען ספריות...",
"noLibraries": "לא הוגדרו ספריות",
"defaultLoraRoot": "תיקיית שורש ברירת מחדל של LoRA",
"defaultLoraRoot": "תיקיית שורש LoRA",
"defaultLoraRootHelp": "הגדר את ספריית השורש המוגדרת כברירת מחדל של LoRA להורדות, ייבוא והעברות",
"defaultCheckpointRoot": "תיקיית שורש ברירת מחדל של Checkpoint",
"defaultCheckpointRoot": "תיקיית שורש Checkpoint",
"defaultCheckpointRootHelp": "הגדר את ספריית השורש המוגדרת כברירת מחדל של checkpoint להורדות, ייבוא והעברות",
"defaultUnetRoot": "תיקיית שורש ברירת מחדל של Diffusion Model",
"defaultUnetRoot": "תיקיית שורש Diffusion Model",
"defaultUnetRootHelp": "הגדר את ספריית השורש המוגדרת כברירת מחדל של Diffusion Model (UNET) להורדות, ייבוא והעברות",
"defaultEmbeddingRoot": "תיקיית שורש ברירת מחדל של Embedding",
"defaultEmbeddingRoot": "תיקיית שורש Embedding",
"defaultEmbeddingRootHelp": "הגדר את ספריית השורש המוגדרת כברירת מחדל של embedding להורדות, ייבוא והעברות",
"noDefault": "אין ברירת מחדל"
},
@@ -475,6 +485,23 @@
"proxyPassword": "סיסמה (אופציונלי)",
"proxyPasswordPlaceholder": "password",
"proxyPasswordHelp": "סיסמה לאימות מול הפרוקסי (אם נדרש)"
},
"extraFolderPaths": {
"title": "נתיבי תיקיות נוספים",
"help": "הוסף תיקיות מודלים נוספות מחוץ לנתיבים הסטנדרטיים של ComfyUI. נתיבים אלה נשמרים בנפרד ונסרקים לצד תיקיות ברירת המחדל.",
"description": "הגדר תיקיות נוספות לסריקת מודלים. נתיבים אלה ספציפיים ל-LoRA Manager וימוזגו עם נתיבי ברירת המחדל של ComfyUI.",
"modelTypes": {
"lora": "נתיבי LoRA",
"checkpoint": "נתיבי Checkpoint",
"unet": "נתיבי מודל דיפוזיה",
"embedding": "נתיבי Embedding"
},
"pathPlaceholder": "/נתיב/למודלים/נוספים",
"saveSuccess": "נתיבי תיקיות נוספים עודכנו.",
"saveError": "נכשל בעדכון נתיבי תיקיות נוספים: {message}",
"validation": {
"duplicatePath": "נתיב זה כבר מוגדר"
}
}
},
"loras": {
@@ -1624,4 +1651,4 @@
"retry": "נסה שוב"
}
}
}
}

View File

@@ -258,17 +258,27 @@
"contentFiltering": "コンテンツフィルタリング",
"videoSettings": "動画設定",
"layoutSettings": "レイアウト設定",
"folderSettings": "フォルダ設定",
"priorityTags": "優先タグ",
"downloadPathTemplates": "ダウンロードパステンプレート",
"exampleImages": "例画像",
"updateFlags": "アップデートフラグ",
"autoOrganize": "Auto-organize",
"misc": "その他",
"metadataArchive": "メタデータアーカイブデータベース",
"storageLocation": "設定の場所",
"folderSettings": "デフォルトルート",
"extraFolderPaths": "追加フォルダーパス",
"downloadPathTemplates": "ダウンロードパステンプレート",
"priorityTags": "優先タグ",
"updateFlags": "アップデートフラグ",
"exampleImages": "例画像",
"autoOrganize": "自動整理",
"metadata": "メタデータ",
"proxySettings": "プロキシ設定"
},
"nav": {
"general": "一般",
"interface": "インターフェース",
"library": "ライブラリ"
},
"search": {
"placeholder": "設定を検索...",
"clear": "検索をクリア",
"noResults": "\"{query}\" に一致する設定が見つかりません"
},
"storage": {
"locationLabel": "ポータブルモード",
"locationHelp": "有効にすると settings.json をリポジトリ内に保持し、無効にするとユーザー設定ディレクトリに格納します。"
@@ -341,13 +351,13 @@
"activeLibraryHelp": "設定済みのライブラリを切り替えてデフォルトのフォルダを更新します。選択を変更するとページが再読み込みされます。",
"loadingLibraries": "ライブラリを読み込み中...",
"noLibraries": "ライブラリが設定されていません",
"defaultLoraRoot": "デフォルトLoRAルート",
"defaultLoraRoot": "LoRAルート",
"defaultLoraRootHelp": "ダウンロード、インポート、移動用のデフォルトLoRAルートディレクトリを設定",
"defaultCheckpointRoot": "デフォルトCheckpointルート",
"defaultCheckpointRoot": "Checkpointルート",
"defaultCheckpointRootHelp": "ダウンロード、インポート、移動用のデフォルトcheckpointルートディレクトリを設定",
"defaultUnetRoot": "デフォルトDiffusion Modelルート",
"defaultUnetRoot": "Diffusion Modelルート",
"defaultUnetRootHelp": "ダウンロード、インポート、移動用のデフォルトDiffusion Model (UNET)ルートディレクトリを設定",
"defaultEmbeddingRoot": "デフォルトEmbeddingルート",
"defaultEmbeddingRoot": "Embeddingルート",
"defaultEmbeddingRootHelp": "ダウンロード、インポート、移動用のデフォルトembeddingルートディレクトリを設定",
"noDefault": "デフォルトなし"
},
@@ -475,6 +485,23 @@
"proxyPassword": "パスワード(任意)",
"proxyPasswordPlaceholder": "パスワード",
"proxyPasswordHelp": "プロキシ認証用のパスワード(必要な場合)"
},
"extraFolderPaths": {
"title": "追加フォルダーパス",
"help": "ComfyUIの標準パスの外部に追加のモデルフォルダを追加します。これらのパスは別々に保存され、デフォルトのフォルダと一緒にスキャンされます。",
"description": "モデルをスキャンするための追加フォルダを設定します。これらのパスはLoRA Manager固有であり、ComfyUIのデフォルトパスとマージされます。",
"modelTypes": {
"lora": "LoRAパス",
"checkpoint": "Checkpointパス",
"unet": "Diffusionモデルパス",
"embedding": "Embeddingパス"
},
"pathPlaceholder": "/追加モデルへのパス",
"saveSuccess": "追加フォルダーパスを更新しました。",
"saveError": "追加フォルダーパスの更新に失敗しました: {message}",
"validation": {
"duplicatePath": "このパスはすでに設定されています"
}
}
},
"loras": {
@@ -1624,4 +1651,4 @@
"retry": "再試行"
}
}
}
}

View File

@@ -258,17 +258,27 @@
"contentFiltering": "콘텐츠 필터링",
"videoSettings": "비디오 설정",
"layoutSettings": "레이아웃 설정",
"folderSettings": "폴더 설정",
"priorityTags": "우선순위 태그",
"downloadPathTemplates": "다운로드 경로 템플릿",
"exampleImages": "예시 이미지",
"updateFlags": "업데이트 표시",
"autoOrganize": "Auto-organize",
"misc": "기타",
"metadataArchive": "메타데이터 아카이브 데이터베이스",
"storageLocation": "설정 위치",
"folderSettings": "기본 루트",
"extraFolderPaths": "추가 폴다 경로",
"downloadPathTemplates": "다운로드 경로 템플릿",
"priorityTags": "우선순위 태그",
"updateFlags": "업데이트 표시",
"exampleImages": "예시 이미지",
"autoOrganize": "자동 정리",
"metadata": "메타데이터",
"proxySettings": "프록시 설정"
},
"nav": {
"general": "일반",
"interface": "인터페이스",
"library": "라이브러리"
},
"search": {
"placeholder": "설정 검색...",
"clear": "검색 지우기",
"noResults": "\"{query}\"와 일치하는 설정을 찾을 수 없습니다"
},
"storage": {
"locationLabel": "휴대용 모드",
"locationHelp": "활성화하면 settings.json을 리포지토리에 유지하고, 비활성화하면 사용자 구성 디렉터리에 저장합니다."
@@ -341,13 +351,13 @@
"activeLibraryHelp": "구성된 라이브러리를 전환하여 기본 폴더를 업데이트합니다. 선택을 변경하면 페이지가 다시 로드됩니다.",
"loadingLibraries": "라이브러리를 불러오는 중...",
"noLibraries": "구성된 라이브러리가 없습니다",
"defaultLoraRoot": "기본 LoRA 루트",
"defaultLoraRoot": "LoRA 루트",
"defaultLoraRootHelp": "다운로드, 가져오기 및 이동을 위한 기본 LoRA 루트 디렉토리를 설정합니다",
"defaultCheckpointRoot": "기본 Checkpoint 루트",
"defaultCheckpointRoot": "Checkpoint 루트",
"defaultCheckpointRootHelp": "다운로드, 가져오기 및 이동을 위한 기본 Checkpoint 루트 디렉토리를 설정합니다",
"defaultUnetRoot": "기본 Diffusion Model 루트",
"defaultUnetRoot": "Diffusion Model 루트",
"defaultUnetRootHelp": "다운로드, 가져오기 및 이동을 위한 기본 Diffusion Model (UNET) 루트 디렉토리를 설정합니다",
"defaultEmbeddingRoot": "기본 Embedding 루트",
"defaultEmbeddingRoot": "Embedding 루트",
"defaultEmbeddingRootHelp": "다운로드, 가져오기 및 이동을 위한 기본 Embedding 루트 디렉토리를 설정합니다",
"noDefault": "기본값 없음"
},
@@ -475,6 +485,23 @@
"proxyPassword": "비밀번호 (선택사항)",
"proxyPasswordPlaceholder": "password",
"proxyPasswordHelp": "프록시 인증에 필요한 비밀번호 (필요한 경우)"
},
"extraFolderPaths": {
"title": "추가 폴다 경로",
"help": "ComfyUI의 표준 경로 외부에 추가 모델 폴드를 추가하세요. 이러한 경로는 별도로 저장되며 기본 폴와 함께 스캔됩니다.",
"description": "모델을 스캔하기 위한 추가 폴를 설정하세요. 이러한 경로는 LoRA Manager 특유의 것이며 ComfyUI의 기본 경로와 병합됩니다.",
"modelTypes": {
"lora": "LoRA 경로",
"checkpoint": "Checkpoint 경로",
"unet": "Diffusion 모델 경로",
"embedding": "Embedding 경로"
},
"pathPlaceholder": "/추가/모델/경로",
"saveSuccess": "추가 폴다 경로가 업데이트되었습니다.",
"saveError": "추가 폴다 경로 업데이트 실패: {message}",
"validation": {
"duplicatePath": "이 경로는 이미 구성되어 있습니다"
}
}
},
"loras": {

View File

@@ -258,17 +258,27 @@
"contentFiltering": "Фильтрация контента",
"videoSettings": "Настройки видео",
"layoutSettings": "Настройки макета",
"folderSettings": "Настройки папок",
"priorityTags": "Приоритетные теги",
"downloadPathTemplates": "Шаблоны путей загрузки",
"exampleImages": "Примеры изображений",
"updateFlags": "Метки обновлений",
"autoOrganize": "Auto-organize",
"misc": "Разное",
"metadataArchive": "Архив метаданных",
"storageLocation": "Расположение настроек",
"folderSettings": "Корневые папки",
"extraFolderPaths": "Дополнительные пути к папкам",
"downloadPathTemplates": "Шаблоны путей загрузки",
"priorityTags": "Приоритетные теги",
"updateFlags": "Метки обновлений",
"exampleImages": "Примеры изображений",
"autoOrganize": "Автоорганизация",
"metadata": "Метаданные",
"proxySettings": "Настройки прокси"
},
"nav": {
"general": "Общее",
"interface": "Интерфейс",
"library": "Библиотека"
},
"search": {
"placeholder": "Поиск в настройках...",
"clear": "Очистить поиск",
"noResults": "Настройки, соответствующие \"{query}\", не найдены"
},
"storage": {
"locationLabel": "Портативный режим",
"locationHelp": "Включите, чтобы хранить settings.json в репозитории; выключите, чтобы сохранить его в папке конфигурации пользователя."
@@ -341,13 +351,13 @@
"activeLibraryHelp": "Переключайтесь между настроенными библиотеками, чтобы обновить папки по умолчанию. Изменение выбора перезагружает страницу.",
"loadingLibraries": "Загрузка библиотек...",
"noLibraries": "Библиотеки не настроены",
"defaultLoraRoot": "Корневая папка LoRA по умолчанию",
"defaultLoraRoot": "Корневая папка LoRA",
"defaultLoraRootHelp": "Установить корневую папку LoRA по умолчанию для загрузок, импорта и перемещений",
"defaultCheckpointRoot": "Корневая папка Checkpoint по умолчанию",
"defaultCheckpointRoot": "Корневая папка Checkpoint",
"defaultCheckpointRootHelp": "Установить корневую папку checkpoint по умолчанию для загрузок, импорта и перемещений",
"defaultUnetRoot": "Корневая папка Diffusion Model по умолчанию",
"defaultUnetRoot": "Корневая папка Diffusion Model",
"defaultUnetRootHelp": "Установить корневую папку Diffusion Model (UNET) по умолчанию для загрузок, импорта и перемещений",
"defaultEmbeddingRoot": "Корневая папка Embedding по умолчанию",
"defaultEmbeddingRoot": "Корневая папка Embedding",
"defaultEmbeddingRootHelp": "Установить корневую папку embedding по умолчанию для загрузок, импорта и перемещений",
"noDefault": "Не задано"
},
@@ -475,6 +485,23 @@
"proxyPassword": "Пароль (необязательно)",
"proxyPasswordPlaceholder": "пароль",
"proxyPasswordHelp": "Пароль для аутентификации на прокси (если требуется)"
},
"extraFolderPaths": {
"title": "Дополнительные пути к папкам",
"help": "Добавьте дополнительные папки моделей за пределами стандартных путей ComfyUI. Эти пути хранятся отдельно и сканируются вместе с папками по умолчанию.",
"description": "Настройте дополнительные папки для сканирования моделей. Эти пути специфичны для LoRA Manager и будут объединены с путями по умолчанию ComfyUI.",
"modelTypes": {
"lora": "Пути LoRA",
"checkpoint": "Пути Checkpoint",
"unet": "Пути моделей диффузии",
"embedding": "Пути Embedding"
},
"pathPlaceholder": "/путь/к/дополнительным/моделям",
"saveSuccess": "Дополнительные пути к папкам обновлены.",
"saveError": "Не удалось обновить дополнительные пути к папкам: {message}",
"validation": {
"duplicatePath": "Этот путь уже настроен"
}
}
},
"loras": {
@@ -1624,4 +1651,4 @@
"retry": "Повторить"
}
}
}
}

View File

@@ -258,17 +258,27 @@
"contentFiltering": "内容过滤",
"videoSettings": "视频设置",
"layoutSettings": "布局设置",
"folderSettings": "文件夹设置",
"priorityTags": "优先标签",
"downloadPathTemplates": "下载路径模板",
"exampleImages": "示例图片",
"updateFlags": "更新标记",
"autoOrganize": "Auto-organize",
"misc": "其他",
"metadataArchive": "元数据归档数据库",
"storageLocation": "设置位置",
"folderSettings": "默认根目录",
"extraFolderPaths": "额外文件夹路径",
"downloadPathTemplates": "下载路径模板",
"priorityTags": "优先标签",
"updateFlags": "更新标记",
"exampleImages": "示例图片",
"autoOrganize": "自动整理",
"metadata": "元数据",
"proxySettings": "代理设置"
},
"nav": {
"general": "通用",
"interface": "界面",
"library": "库"
},
"search": {
"placeholder": "搜索设置...",
"clear": "清除搜索",
"noResults": "未找到匹配 \"{query}\" 的设置"
},
"storage": {
"locationLabel": "便携模式",
"locationHelp": "开启可将 settings.json 保存在仓库中;关闭则保存在用户配置目录。"
@@ -341,13 +351,13 @@
"activeLibraryHelp": "在已配置的库之间切换以更新默认文件夹。更改选择将重新加载页面。",
"loadingLibraries": "正在加载库...",
"noLibraries": "尚未配置库",
"defaultLoraRoot": "默认 LoRA 根目录",
"defaultLoraRoot": "LoRA 根目录",
"defaultLoraRootHelp": "设置下载、导入和移动时的默认 LoRA 根目录",
"defaultCheckpointRoot": "默认 Checkpoint 根目录",
"defaultCheckpointRoot": "Checkpoint 根目录",
"defaultCheckpointRootHelp": "设置下载、导入和移动时的默认 Checkpoint 根目录",
"defaultUnetRoot": "默认 Diffusion Model 根目录",
"defaultUnetRoot": "Diffusion Model 根目录",
"defaultUnetRootHelp": "设置下载、导入和移动时的默认 Diffusion Model (UNET) 根目录",
"defaultEmbeddingRoot": "默认 Embedding 根目录",
"defaultEmbeddingRoot": "Embedding 根目录",
"defaultEmbeddingRootHelp": "设置下载、导入和移动时的默认 Embedding 根目录",
"noDefault": "无默认"
},
@@ -475,6 +485,23 @@
"proxyPassword": "密码 (可选)",
"proxyPasswordPlaceholder": "密码",
"proxyPasswordHelp": "代理认证的密码 (如果需要)"
},
"extraFolderPaths": {
"title": "额外文件夹路径",
"help": "在 ComfyUI 的标准路径之外添加额外的模型文件夹。这些路径单独存储,并与默认文件夹一起扫描。",
"description": "配置额外的文件夹以扫描模型。这些路径是 LoRA Manager 特有的,将与 ComfyUI 的默认路径合并。",
"modelTypes": {
"lora": "LoRA 路径",
"checkpoint": "Checkpoint 路径",
"unet": "Diffusion 模型路径",
"embedding": "Embedding 路径"
},
"pathPlaceholder": "/额外/模型/路径",
"saveSuccess": "额外文件夹路径已更新。",
"saveError": "更新额外文件夹路径失败:{message}",
"validation": {
"duplicatePath": "此路径已配置"
}
}
},
"loras": {
@@ -1624,4 +1651,4 @@
"retry": "重试"
}
}
}
}

View File

@@ -258,17 +258,27 @@
"contentFiltering": "內容過濾",
"videoSettings": "影片設定",
"layoutSettings": "版面設定",
"folderSettings": "資料夾設定",
"priorityTags": "優先標籤",
"downloadPathTemplates": "下載路徑範本",
"exampleImages": "範例圖片",
"updateFlags": "更新標記",
"autoOrganize": "Auto-organize",
"misc": "其他",
"metadataArchive": "中繼資料封存資料庫",
"storageLocation": "設定位置",
"folderSettings": "預設根目錄",
"extraFolderPaths": "額外資料夾路徑",
"downloadPathTemplates": "下載路徑範本",
"priorityTags": "優先標籤",
"updateFlags": "更新標記",
"exampleImages": "範例圖片",
"autoOrganize": "自動整理",
"metadata": "中繼資料",
"proxySettings": "代理設定"
},
"nav": {
"general": "通用",
"interface": "介面",
"library": "模型庫"
},
"search": {
"placeholder": "搜尋設定...",
"clear": "清除搜尋",
"noResults": "未找到符合 \"{query}\" 的設定"
},
"storage": {
"locationLabel": "可攜式模式",
"locationHelp": "啟用可將 settings.json 保存在儲存庫中;停用則保存在使用者設定目錄。"
@@ -341,13 +351,13 @@
"activeLibraryHelp": "在已設定的資料庫之間切換以更新預設資料夾。變更選項會重新載入頁面。",
"loadingLibraries": "正在載入資料庫...",
"noLibraries": "尚未設定任何資料庫",
"defaultLoraRoot": "預設 LoRA 根目錄",
"defaultLoraRoot": "LoRA 根目錄",
"defaultLoraRootHelp": "設定下載、匯入和移動時的預設 LoRA 根目錄",
"defaultCheckpointRoot": "預設 Checkpoint 根目錄",
"defaultCheckpointRoot": "Checkpoint 根目錄",
"defaultCheckpointRootHelp": "設定下載、匯入和移動時的預設 Checkpoint 根目錄",
"defaultUnetRoot": "預設 Diffusion Model 根目錄",
"defaultUnetRoot": "Diffusion Model 根目錄",
"defaultUnetRootHelp": "設定下載、匯入和移動時的預設 Diffusion Model (UNET) 根目錄",
"defaultEmbeddingRoot": "預設 Embedding 根目錄",
"defaultEmbeddingRoot": "Embedding 根目錄",
"defaultEmbeddingRootHelp": "設定下載、匯入和移動時的預設 Embedding 根目錄",
"noDefault": "未設定預設"
},
@@ -475,6 +485,23 @@
"proxyPassword": "密碼(選填)",
"proxyPasswordPlaceholder": "password",
"proxyPasswordHelp": "代理驗證所需的密碼(如有需要)"
},
"extraFolderPaths": {
"title": "額外資料夾路徑",
"help": "在 ComfyUI 的標準路徑之外新增額外的模型資料夾。這些路徑單獨儲存,並與預設資料夾一起掃描。",
"description": "設定額外的資料夾以掃描模型。這些路徑是 LoRA Manager 特有的,將與 ComfyUI 的預設路徑合併。",
"modelTypes": {
"lora": "LoRA 路徑",
"checkpoint": "Checkpoint 路徑",
"unet": "Diffusion 模型路徑",
"embedding": "Embedding 路徑"
},
"pathPlaceholder": "/額外/模型/路徑",
"saveSuccess": "額外資料夾路徑已更新。",
"saveError": "更新額外資料夾路徑失敗:{message}",
"validation": {
"duplicatePath": "此路徑已設定"
}
}
},
"loras": {
@@ -1624,4 +1651,4 @@
"retry": "重試"
}
}
}
}

View File

@@ -91,6 +91,11 @@ class Config:
self.embeddings_roots = None
self.base_models_roots = self._init_checkpoint_paths()
self.embeddings_roots = self._init_embedding_paths()
# Extra paths (only for LoRA Manager, not shared with ComfyUI)
self.extra_loras_roots: List[str] = []
self.extra_checkpoints_roots: List[str] = []
self.extra_unet_roots: List[str] = []
self.extra_embeddings_roots: List[str] = []
# Scan symbolic links during initialization
self._initialize_symlink_mappings()
@@ -250,6 +255,11 @@ class Config:
roots.extend(self.loras_roots or [])
roots.extend(self.base_models_roots or [])
roots.extend(self.embeddings_roots or [])
# Include extra paths for scanning symlinks
roots.extend(self.extra_loras_roots or [])
roots.extend(self.extra_checkpoints_roots or [])
roots.extend(self.extra_unet_roots or [])
roots.extend(self.extra_embeddings_roots or [])
return roots
def _build_symlink_fingerprint(self) -> Dict[str, object]:
@@ -570,6 +580,15 @@ class Config:
preview_roots.update(self._expand_preview_root(root))
for root in self.embeddings_roots or []:
preview_roots.update(self._expand_preview_root(root))
# Include extra paths for preview access
for root in self.extra_loras_roots or []:
preview_roots.update(self._expand_preview_root(root))
for root in self.extra_checkpoints_roots or []:
preview_roots.update(self._expand_preview_root(root))
for root in self.extra_unet_roots or []:
preview_roots.update(self._expand_preview_root(root))
for root in self.extra_embeddings_roots or []:
preview_roots.update(self._expand_preview_root(root))
for target, link in self._path_mappings.items():
preview_roots.update(self._expand_preview_root(target))
@@ -577,11 +596,11 @@ class Config:
self._preview_root_paths = {path for path in preview_roots if path.is_absolute()}
logger.debug(
"Preview roots rebuilt: %d paths from %d lora roots, %d checkpoint roots, %d embedding roots, %d symlink mappings",
"Preview roots rebuilt: %d paths from %d lora roots (%d extra), %d checkpoint roots (%d extra), %d embedding roots (%d extra), %d symlink mappings",
len(self._preview_root_paths),
len(self.loras_roots or []),
len(self.base_models_roots or []),
len(self.embeddings_roots or []),
len(self.loras_roots or []), len(self.extra_loras_roots or []),
len(self.base_models_roots or []), len(self.extra_checkpoints_roots or []),
len(self.embeddings_roots or []), len(self.extra_embeddings_roots or []),
len(self._path_mappings),
)
@@ -692,7 +711,11 @@ class Config:
return unique_paths
def _apply_library_paths(self, folder_paths: Mapping[str, Iterable[str]]) -> None:
def _apply_library_paths(
self,
folder_paths: Mapping[str, Iterable[str]],
extra_folder_paths: Optional[Mapping[str, Iterable[str]]] = None,
) -> None:
self._path_mappings.clear()
self._preview_root_paths = set()
@@ -705,6 +728,20 @@ class Config:
self.base_models_roots = self._prepare_checkpoint_paths(checkpoint_paths, unet_paths)
self.embeddings_roots = self._prepare_embedding_paths(embedding_paths)
# Process extra paths (only for LoRA Manager, not shared with ComfyUI)
extra_paths = extra_folder_paths or {}
extra_lora_paths = extra_paths.get('loras', []) or []
extra_checkpoint_paths = extra_paths.get('checkpoints', []) or []
extra_unet_paths = extra_paths.get('unet', []) or []
extra_embedding_paths = extra_paths.get('embeddings', []) or []
self.extra_loras_roots = self._prepare_lora_paths(extra_lora_paths)
self.extra_checkpoints_roots = self._prepare_checkpoint_paths(extra_checkpoint_paths, extra_unet_paths)
self.extra_embeddings_roots = self._prepare_embedding_paths(extra_embedding_paths)
# extra_unet_roots is set by _prepare_checkpoint_paths (access unet_roots before it's reset)
unet_roots_value: List[str] = getattr(self, 'unet_roots', None) or []
self.extra_unet_roots = unet_roots_value
self._initialize_symlink_mappings()
def _init_lora_paths(self) -> List[str]:
@@ -864,16 +901,19 @@ class Config:
def apply_library_settings(self, library_config: Mapping[str, object]) -> None:
"""Update runtime paths to match the provided library configuration."""
folder_paths = library_config.get('folder_paths') if isinstance(library_config, Mapping) else {}
extra_folder_paths = library_config.get('extra_folder_paths') if isinstance(library_config, Mapping) else None
if not isinstance(folder_paths, Mapping):
folder_paths = {}
if not isinstance(extra_folder_paths, Mapping):
extra_folder_paths = None
self._apply_library_paths(folder_paths)
self._apply_library_paths(folder_paths, extra_folder_paths)
logger.info(
"Applied library settings with %d lora roots, %d checkpoint roots, and %d embedding roots",
len(self.loras_roots or []),
len(self.base_models_roots or []),
len(self.embeddings_roots or []),
"Applied library settings with %d lora roots (%d extra), %d checkpoint roots (%d extra), and %d embedding roots (%d extra)",
len(self.loras_roots or []), len(self.extra_loras_roots or []),
len(self.base_models_roots or []), len(self.extra_checkpoints_roots or []),
len(self.embeddings_roots or []), len(self.extra_embeddings_roots or []),
)
def get_library_registry_snapshot(self) -> Dict[str, object]:

View File

@@ -1,7 +1,8 @@
import logging
import re
from nodes import LoraLoader
from ..utils.utils import get_lora_info
import comfy.utils # type: ignore
import comfy.sd # type: ignore
from ..utils.utils import get_lora_info_absolute
from .utils import FlexibleOptionalInputType, any_type, extract_lora_name, get_loras_list, nunchaku_load_lora
logger = logging.getLogger(__name__)
@@ -52,18 +53,20 @@ class LoraLoaderLM:
# First process lora_stack if available
if lora_stack:
for lora_path, model_strength, clip_strength in lora_stack:
# Extract lora name and convert to absolute path
# lora_stack stores relative paths, but load_torch_file needs absolute paths
lora_name = extract_lora_name(lora_path)
absolute_lora_path, trigger_words = get_lora_info_absolute(lora_name)
# Apply the LoRA using the appropriate loader
if is_nunchaku_model:
# Use our custom function for Flux models
model = nunchaku_load_lora(model, lora_path, model_strength)
# clip remains unchanged for Nunchaku models
else:
# Use default loader for standard models
model, clip = LoraLoader().load_lora(model, clip, lora_path, model_strength, clip_strength)
# Extract lora name for trigger words lookup
lora_name = extract_lora_name(lora_path)
_, trigger_words = get_lora_info(lora_name)
# Use lower-level API to load LoRA directly without folder_paths validation
lora = comfy.utils.load_torch_file(absolute_lora_path, safe_load=True)
model, clip = comfy.sd.load_lora_for_models(model, clip, lora, model_strength, clip_strength)
all_trigger_words.extend(trigger_words)
# Add clip strength to output if different from model strength (except for Nunchaku models)
@@ -84,7 +87,7 @@ class LoraLoaderLM:
clip_strength = float(lora.get('clipStrength', model_strength))
# Get lora path and trigger words
lora_path, trigger_words = get_lora_info(lora_name)
lora_path, trigger_words = get_lora_info_absolute(lora_name)
# Apply the LoRA using the appropriate loader
if is_nunchaku_model:
@@ -92,8 +95,9 @@ class LoraLoaderLM:
model = nunchaku_load_lora(model, lora_path, model_strength)
# clip remains unchanged
else:
# Use default loader for standard models
model, clip = LoraLoader().load_lora(model, clip, lora_path, model_strength, clip_strength)
# Use lower-level API to load LoRA directly without folder_paths validation
lora = comfy.utils.load_torch_file(lora_path, safe_load=True)
model, clip = comfy.sd.load_lora_for_models(model, clip, lora, model_strength, clip_strength)
# Include clip strength in output if different from model strength and not a Nunchaku model
if not is_nunchaku_model and abs(model_strength - clip_strength) > 0.001:
@@ -193,18 +197,20 @@ class LoraTextLoaderLM:
# First process lora_stack if available
if lora_stack:
for lora_path, model_strength, clip_strength in lora_stack:
# Extract lora name and convert to absolute path
# lora_stack stores relative paths, but load_torch_file needs absolute paths
lora_name = extract_lora_name(lora_path)
absolute_lora_path, trigger_words = get_lora_info_absolute(lora_name)
# Apply the LoRA using the appropriate loader
if is_nunchaku_model:
# Use our custom function for Flux models
model = nunchaku_load_lora(model, lora_path, model_strength)
# clip remains unchanged for Nunchaku models
else:
# Use default loader for standard models
model, clip = LoraLoader().load_lora(model, clip, lora_path, model_strength, clip_strength)
# Extract lora name for trigger words lookup
lora_name = extract_lora_name(lora_path)
_, trigger_words = get_lora_info(lora_name)
# Use lower-level API to load LoRA directly without folder_paths validation
lora = comfy.utils.load_torch_file(absolute_lora_path, safe_load=True)
model, clip = comfy.sd.load_lora_for_models(model, clip, lora, model_strength, clip_strength)
all_trigger_words.extend(trigger_words)
# Add clip strength to output if different from model strength (except for Nunchaku models)
@@ -221,7 +227,7 @@ class LoraTextLoaderLM:
clip_strength = lora['clip_strength']
# Get lora path and trigger words
lora_path, trigger_words = get_lora_info(lora_name)
lora_path, trigger_words = get_lora_info_absolute(lora_name)
# Apply the LoRA using the appropriate loader
if is_nunchaku_model:
@@ -229,8 +235,9 @@ class LoraTextLoaderLM:
model = nunchaku_load_lora(model, lora_path, model_strength)
# clip remains unchanged
else:
# Use default loader for standard models
model, clip = LoraLoader().load_lora(model, clip, lora_path, model_strength, clip_strength)
# Use lower-level API to load LoRA directly without folder_paths validation
lora = comfy.utils.load_torch_file(lora_path, safe_load=True)
model, clip = comfy.sd.load_lora_for_models(model, clip, lora, model_strength, clip_strength)
# Include clip strength in output if different from model strength and not a Nunchaku model
if not is_nunchaku_model and abs(model_strength - clip_strength) > 0.001:

View File

@@ -192,6 +192,7 @@ class NodeRegistry:
"comfy_class": comfy_class,
"capabilities": capabilities,
"widget_names": widget_names,
"mode": node.get("mode"),
}
logger.debug("Registered %s nodes in registry", len(nodes))
self._registry_updated.set()

View File

@@ -383,10 +383,28 @@ class ModelManagementHandler:
return web.json_response(
{"success": False, "error": "Model not found in cache"}, status=404
)
if not model_data.get("sha256"):
return web.json_response(
{"success": False, "error": "No SHA256 hash found"}, status=400
)
# Check if hash needs to be calculated (lazy hash for checkpoints)
sha256 = model_data.get("sha256")
hash_status = model_data.get("hash_status", "completed")
if not sha256 or hash_status != "completed":
# For checkpoints, calculate hash on-demand
scanner = self._service.scanner
if hasattr(scanner, 'calculate_hash_for_model'):
self._logger.info(f"Lazy hash calculation triggered for {file_path}")
sha256 = await scanner.calculate_hash_for_model(file_path)
if not sha256:
return web.json_response(
{"success": False, "error": "Failed to calculate SHA256 hash"}, status=500
)
# Update model_data with new hash
model_data["sha256"] = sha256
model_data["hash_status"] = "completed"
else:
return web.json_response(
{"success": False, "error": "No SHA256 hash found"}, status=400
)
await MetadataManager.hydrate_model_data(model_data)

View File

@@ -1,7 +1,12 @@
import json
import logging
import os
from datetime import datetime
from typing import Any, Dict, List, Optional
from ..utils.models import CheckpointMetadata
from ..utils.file_utils import find_preview_file, normalize_path
from ..utils.metadata_manager import MetadataManager
from ..config import config
from .model_scanner import ModelScanner
from .model_hash_index import ModelHashIndex
@@ -21,6 +26,216 @@ class CheckpointScanner(ModelScanner):
hash_index=ModelHashIndex()
)
async def _create_default_metadata(self, file_path: str) -> Optional[CheckpointMetadata]:
"""Create default metadata for checkpoint without calculating hash (lazy hash).
Checkpoints are typically large (10GB+), so we skip hash calculation during initial
scanning to improve startup performance. Hash will be calculated on-demand when
fetching metadata from Civitai.
"""
try:
real_path = os.path.realpath(file_path)
if not os.path.exists(real_path):
logger.error(f"File not found: {file_path}")
return None
base_name = os.path.splitext(os.path.basename(file_path))[0]
dir_path = os.path.dirname(file_path)
# Find preview image
preview_url = find_preview_file(base_name, dir_path)
# Create metadata WITHOUT calculating hash
metadata = CheckpointMetadata(
file_name=base_name,
model_name=base_name,
file_path=normalize_path(file_path),
size=os.path.getsize(real_path),
modified=datetime.now().timestamp(),
sha256="", # Empty hash - will be calculated on-demand
base_model="Unknown",
preview_url=normalize_path(preview_url),
tags=[],
modelDescription="",
sub_type="checkpoint",
from_civitai=False, # Mark as local model since no hash yet
hash_status="pending" # Mark hash as pending
)
# Save the created metadata
logger.info(f"Creating checkpoint metadata (hash pending) for {file_path}")
await MetadataManager.save_metadata(file_path, metadata)
return metadata
except Exception as e:
logger.error(f"Error creating default checkpoint metadata for {file_path}: {e}")
return None
async def calculate_hash_for_model(self, file_path: str) -> Optional[str]:
"""Calculate hash for a checkpoint on-demand.
Args:
file_path: Path to the model file
Returns:
SHA256 hash string, or None if calculation failed
"""
from ..utils.file_utils import calculate_sha256
try:
real_path = os.path.realpath(file_path)
if not os.path.exists(real_path):
logger.error(f"File not found for hash calculation: {file_path}")
return None
# Load current metadata
metadata, _ = await MetadataManager.load_metadata(file_path, self.model_class)
if metadata is None:
logger.error(f"No metadata found for {file_path}")
return None
# Check if hash is already calculated
if metadata.hash_status == "completed" and metadata.sha256:
return metadata.sha256
# Update status to calculating
metadata.hash_status = "calculating"
await MetadataManager.save_metadata(file_path, metadata)
# Calculate hash
logger.info(f"Calculating hash for checkpoint: {file_path}")
sha256 = await calculate_sha256(real_path)
# Update metadata with hash
metadata.sha256 = sha256
metadata.hash_status = "completed"
await MetadataManager.save_metadata(file_path, metadata)
# Update hash index
self._hash_index.add_entry(sha256.lower(), file_path)
logger.info(f"Hash calculated for checkpoint: {file_path}")
return sha256
except Exception as e:
logger.error(f"Error calculating hash for {file_path}: {e}")
# Update status to failed
try:
metadata, _ = await MetadataManager.load_metadata(file_path, self.model_class)
if metadata:
metadata.hash_status = "failed"
await MetadataManager.save_metadata(file_path, metadata)
except Exception:
pass
return None
async def calculate_all_pending_hashes(self, progress_callback=None) -> Dict[str, int]:
"""Calculate hashes for all checkpoints with pending hash status.
If cache is not initialized, scans filesystem directly for metadata files
with hash_status != 'completed'.
Args:
progress_callback: Optional callback(progress, total, current_file)
Returns:
Dict with 'completed', 'failed', 'total' counts
"""
# Try to get from cache first
cache = await self.get_cached_data()
if cache and cache.raw_data:
# Use cache if available
pending_models = [
item for item in cache.raw_data
if item.get('hash_status') != 'completed' or not item.get('sha256')
]
else:
# Cache not initialized, scan filesystem directly
pending_models = await self._find_pending_models_from_filesystem()
if not pending_models:
return {'completed': 0, 'failed': 0, 'total': 0}
total = len(pending_models)
completed = 0
failed = 0
for i, model_data in enumerate(pending_models):
file_path = model_data.get('file_path')
if not file_path:
continue
try:
sha256 = await self.calculate_hash_for_model(file_path)
if sha256:
completed += 1
else:
failed += 1
except Exception as e:
logger.error(f"Error calculating hash for {file_path}: {e}")
failed += 1
if progress_callback:
try:
await progress_callback(i + 1, total, file_path)
except Exception:
pass
return {
'completed': completed,
'failed': failed,
'total': total
}
async def _find_pending_models_from_filesystem(self) -> List[Dict[str, Any]]:
"""Scan filesystem for checkpoint metadata files with pending hash status."""
pending_models = []
for root_path in self.get_model_roots():
if not os.path.exists(root_path):
continue
for dirpath, _dirnames, filenames in os.walk(root_path):
for filename in filenames:
if not filename.endswith('.metadata.json'):
continue
metadata_path = os.path.join(dirpath, filename)
try:
with open(metadata_path, 'r', encoding='utf-8') as f:
data = json.load(f)
# Check if hash is pending
hash_status = data.get('hash_status', 'completed')
sha256 = data.get('sha256', '')
if hash_status != 'completed' or not sha256:
# Find corresponding model file
model_name = filename.replace('.metadata.json', '')
model_path = None
# Look for model file with matching name
for ext in self.file_extensions:
potential_path = os.path.join(dirpath, model_name + ext)
if os.path.exists(potential_path):
model_path = potential_path
break
if model_path:
pending_models.append({
'file_path': model_path.replace(os.sep, '/'),
'hash_status': hash_status,
'sha256': sha256,
**{k: v for k, v in data.items() if k not in ['file_path', 'hash_status', 'sha256']}
})
except (json.JSONDecodeError, Exception) as e:
logger.debug(f"Error reading metadata file {metadata_path}: {e}")
continue
return pending_models
def _resolve_sub_type(self, root_path: Optional[str]) -> Optional[str]:
"""Resolve the sub-type based on the root path."""
if not root_path:
@@ -51,5 +266,16 @@ class CheckpointScanner(ModelScanner):
return entry
def get_model_roots(self) -> List[str]:
"""Get checkpoint root directories"""
return config.base_models_roots
"""Get checkpoint root directories (including extra paths)"""
roots: List[str] = []
roots.extend(config.base_models_roots or [])
roots.extend(config.extra_checkpoints_roots or [])
roots.extend(config.extra_unet_roots or [])
# Remove duplicates while preserving order
seen: set = set()
unique_roots: List[str] = []
for root in roots:
if root not in seen:
seen.add(root)
unique_roots.append(root)
return unique_roots

View File

@@ -22,5 +22,15 @@ class EmbeddingScanner(ModelScanner):
)
def get_model_roots(self) -> List[str]:
"""Get embedding root directories"""
return config.embeddings_roots
"""Get embedding root directories (including extra paths)"""
roots: List[str] = []
roots.extend(config.embeddings_roots or [])
roots.extend(config.extra_embeddings_roots or [])
# Remove duplicates while preserving order
seen: set = set()
unique_roots: List[str] = []
for root in roots:
if root and root not in seen:
seen.add(root)
unique_roots.append(root)
return unique_roots

View File

@@ -25,8 +25,18 @@ class LoraScanner(ModelScanner):
)
def get_model_roots(self) -> List[str]:
"""Get lora root directories"""
return config.loras_roots
"""Get lora root directories (including extra paths)"""
roots: List[str] = []
roots.extend(config.loras_roots or [])
roots.extend(config.extra_loras_roots or [])
# Remove duplicates while preserving order
seen: set = set()
unique_roots: List[str] = []
for root in roots:
if root and root not in seen:
seen.add(root)
unique_roots.append(root)
return unique_roots
async def diagnose_hash_index(self):
"""Diagnostic method to verify hash index functionality"""

View File

@@ -282,6 +282,11 @@ class ModelScanner:
sub_type = get_value('sub_type', None)
if sub_type:
entry['sub_type'] = sub_type
# Handle hash_status for lazy hash calculation (checkpoints)
hash_status = get_value('hash_status', 'completed')
if hash_status:
entry['hash_status'] = hash_status
return entry

View File

@@ -54,6 +54,7 @@ DEFAULT_SETTINGS: Dict[str, Any] = {
"base_model_path_mappings": {},
"download_path_templates": {},
"folder_paths": {},
"extra_folder_paths": {},
"example_images_path": "",
"optimize_example_images": True,
"auto_download_example_images": False,
@@ -402,6 +403,7 @@ class SettingsManager:
active_library = libraries.get(active_name, {})
folder_paths = copy.deepcopy(active_library.get("folder_paths", {}))
self.settings["folder_paths"] = folder_paths
self.settings["extra_folder_paths"] = copy.deepcopy(active_library.get("extra_folder_paths", {}))
self.settings["default_lora_root"] = active_library.get("default_lora_root", "")
self.settings["default_checkpoint_root"] = active_library.get("default_checkpoint_root", "")
self.settings["default_unet_root"] = active_library.get("default_unet_root", "")
@@ -417,6 +419,7 @@ class SettingsManager:
self,
*,
folder_paths: Optional[Mapping[str, Iterable[str]]] = None,
extra_folder_paths: Optional[Mapping[str, Iterable[str]]] = None,
default_lora_root: Optional[str] = None,
default_checkpoint_root: Optional[str] = None,
default_unet_root: Optional[str] = None,
@@ -432,6 +435,11 @@ class SettingsManager:
else:
payload.setdefault("folder_paths", {})
if extra_folder_paths is not None:
payload["extra_folder_paths"] = self._normalize_folder_paths(extra_folder_paths)
else:
payload.setdefault("extra_folder_paths", {})
if default_lora_root is not None:
payload["default_lora_root"] = default_lora_root
else:
@@ -546,6 +554,7 @@ class SettingsManager:
self,
*,
folder_paths: Optional[Mapping[str, Iterable[str]]] = None,
extra_folder_paths: Optional[Mapping[str, Iterable[str]]] = None,
default_lora_root: Optional[str] = None,
default_checkpoint_root: Optional[str] = None,
default_unet_root: Optional[str] = None,
@@ -565,6 +574,12 @@ class SettingsManager:
library["folder_paths"] = normalized_paths
changed = True
if extra_folder_paths is not None:
normalized_extra_paths = self._normalize_folder_paths(extra_folder_paths)
if library.get("extra_folder_paths") != normalized_extra_paths:
library["extra_folder_paths"] = normalized_extra_paths
changed = True
if default_lora_root is not None and library.get("default_lora_root") != default_lora_root:
library["default_lora_root"] = default_lora_root
changed = True
@@ -816,12 +831,14 @@ class SettingsManager:
defaults['download_path_templates'] = {}
defaults['priority_tags'] = DEFAULT_PRIORITY_TAG_CONFIG.copy()
defaults.setdefault('folder_paths', {})
defaults.setdefault('extra_folder_paths', {})
defaults['auto_organize_exclusions'] = []
defaults['metadata_refresh_skip_paths'] = []
library_name = defaults.get("active_library") or "default"
default_library = self._build_library_payload(
folder_paths=defaults.get("folder_paths", {}),
extra_folder_paths=defaults.get("extra_folder_paths", {}),
default_lora_root=defaults.get("default_lora_root"),
default_checkpoint_root=defaults.get("default_checkpoint_root"),
default_embedding_root=defaults.get("default_embedding_root"),
@@ -927,6 +944,35 @@ class SettingsManager:
self._save_settings()
return skip_paths
def get_extra_folder_paths(self) -> Dict[str, List[str]]:
"""Get extra folder paths for the active library.
These paths are only used by LoRA Manager and not shared with ComfyUI.
Returns a dictionary with keys like 'loras', 'checkpoints', 'embeddings', 'unet'.
"""
extra_paths = self.settings.get("extra_folder_paths", {})
if not isinstance(extra_paths, dict):
return {}
return self._normalize_folder_paths(extra_paths)
def update_extra_folder_paths(
self,
extra_folder_paths: Mapping[str, Iterable[str]],
) -> None:
"""Update extra folder paths for the active library.
These paths are only used by LoRA Manager and not shared with ComfyUI.
Validates that extra paths don't overlap with other libraries' paths.
"""
active_name = self.get_active_library_name()
self._validate_folder_paths(active_name, extra_folder_paths)
normalized_paths = self._normalize_folder_paths(extra_folder_paths)
self.settings["extra_folder_paths"] = normalized_paths
self._update_active_library_entry(extra_folder_paths=normalized_paths)
self._save_settings()
logger.info("Updated extra folder paths for library '%s'", active_name)
def get_startup_messages(self) -> List[Dict[str, Any]]:
return [message.copy() for message in self._startup_messages]
@@ -973,6 +1019,8 @@ class SettingsManager:
self._prepare_portable_switch(value)
if key == 'folder_paths' and isinstance(value, Mapping):
self._update_active_library_entry(folder_paths=value) # type: ignore[arg-type]
elif key == 'extra_folder_paths' and isinstance(value, Mapping):
self._update_active_library_entry(extra_folder_paths=value) # type: ignore[arg-type]
elif key == 'default_lora_root':
self._update_active_library_entry(default_lora_root=str(value))
elif key == 'default_checkpoint_root':
@@ -1284,6 +1332,7 @@ class SettingsManager:
library_name: str,
*,
folder_paths: Optional[Mapping[str, Iterable[str]]] = None,
extra_folder_paths: Optional[Mapping[str, Iterable[str]]] = None,
default_lora_root: Optional[str] = None,
default_checkpoint_root: Optional[str] = None,
default_unet_root: Optional[str] = None,
@@ -1300,11 +1349,15 @@ class SettingsManager:
if folder_paths is not None:
self._validate_folder_paths(name, folder_paths)
if extra_folder_paths is not None:
self._validate_folder_paths(name, extra_folder_paths)
libraries = self.settings.setdefault("libraries", {})
existing = libraries.get(name, {})
payload = self._build_library_payload(
folder_paths=folder_paths if folder_paths is not None else existing.get("folder_paths"),
extra_folder_paths=extra_folder_paths if extra_folder_paths is not None else existing.get("extra_folder_paths"),
default_lora_root=default_lora_root if default_lora_root is not None else existing.get("default_lora_root"),
default_checkpoint_root=(
default_checkpoint_root
@@ -1343,6 +1396,7 @@ class SettingsManager:
library_name: str,
*,
folder_paths: Mapping[str, Iterable[str]],
extra_folder_paths: Optional[Mapping[str, Iterable[str]]] = None,
default_lora_root: str = "",
default_checkpoint_root: str = "",
default_unet_root: str = "",
@@ -1359,6 +1413,7 @@ class SettingsManager:
return self.upsert_library(
library_name,
folder_paths=folder_paths,
extra_folder_paths=extra_folder_paths,
default_lora_root=default_lora_root,
default_checkpoint_root=default_checkpoint_root,
default_unet_root=default_unet_root,
@@ -1417,6 +1472,7 @@ class SettingsManager:
self,
folder_paths: Mapping[str, Iterable[str]],
*,
extra_folder_paths: Optional[Mapping[str, Iterable[str]]] = None,
default_lora_root: Optional[str] = None,
default_checkpoint_root: Optional[str] = None,
default_unet_root: Optional[str] = None,
@@ -1428,6 +1484,7 @@ class SettingsManager:
self.upsert_library(
active_name,
folder_paths=folder_paths,
extra_folder_paths=extra_folder_paths,
default_lora_root=default_lora_root,
default_checkpoint_root=default_checkpoint_root,
default_unet_root=default_unet_root,

View File

@@ -28,6 +28,7 @@ class BaseModelMetadata:
skip_metadata_refresh: bool = False # Whether to skip this model during bulk metadata refresh
metadata_source: Optional[str] = None # Last provider that supplied metadata
last_checked_at: float = 0 # Last checked timestamp
hash_status: str = "completed" # Hash calculation status: pending | calculating | completed | failed
_unknown_fields: Dict[str, Any] = field(default_factory=dict, repr=False, compare=False) # Store unknown fields
def __post_init__(self):

View File

@@ -57,6 +57,9 @@ class UsageStats:
"last_save_time": 0
}
# Track if stats have been modified since last save
self._is_dirty = False
# Queue for prompt_ids to process
self.pending_prompt_ids = set()
@@ -180,27 +183,39 @@ class UsageStats:
async def save_stats(self, force=False):
"""Save statistics to file"""
try:
# Only save if it's been at least save_interval since last save or force is True
# Only save if:
# 1. force is True, OR
# 2. stats have been modified (is_dirty) AND save_interval has passed
current_time = time.time()
if not force and (current_time - self.stats.get("last_save_time", 0)) < self.save_interval:
return False
time_since_last_save = current_time - self.stats.get("last_save_time", 0)
if not force:
if not self._is_dirty:
# No changes to save
return False
if time_since_last_save < self.save_interval:
# Too soon since last save
return False
# Use a lock to prevent concurrent writes
async with self._lock:
# Update last save time
self.stats["last_save_time"] = current_time
# Create directory if it doesn't exist
os.makedirs(os.path.dirname(self._stats_file_path), exist_ok=True)
# Write to a temporary file first, then move it to avoid corruption
temp_path = f"{self._stats_file_path}.tmp"
with open(temp_path, 'w', encoding='utf-8') as f:
json.dump(self.stats, f, indent=2, ensure_ascii=False)
# Replace the old file with the new one
os.replace(temp_path, self._stats_file_path)
# Clear dirty flag since we've saved
self._is_dirty = False
logger.debug(f"Saved usage statistics to {self._stats_file_path}")
return True
except Exception as e:
@@ -218,25 +233,32 @@ class UsageStats:
while True:
# Wait a short interval before checking for new prompt_ids
await asyncio.sleep(5) # Check every 5 seconds
# Process any pending prompt_ids
if self.pending_prompt_ids:
async with self._lock:
# Get a copy of the set and clear original
prompt_ids = self.pending_prompt_ids.copy()
self.pending_prompt_ids.clear()
# Process each prompt_id
registry = MetadataRegistry()
for prompt_id in prompt_ids:
try:
metadata = registry.get_metadata(prompt_id)
await self._process_metadata(metadata)
except Exception as e:
logger.error(f"Error processing prompt_id {prompt_id}: {e}")
# Periodically save stats
await self.save_stats()
try:
registry = MetadataRegistry()
except NameError:
# MetadataRegistry not available (standalone mode)
registry = None
if registry:
for prompt_id in prompt_ids:
try:
metadata = registry.get_metadata(prompt_id)
await self._process_metadata(metadata)
except Exception as e:
logger.error(f"Error processing prompt_id {prompt_id}: {e}")
# Periodically save stats (only if there are changes)
if self._is_dirty:
await self.save_stats()
except asyncio.CancelledError:
# Task was cancelled, clean up
await self.save_stats(force=True)
@@ -254,9 +276,10 @@ class UsageStats:
"""Process metadata from an execution"""
if not metadata or not isinstance(metadata, dict):
return
# Increment total executions count
self.stats["total_executions"] += 1
self._is_dirty = True
# Get today's date in YYYY-MM-DD format
today = datetime.datetime.now().strftime("%Y-%m-%d")
@@ -373,7 +396,11 @@ class UsageStats:
"""Process a prompt execution immediately (synchronous approach)"""
if not prompt_id:
return
if standalone_mode:
# Usage statistics are not available in standalone mode
return
try:
# Process metadata for this prompt_id
registry = MetadataRegistry()

View File

@@ -50,6 +50,52 @@ def get_lora_info(lora_name):
# No event loop is running, we can use asyncio.run()
return asyncio.run(_get_lora_info_async())
def get_lora_info_absolute(lora_name):
"""Get the absolute lora path and trigger words from cache
Returns:
tuple: (absolute_path, trigger_words) where absolute_path is the full
file system path to the LoRA file, or original lora_name if not found
"""
async def _get_lora_info_absolute_async():
scanner = await ServiceRegistry.get_lora_scanner()
cache = await scanner.get_cached_data()
for item in cache.raw_data:
if item.get('file_name') == lora_name:
file_path = item.get('file_path')
if file_path:
# Return absolute path directly
# Get trigger words from civitai metadata
civitai = item.get('civitai', {})
trigger_words = civitai.get('trainedWords', []) if civitai else []
return file_path, trigger_words
return lora_name, []
try:
# Check if we're already in an event loop
loop = asyncio.get_running_loop()
# If we're in a running loop, we need to use a different approach
# Create a new thread to run the async code
import concurrent.futures
def run_in_thread():
new_loop = asyncio.new_event_loop()
asyncio.set_event_loop(new_loop)
try:
return new_loop.run_until_complete(_get_lora_info_absolute_async())
finally:
new_loop.close()
with concurrent.futures.ThreadPoolExecutor() as executor:
future = executor.submit(run_in_thread)
return future.result()
except RuntimeError:
# No event loop is running, we can use asyncio.run()
return asyncio.run(_get_lora_info_absolute_async())
def fuzzy_match(text: str, pattern: str, threshold: float = 0.85) -> bool:
"""
Check if text matches pattern using fuzzy matching.
@@ -143,15 +189,23 @@ def calculate_recipe_fingerprint(loras):
if lora.get("exclude", False):
continue
hash_value = lora.get("hash", "").lower()
hash_value = lora.get("hash", "")
if isinstance(hash_value, str):
hash_value = hash_value.lower()
else:
hash_value = str(hash_value).lower() if hash_value else ""
if not hash_value and lora.get("modelVersionId"):
hash_value = str(lora.get("modelVersionId"))
if not hash_value:
continue
# Normalize strength to 2 decimal places (check both strength and weight fields)
strength = round(float(lora.get("strength", lora.get("weight", 1.0))), 2)
strength_val = lora.get("strength", lora.get("weight", 1.0))
try:
strength = round(float(strength_val), 2)
except (ValueError, TypeError):
strength = 1.0
valid_loras.append((hash_value, strength))

View File

@@ -282,7 +282,7 @@
display: flex;
justify-content: space-between;
align-items: flex-start; /* Changed from flex-end to allow for text wrapping */
min-height: 32px;
min-height: auto;
gap: var(--space-1); /* Add gap between model info and actions */
}
@@ -413,7 +413,7 @@
font-size: 0.95em;
word-break: break-word;
display: block;
max-height: 3em; /* Increased to ensure two full lines */
max-height: 4.2em; /* Allow up to 3 lines */
overflow: hidden;
/* Add line height for consistency */
line-height: 1.4;

View File

@@ -392,6 +392,7 @@
border: 1px solid transparent;
outline: none;
flex: 1;
overflow-wrap: anywhere; /* Allow wrapping at any character, including hyphens */
}
.model-name-content:focus {

View File

@@ -1,4 +1,4 @@
/* Settings styles */
/* Settings Modal - macOS Settings Style */
.settings-toggle {
width: 36px;
height: 36px;
@@ -20,15 +20,207 @@
}
.settings-modal {
max-width: 700px; /* Further increased from 600px for more space */
width: 1000px;
height: calc(92vh - var(--header-height, 48px));
max-width: 95vw;
max-height: 90vh;
display: flex;
flex-direction: column;
}
.settings-modal .modal-body {
display: flex;
flex-direction: row;
flex: 1;
overflow: hidden;
min-height: 0;
}
/* Navigation Sidebar */
.settings-nav {
width: 200px;
flex-shrink: 0;
border-right: 1px solid var(--lora-border);
padding: var(--space-2);
overflow-y: auto;
}
[data-theme="dark"] .settings-nav {
background: transparent;
}
.settings-nav-list {
list-style: none;
padding: 0;
margin: 0;
}
.settings-nav-group {
margin-bottom: var(--space-2);
}
/* Hide group titles - we use flat navigation */
.settings-nav-group-title {
display: none;
}
/* Hide settings title */
.settings-nav-title {
display: none;
}
.settings-nav-item {
display: block;
width: 100%;
padding: 10px 14px;
border: none;
background: transparent;
color: var(--text-color);
text-align: left;
font-size: 14px;
font-weight: 500;
cursor: pointer;
border-radius: var(--border-radius-xs);
transition: all 0.2s ease;
margin-bottom: 4px;
}
.settings-nav-item:hover {
background: rgba(var(--lora-accent-rgb, 79, 70, 229), 0.1);
color: var(--lora-accent);
}
.settings-nav-item.active {
background: var(--lora-accent);
color: white;
font-weight: 600;
}
/* Content Area */
.settings-content {
flex: 1;
overflow-y: auto;
padding: var(--space-3);
scroll-behavior: smooth;
}
.settings-content .settings-form {
padding-bottom: var(--space-4);
}
.settings-header {
display: flex;
align-items: center;
justify-content: flex-start;
gap: var(--space-1);
margin-bottom: var(--space-2);
padding-right: 40px; /* Space for close button */
padding-left: calc(var(--space-2) + 14px); /* Align with nav item text */
}
.settings-header .settings-search-wrapper {
margin-left: auto;
}
/* Search Input Styles */
.settings-search-wrapper {
position: relative;
display: flex;
align-items: center;
width: 240px;
}
.settings-search-icon {
position: absolute;
left: 10px;
color: var(--text-color);
opacity: 0.5;
font-size: 0.9em;
pointer-events: none;
}
.settings-search-input {
width: 100%;
padding: 6px 28px 6px 32px;
height: 32px;
border-radius: var(--border-radius-xs);
border: 1px solid var(--border-color);
background-color: var(--lora-surface);
color: var(--text-color);
font-size: 0.9em;
transition: all 0.2s ease;
}
.settings-search-input:focus {
border-color: var(--lora-accent);
outline: none;
box-shadow: 0 0 0 2px rgba(var(--lora-accent-rgb, 79, 70, 229), 0.1);
}
.settings-search-input::placeholder {
color: var(--text-color);
opacity: 0.5;
}
.settings-search-clear {
position: absolute;
right: 6px;
width: 20px;
height: 20px;
border: none;
background: rgba(var(--border-color-rgb, 148, 163, 184), 0.3);
color: var(--text-color);
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.7em;
opacity: 0.6;
transition: all 0.2s ease;
}
.settings-search-clear:hover {
opacity: 1;
background: rgba(var(--border-color-rgb, 148, 163, 184), 0.5);
}
/* Search Highlight Styles */
.settings-search-highlight {
background-color: rgba(var(--lora-accent-rgb, 79, 70, 229), 0.3);
color: var(--lora-accent);
padding: 0 2px;
border-radius: 2px;
font-weight: 500;
}
/* Section visibility during search */
.settings-section.search-match,
.setting-item.search-match {
display: block !important;
}
.settings-section.search-hidden,
.setting-item.search-hidden {
display: none !important;
}
/* Empty search results state */
.settings-search-empty {
text-align: center;
padding: var(--space-4);
color: var(--text-color);
opacity: 0.7;
}
.settings-search-empty i {
font-size: 2em;
margin-bottom: var(--space-2);
opacity: 0.5;
}
.settings-search-empty p {
margin: 0;
font-size: 0.95em;
}
.settings-header h2 {
@@ -248,11 +440,32 @@
gap: var(--space-2);
}
.priority-tags-header {
.priority-tags-header-row {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
.priority-tags-header-row .setting-info {
width: auto;
flex-shrink: 0;
}
.priority-tags-header {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
gap: 8px;
width: auto;
}
.priority-tags-header label {
display: inline-flex;
white-space: nowrap;
}
.priority-tags-info {
display: flex;
align-items: center;
@@ -360,25 +573,65 @@
padding: 6px 0;
}
/* Settings Styles */
/* Settings Section - macOS Settings Style */
.settings-section {
margin-top: var(--space-3);
border-top: 1px solid var(--lora-border);
padding-top: var(--space-2);
display: none;
animation: fadeIn 0.2s ease-out;
}
.settings-section h3 {
font-size: 1.1em;
.settings-section.active {
display: block;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateX(10px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
/* Remove old section header - replaced by subsection headers */
.settings-section-header {
display: none;
}
/* Subsection styling */
.settings-subsection {
margin-bottom: var(--space-5);
}
.settings-subsection:last-child {
margin-bottom: 0;
}
.settings-subsection-header {
display: flex;
align-items: center;
padding: var(--space-2) 0;
margin-bottom: var(--space-2);
border-bottom: 1px solid var(--lora-border);
}
.settings-subsection-header h4 {
font-size: 18px;
font-weight: 700;
margin: 0;
color: var(--text-color);
opacity: 0.9;
}
/* Remove toggle button styles */
.settings-section-toggle {
display: none;
}
.setting-item {
display: flex;
flex-direction: column; /* Changed to column for help text placement */
margin-bottom: var(--space-3); /* Increased to provide more spacing between items */
padding: var(--space-1);
padding: var(--space-2);
border-radius: var(--border-radius-xs);
}
@@ -390,6 +643,8 @@
background: rgba(255, 255, 255, 0.05);
}
/* Control row with label and input together */
.setting-row {
display: flex;
@@ -403,13 +658,16 @@
margin-bottom: 0;
width: 35%; /* Increased from 30% to prevent wrapping */
flex-shrink: 0; /* Prevent shrinking */
display: flex; /* Allow label and info-icon to be on same line */
align-items: center;
}
.setting-info label {
display: block;
font-weight: 500;
font-weight: 400;
margin-bottom: 0;
white-space: nowrap; /* Prevent label wrapping */
/* Use text color with alpha instead of opacity to avoid affecting tooltip */
color: rgba(from var(--text-color) r g b / 0.85);
}
.setting-control {
@@ -701,6 +959,66 @@ input:checked + .toggle-slider:before {
}
}
/* Responsive: Mobile - Single column layout */
@media (max-width: 768px) {
.settings-modal {
width: 95vw;
max-height: 90vh;
}
.settings-modal .modal-body {
flex-direction: column;
}
.settings-header {
flex-direction: column;
align-items: flex-start;
gap: var(--space-2);
}
.settings-header .settings-search-wrapper {
margin-left: 0;
width: 100%;
}
.settings-nav {
width: 100%;
max-height: 200px;
border-right: none;
border-bottom: 1px solid var(--lora-border);
padding: var(--space-1);
}
.settings-nav-list {
display: flex;
flex-wrap: wrap;
gap: var(--space-1);
}
.settings-nav-group {
display: flex;
flex-wrap: wrap;
gap: var(--space-1);
margin-bottom: 0;
}
.settings-nav-group-title {
display: none;
}
.settings-nav-item {
width: auto;
white-space: nowrap;
font-size: 0.85em;
padding: 6px 10px;
margin-bottom: 0;
}
.settings-content {
padding: var(--space-2);
}
}
/* Dark theme specific adjustments */
[data-theme="dark"] .base-model-select,
[data-theme="dark"] .path-value-input {
@@ -827,3 +1145,126 @@ input:checked + .toggle-slider:before {
margin-top: var(--space-2);
}
}
/* Info icon styling for settings labels - Minimal style */
.info-icon {
color: var(--text-color);
margin-left: 6px;
font-size: 0.85em;
vertical-align: text-bottom;
cursor: help;
opacity: 0.4;
transition: opacity 0.2s ease;
}
.info-icon:hover {
opacity: 1;
}
/* Tooltip using data-tooltip attribute */
.info-icon[data-tooltip] {
position: relative;
}
.info-icon[data-tooltip]::after {
content: attr(data-tooltip);
position: absolute;
bottom: calc(100% + 8px);
background: rgba(0, 0, 0, 0.9);
color: white;
padding: 8px 12px;
border-radius: 6px;
font-size: 14px;
font-weight: normal;
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
white-space: normal;
max-width: 220px;
width: max-content;
opacity: 0;
visibility: hidden;
transition: opacity 0.2s ease, visibility 0.2s ease;
pointer-events: none;
z-index: 10000;
line-height: 1.4;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
text-transform: none;
}
.info-icon[data-tooltip]:hover::after {
opacity: 1;
visibility: visible;
}
/* Fix tooltip overflow on left edge - when icon is near left side of modal */
.settings-subsection-header .info-icon[data-tooltip]::after {
left: 0;
transform: translateX(0);
}
.settings-subsection-header .info-icon[data-tooltip]::before {
left: 12px;
}
/* Dark theme adjustments for tooltip - Fully opaque */
[data-theme="dark"] .info-icon[data-tooltip]::after {
background: rgba(40, 40, 40, 0.95);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
/* Extra Folder Paths - Single input layout */
.extra-folder-path-row {
margin-bottom: var(--space-2);
}
.extra-folder-path-row:last-child {
margin-bottom: 0;
}
.extra-folder-paths-container {
margin-top: var(--space-2);
}
.extra-folder-path-row .path-controls {
display: flex;
gap: var(--space-2);
align-items: center;
}
.extra-folder-path-row .path-controls .extra-folder-path-input {
flex: 1;
min-width: 0;
padding: 6px 10px;
border-radius: var(--border-radius-xs);
border: 1px solid var(--border-color);
background-color: var(--lora-surface);
color: var(--text-color);
font-size: 0.9em;
height: 32px;
box-sizing: border-box;
}
.extra-folder-path-row .path-controls .extra-folder-path-input:focus {
border-color: var(--lora-accent);
outline: none;
box-shadow: 0 0 0 2px rgba(var(--lora-accent-rgb, 79, 70, 229), 0.1);
}
.extra-folder-path-row .path-controls .remove-path-btn {
width: 32px;
height: 32px;
border-radius: var(--border-radius-xs);
border: 1px solid var(--lora-error);
background: transparent;
color: var(--lora-error);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
flex-shrink: 0;
}
.extra-folder-path-row .path-controls .remove-path-btn:hover {
background: var(--lora-error);
color: white;
}

View File

@@ -633,7 +633,7 @@ export function createModelCard(model, modelType) {
` : ''}
<div class="card-footer">
<div class="model-info">
<span class="model-name">${getDisplayName(model)}</span>
<span class="model-name" title="${getDisplayName(model).replace(/"/g, '&quot;')}">${getDisplayName(model)}</span>
<div>
${model.civitai?.name ? `<span class="version-name">${model.civitai.name}</span>` : ''}
${hasUsageCount ? `<span class="version-name" title="${translate('modelCard.usage.timesUsed', {}, 'Times used')}">${model.usage_count}×</span>` : ''}

View File

@@ -530,7 +530,7 @@ function addNewTriggerWord(word) {
// Validation: Check total number
const currentTags = tagsContainer.querySelectorAll('.trigger-word-tag');
if (currentTags.length >= 30) {
if (currentTags.length >= 100) {
showToast('toast.triggerWords.tooMany', {}, 'error');
return;
}

View File

@@ -364,10 +364,283 @@ export class SettingsManager {
}
this.setupPriorityTagInputs();
this.initializeNavigation();
this.initializeSearch();
this.initialized = true;
}
initializeNavigation() {
const navItems = document.querySelectorAll('.settings-nav-item');
const sections = document.querySelectorAll('.settings-section');
if (navItems.length === 0 || sections.length === 0) return;
// Handle navigation item clicks - macOS Settings style: show section instead of scroll
navItems.forEach(item => {
item.addEventListener('click', (e) => {
const sectionId = item.dataset.section;
if (!sectionId) return;
// Hide all sections
sections.forEach(section => {
section.classList.remove('active');
});
// Show target section
const targetSection = document.getElementById(`section-${sectionId}`);
if (targetSection) {
targetSection.classList.add('active');
}
// Update active nav state
navItems.forEach(nav => nav.classList.remove('active'));
item.classList.add('active');
});
});
// Show first section by default
const firstSection = sections[0];
if (firstSection) {
firstSection.classList.add('active');
}
}
initializeSearch() {
const searchInput = document.getElementById('settingsSearchInput');
const searchClear = document.getElementById('settingsSearchClear');
if (!searchInput) return;
// Debounced search handler
let searchTimeout;
const debouncedSearch = (query) => {
clearTimeout(searchTimeout);
searchTimeout = setTimeout(() => {
this.performSearch(query);
}, 150);
};
// Handle input changes
searchInput.addEventListener('input', (e) => {
const query = e.target.value.trim();
// Show/hide clear button
if (searchClear) {
searchClear.style.display = query ? 'flex' : 'none';
}
debouncedSearch(query);
});
// Handle clear button click
if (searchClear) {
searchClear.addEventListener('click', () => {
searchInput.value = '';
searchClear.style.display = 'none';
searchInput.focus();
this.performSearch('');
});
}
// Handle Escape key to clear search
searchInput.addEventListener('keydown', (e) => {
if (e.key === 'Escape') {
if (searchInput.value) {
searchInput.value = '';
if (searchClear) searchClear.style.display = 'none';
this.performSearch('');
}
}
});
}
performSearch(query) {
const sections = document.querySelectorAll('.settings-section');
const navItems = document.querySelectorAll('.settings-nav-item');
const settingsForm = document.querySelector('.settings-form');
// Remove existing empty state
const existingEmptyState = settingsForm?.querySelector('.settings-search-empty');
if (existingEmptyState) {
existingEmptyState.remove();
}
if (!query) {
// Reset: remove highlights only, keep current section visible
sections.forEach(section => {
this.removeSearchHighlights(section);
});
return;
}
const lowerQuery = query.toLowerCase();
let firstMatchSection = null;
let firstMatchElement = null;
let matchCount = 0;
sections.forEach(section => {
const sectionText = this.getSectionSearchableText(section);
const hasMatch = sectionText.includes(lowerQuery);
if (hasMatch) {
const firstHighlight = this.highlightSearchMatches(section, lowerQuery);
matchCount++;
// Track first match to auto-switch
if (!firstMatchSection) {
firstMatchSection = section;
firstMatchElement = firstHighlight;
}
} else {
this.removeSearchHighlights(section);
}
});
// Auto-switch to first matching section
if (firstMatchSection) {
const sectionId = firstMatchSection.id.replace('section-', '');
// Hide all sections
sections.forEach(section => section.classList.remove('active'));
// Show matching section
firstMatchSection.classList.add('active');
// Update nav active state
navItems.forEach(item => {
item.classList.remove('active');
if (item.dataset.section === sectionId) {
item.classList.add('active');
}
});
// Scroll to first match after a short delay to allow section to become visible
if (firstMatchElement) {
requestAnimationFrame(() => {
firstMatchElement.scrollIntoView({
behavior: 'smooth',
block: 'center'
});
});
}
}
// Show empty state if no matches found
if (matchCount === 0 && settingsForm) {
const emptyState = document.createElement('div');
emptyState.className = 'settings-search-empty';
emptyState.innerHTML = `
<i class="fas fa-search"></i>
<p>${translate('settings.search.noResults', { query }, `No settings found matching "${query}"`)}</p>
`;
settingsForm.appendChild(emptyState);
}
}
getSectionSearchableText(section) {
// Get all text content from labels, help text, and headers
const labels = section.querySelectorAll('label');
const helpTexts = section.querySelectorAll('.input-help');
const headers = section.querySelectorAll('h3');
let text = '';
labels.forEach(el => text += ' ' + el.textContent);
helpTexts.forEach(el => text += ' ' + el.textContent);
headers.forEach(el => text += ' ' + el.textContent);
return text.toLowerCase();
}
highlightSearchMatches(section, query) {
// Remove existing highlights first
this.removeSearchHighlights(section);
if (!query) return null;
// Highlight in labels and help text
const textElements = section.querySelectorAll('label, .input-help, h3');
let firstHighlight = null;
textElements.forEach(element => {
const walker = document.createTreeWalker(
element,
NodeFilter.SHOW_TEXT,
null,
false
);
const textNodes = [];
let node;
while (node = walker.nextNode()) {
if (node.textContent.toLowerCase().includes(query)) {
textNodes.push(node);
}
}
textNodes.forEach(textNode => {
const parent = textNode.parentElement;
const text = textNode.textContent;
const lowerText = text.toLowerCase();
// Split text by query and wrap matches in highlight spans
const parts = [];
let lastIndex = 0;
let index;
while ((index = lowerText.indexOf(query, lastIndex)) !== -1) {
// Add text before match
if (index > lastIndex) {
parts.push(document.createTextNode(text.substring(lastIndex, index)));
}
// Add highlighted match
const highlight = document.createElement('span');
highlight.className = 'settings-search-highlight';
highlight.textContent = text.substring(index, index + query.length);
parts.push(highlight);
// Track first highlight for scrolling
if (!firstHighlight) {
firstHighlight = highlight;
}
lastIndex = index + query.length;
}
// Add remaining text
if (lastIndex < text.length) {
parts.push(document.createTextNode(text.substring(lastIndex)));
}
// Replace original text node with highlighted version
if (parts.length > 1) {
parts.forEach(part => parent.insertBefore(part, textNode));
parent.removeChild(textNode);
}
});
});
return firstHighlight;
}
removeSearchHighlights(section) {
const highlights = section.querySelectorAll('.settings-search-highlight');
highlights.forEach(highlight => {
const parent = highlight.parentElement;
if (parent) {
// Replace highlight with its text content
parent.insertBefore(document.createTextNode(highlight.textContent), highlight);
parent.removeChild(highlight);
// Normalize to merge adjacent text nodes
parent.normalize();
}
});
}
async openSettingsFileLocation() {
try {
const response = await fetch('/api/lm/settings/open-location', {
@@ -526,6 +799,9 @@ export class SettingsManager {
// Load default unet root
await this.loadUnetRoots();
// Load extra folder paths
this.loadExtraFolderPaths();
// Load language setting
const languageSelect = document.getElementById('languageSelect');
if (languageSelect) {
@@ -1028,6 +1304,119 @@ export class SettingsManager {
}
}
loadExtraFolderPaths() {
const extraFolderPaths = state.global.settings.extra_folder_paths || {};
// Load paths for each model type
['loras', 'checkpoints', 'unet', 'embeddings'].forEach((modelType) => {
const container = document.getElementById(`extraFolderPaths-${modelType}`);
if (!container) return;
// Clear existing paths
container.innerHTML = '';
// Add existing paths
const paths = extraFolderPaths[modelType] || [];
paths.forEach((path) => {
this.addExtraFolderPathRow(modelType, path);
});
// Add empty row for new path if no paths exist
if (paths.length === 0) {
this.addExtraFolderPathRow(modelType, '');
}
});
}
addExtraFolderPathRow(modelType, path = '') {
const container = document.getElementById(`extraFolderPaths-${modelType}`);
if (!container) return;
const row = document.createElement('div');
row.className = 'extra-folder-path-row mapping-row';
row.innerHTML = `
<div class="path-controls">
<input type="text" class="extra-folder-path-input"
placeholder="${translate('settings.extraFolderPaths.pathPlaceholder', {}, '/path/to/models')}" value="${path}"
onblur="settingsManager.updateExtraFolderPaths('${modelType}')"
onkeydown="if(event.key === 'Enter') { this.blur(); }" />
<button type="button" class="remove-path-btn"
onclick="this.parentElement.parentElement.remove(); settingsManager.updateExtraFolderPaths('${modelType}')"
title="${translate('common.actions.delete', {}, 'Delete')}">
<i class="fas fa-times"></i>
</button>
</div>
`;
container.appendChild(row);
// Focus the input if it's empty (new row)
if (!path) {
const input = row.querySelector('.extra-folder-path-input');
if (input) {
setTimeout(() => input.focus(), 0);
}
}
}
async updateExtraFolderPaths(changedModelType) {
const extraFolderPaths = {};
// Collect paths for all model types
['loras', 'checkpoints', 'unet', 'embeddings'].forEach((modelType) => {
const container = document.getElementById(`extraFolderPaths-${modelType}`);
if (!container) return;
const inputs = container.querySelectorAll('.extra-folder-path-input');
const paths = [];
inputs.forEach((input) => {
const value = input.value.trim();
if (value) {
paths.push(value);
}
});
extraFolderPaths[modelType] = paths;
});
// Check if paths have actually changed
const currentPaths = state.global.settings.extra_folder_paths || {};
const pathsChanged = JSON.stringify(currentPaths) !== JSON.stringify(extraFolderPaths);
if (!pathsChanged) {
return;
}
// Update state
state.global.settings.extra_folder_paths = extraFolderPaths;
try {
// Save to backend - this triggers path validation
await this.saveSetting('extra_folder_paths', extraFolderPaths);
showToast('toast.settings.settingsUpdated', { setting: 'Extra Folder Paths' }, 'success');
// Add empty row if no valid paths exist for the changed type
const container = document.getElementById(`extraFolderPaths-${changedModelType}`);
if (container) {
const inputs = container.querySelectorAll('.extra-folder-path-input');
const hasEmptyRow = Array.from(inputs).some((input) => !input.value.trim());
if (!hasEmptyRow) {
this.addExtraFolderPathRow(changedModelType, '');
}
}
} catch (error) {
console.error('Failed to save extra folder paths:', error);
showToast('toast.settings.settingSaveFailed', { message: error.message }, 'error');
// Restore previous state on error
state.global.settings.extra_folder_paths = currentPaths;
this.loadExtraFolderPaths();
}
}
loadBaseModelMappings() {
const mappingsContainer = document.getElementById('baseModelMappingsContainer');
if (!mappingsContainer) return;

View File

@@ -457,6 +457,14 @@ function getWidgetNames(node) {
return [];
}
function isNodeEnabled(node) {
if (!node) {
return false;
}
// ComfyUI node mode: 0 = Normal/Enabled, others = Always/Never/OnEvent
return node.mode === undefined || node.mode === 0;
}
function isAbsolutePath(path) {
if (typeof path !== 'string') {
return false;
@@ -507,7 +515,7 @@ export async function sendLoraToWorkflow(loraSyntax, replaceMode = false, syntax
}
const loraNodes = filterRegistryNodes(registry.nodes, (node) => {
if (!node) {
if (!isNodeEnabled(node)) {
return false;
}
if (node.capabilities && typeof node.capabilities === 'object') {
@@ -569,6 +577,9 @@ export async function sendModelPathToWorkflow(modelPath, options) {
}
const targetNodes = filterRegistryNodes(registry.nodes, (node) => {
if (!isNodeEnabled(node)) {
return false;
}
const widgetNames = getWidgetNames(node);
return widgetNames.includes(widgetName);
});

File diff suppressed because it is too large Load Diff

View File

@@ -215,3 +215,110 @@ def test_save_paths_removes_template_default_library(monkeypatch, tmp_path):
)
assert payload["metadata"] == {"display_name": "ComfyUI", "source": "comfyui"}
assert payload["activate"] is True
def test_apply_library_settings_merges_extra_paths(monkeypatch, tmp_path):
"""Test that apply_library_settings correctly merges folder_paths with extra_folder_paths."""
loras_dir = tmp_path / "loras"
extra_loras_dir = tmp_path / "extra_loras"
checkpoints_dir = tmp_path / "checkpoints"
extra_checkpoints_dir = tmp_path / "extra_checkpoints"
embeddings_dir = tmp_path / "embeddings"
extra_embeddings_dir = tmp_path / "extra_embeddings"
for directory in (loras_dir, extra_loras_dir, checkpoints_dir, extra_checkpoints_dir, embeddings_dir, extra_embeddings_dir):
directory.mkdir()
config_instance = config_module.Config()
folder_paths = {
"loras": [str(loras_dir)],
"checkpoints": [str(checkpoints_dir)],
"unet": [],
"embeddings": [str(embeddings_dir)],
}
extra_folder_paths = {
"loras": [str(extra_loras_dir)],
"checkpoints": [str(extra_checkpoints_dir)],
"unet": [],
"embeddings": [str(extra_embeddings_dir)],
}
library_config = {
"folder_paths": folder_paths,
"extra_folder_paths": extra_folder_paths,
}
config_instance.apply_library_settings(library_config)
assert str(loras_dir) in config_instance.loras_roots
assert str(extra_loras_dir) in config_instance.extra_loras_roots
assert str(checkpoints_dir) in config_instance.base_models_roots
assert str(extra_checkpoints_dir) in config_instance.extra_checkpoints_roots
assert str(embeddings_dir) in config_instance.embeddings_roots
assert str(extra_embeddings_dir) in config_instance.extra_embeddings_roots
def test_apply_library_settings_without_extra_paths(monkeypatch, tmp_path):
"""Test that apply_library_settings works when extra_folder_paths is not provided."""
loras_dir = tmp_path / "loras"
checkpoints_dir = tmp_path / "checkpoints"
embeddings_dir = tmp_path / "embeddings"
for directory in (loras_dir, checkpoints_dir, embeddings_dir):
directory.mkdir()
config_instance = config_module.Config()
folder_paths = {
"loras": [str(loras_dir)],
"checkpoints": [str(checkpoints_dir)],
"unet": [],
"embeddings": [str(embeddings_dir)],
}
library_config = {
"folder_paths": folder_paths,
}
config_instance.apply_library_settings(library_config)
assert str(loras_dir) in config_instance.loras_roots
assert config_instance.extra_loras_roots == []
assert str(checkpoints_dir) in config_instance.base_models_roots
assert config_instance.extra_checkpoints_roots == []
assert str(embeddings_dir) in config_instance.embeddings_roots
assert config_instance.extra_embeddings_roots == []
def test_extra_paths_deduplication(monkeypatch, tmp_path):
"""Test that extra paths are stored separately from main paths in Config."""
loras_dir = tmp_path / "loras"
extra_loras_dir = tmp_path / "extra_loras"
loras_dir.mkdir()
extra_loras_dir.mkdir()
config_instance = config_module.Config()
folder_paths = {
"loras": [str(loras_dir)],
"checkpoints": [],
"unet": [],
"embeddings": [],
}
extra_folder_paths = {
"loras": [str(extra_loras_dir)],
"checkpoints": [],
"unet": [],
"embeddings": [],
}
library_config = {
"folder_paths": folder_paths,
"extra_folder_paths": extra_folder_paths,
}
config_instance.apply_library_settings(library_config)
assert config_instance.loras_roots == [str(loras_dir)]
assert config_instance.extra_loras_roots == [str(extra_loras_dir)]

View File

@@ -74,11 +74,15 @@ sys.modules['folder_paths'] = folder_paths_mock
# Mock other ComfyUI modules that might be imported
comfy_mock = MockModule("comfy")
comfy_mock.utils = MockModule("comfy.utils")
comfy_mock.utils.load_torch_file = mock.MagicMock(return_value={})
comfy_mock.sd = MockModule("comfy.sd")
comfy_mock.sd.load_lora_for_models = mock.MagicMock(return_value=(None, None))
comfy_mock.model_management = MockModule("comfy.model_management")
comfy_mock.comfy_types = MockModule("comfy.comfy_types")
comfy_mock.comfy_types.IO = mock.MagicMock()
sys.modules['comfy'] = comfy_mock
sys.modules['comfy.utils'] = comfy_mock.utils
sys.modules['comfy.sd'] = comfy_mock.sd
sys.modules['comfy.model_management'] = comfy_mock.model_management
sys.modules['comfy.comfy_types'] = comfy_mock.comfy_types

View File

@@ -0,0 +1,271 @@
"""Tests for checkpoint lazy hash calculation feature."""
import json
import os
from pathlib import Path
from typing import List
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from py.services import model_scanner
from py.services.checkpoint_scanner import CheckpointScanner
from py.services.model_scanner import ModelScanner
from py.utils.models import CheckpointMetadata
class RecordingWebSocketManager:
def __init__(self) -> None:
self.payloads: List[dict] = []
async def broadcast_init_progress(self, payload: dict) -> None:
self.payloads.append(payload)
def _normalize(path: Path) -> str:
return str(path).replace(os.sep, "/")
@pytest.fixture(autouse=True)
def reset_model_scanner_singletons():
ModelScanner._instances.clear()
ModelScanner._locks.clear()
yield
ModelScanner._instances.clear()
ModelScanner._locks.clear()
@pytest.mark.asyncio
async def test_checkpoint_default_metadata_has_pending_hash(tmp_path: Path, monkeypatch):
"""Test that checkpoint metadata is created with hash_status='pending' and empty sha256."""
checkpoints_root = tmp_path / "checkpoints"
checkpoints_root.mkdir()
# Create a fake checkpoint file (small for testing)
checkpoint_file = checkpoints_root / "test_model.safetensors"
checkpoint_file.write_text("fake checkpoint content", encoding="utf-8")
normalized_root = _normalize(checkpoints_root)
normalized_file = _normalize(checkpoint_file)
monkeypatch.setattr(
model_scanner.config,
"base_models_roots",
[normalized_root],
raising=False,
)
monkeypatch.setattr(
model_scanner.config,
"checkpoints_roots",
[normalized_root],
raising=False,
)
scanner = CheckpointScanner()
# Create default metadata
metadata = await scanner._create_default_metadata(normalized_file)
assert metadata is not None
assert metadata.sha256 == "", "sha256 should be empty for lazy hash"
assert metadata.hash_status == "pending", "hash_status should be 'pending'"
assert metadata.from_civitai is False, "from_civitai should be False for local models"
assert metadata.file_name == "test_model"
@pytest.mark.asyncio
async def test_checkpoint_metadata_saved_to_disk_with_pending_status(tmp_path: Path, monkeypatch):
"""Test that pending metadata is saved to .metadata.json file."""
checkpoints_root = tmp_path / "checkpoints"
checkpoints_root.mkdir()
checkpoint_file = checkpoints_root / "test_model.safetensors"
checkpoint_file.write_text("fake content", encoding="utf-8")
normalized_root = _normalize(checkpoints_root)
normalized_file = _normalize(checkpoint_file)
monkeypatch.setattr(
model_scanner.config,
"base_models_roots",
[normalized_root],
raising=False,
)
scanner = CheckpointScanner()
# Create metadata
metadata = await scanner._create_default_metadata(normalized_file)
assert metadata is not None
# Verify the metadata file was created
metadata_file = checkpoints_root / "test_model.metadata.json"
assert metadata_file.exists(), "Metadata file should be created"
# Load and verify content
with open(metadata_file, "r", encoding="utf-8") as f:
saved_data = json.load(f)
assert saved_data.get("sha256") == "", "Saved sha256 should be empty"
assert saved_data.get("hash_status") == "pending", "Saved hash_status should be 'pending'"
@pytest.mark.asyncio
async def test_calculate_hash_for_model_completes_pending(tmp_path: Path, monkeypatch):
"""Test that calculate_hash_for_model updates status to 'completed'."""
checkpoints_root = tmp_path / "checkpoints"
checkpoints_root.mkdir()
checkpoint_file = checkpoints_root / "test_model.safetensors"
checkpoint_file.write_text("fake content for hashing", encoding="utf-8")
normalized_root = _normalize(checkpoints_root)
normalized_file = _normalize(checkpoint_file)
monkeypatch.setattr(
model_scanner.config,
"base_models_roots",
[normalized_root],
raising=False,
)
scanner = CheckpointScanner()
# Create pending metadata
metadata = await scanner._create_default_metadata(normalized_file)
assert metadata is not None
assert metadata.hash_status == "pending"
# Calculate hash
hash_result = await scanner.calculate_hash_for_model(normalized_file)
assert hash_result is not None, "Hash calculation should succeed"
assert len(hash_result) == 64, "SHA256 should be 64 hex characters"
# Verify metadata was updated
metadata_file = checkpoints_root / "test_model.metadata.json"
with open(metadata_file, "r", encoding="utf-8") as f:
saved_data = json.load(f)
assert saved_data.get("sha256") == hash_result, "sha256 should be updated"
assert saved_data.get("hash_status") == "completed", "hash_status should be 'completed'"
@pytest.mark.asyncio
async def test_calculate_hash_skips_if_already_completed(tmp_path: Path, monkeypatch):
"""Test that calculate_hash_for_model skips calculation if already completed."""
checkpoints_root = tmp_path / "checkpoints"
checkpoints_root.mkdir()
checkpoint_file = checkpoints_root / "test_model.safetensors"
checkpoint_file.write_text("fake content", encoding="utf-8")
normalized_root = _normalize(checkpoints_root)
normalized_file = _normalize(checkpoint_file)
monkeypatch.setattr(
model_scanner.config,
"base_models_roots",
[normalized_root],
raising=False,
)
scanner = CheckpointScanner()
# Create metadata with completed hash
metadata = CheckpointMetadata(
file_name="test_model",
model_name="test_model",
file_path=normalized_file,
size=100,
modified=1234567890.0,
sha256="existing_hash_value",
base_model="Unknown",
preview_url="",
hash_status="completed",
from_civitai=False,
)
# Save metadata first
from py.utils.metadata_manager import MetadataManager
await MetadataManager.save_metadata(normalized_file, metadata)
# Calculate hash should return existing value
with patch("py.utils.file_utils.calculate_sha256") as mock_calc:
mock_calc.return_value = "new_calculated_hash"
hash_result = await scanner.calculate_hash_for_model(normalized_file)
assert hash_result == "existing_hash_value", "Should return existing hash"
mock_calc.assert_not_called(), "Should not recalculate if already completed"
@pytest.mark.asyncio
async def test_calculate_all_pending_hashes(tmp_path: Path, monkeypatch):
"""Test bulk hash calculation for all pending checkpoints."""
checkpoints_root = tmp_path / "checkpoints"
checkpoints_root.mkdir()
# Create multiple checkpoint files
for i in range(3):
checkpoint_file = checkpoints_root / f"model_{i}.safetensors"
checkpoint_file.write_text(f"content {i}", encoding="utf-8")
normalized_root = _normalize(checkpoints_root)
monkeypatch.setattr(
model_scanner.config,
"base_models_roots",
[normalized_root],
raising=False,
)
scanner = CheckpointScanner()
# Create pending metadata for all models
for i in range(3):
checkpoint_file = checkpoints_root / f"model_{i}.safetensors"
await scanner._create_default_metadata(_normalize(checkpoint_file))
# Mock progress callback
progress_calls = []
async def progress_callback(current, total, file_path):
progress_calls.append((current, total, file_path))
# Calculate all pending hashes
result = await scanner.calculate_all_pending_hashes(progress_callback)
assert result["total"] == 3, "Should find 3 pending models"
assert result["completed"] == 3, "Should complete all 3"
assert result["failed"] == 0, "Should not fail any"
assert len(progress_calls) == 3, "Progress callback should be called 3 times"
@pytest.mark.asyncio
async def test_lora_scanner_not_affected(tmp_path: Path, monkeypatch):
"""Test that LoraScanner still calculates hash during initial scan."""
from py.services.lora_scanner import LoraScanner
loras_root = tmp_path / "loras"
loras_root.mkdir()
lora_file = loras_root / "test_lora.safetensors"
lora_file.write_text("fake lora content", encoding="utf-8")
normalized_root = _normalize(loras_root)
monkeypatch.setattr(
model_scanner.config,
"loras_roots",
[normalized_root],
raising=False,
)
# Reset singleton for LoraScanner
if LoraScanner in ModelScanner._instances:
del ModelScanner._instances[LoraScanner]
scanner = LoraScanner()
# LoraScanner should use parent's _create_default_metadata which calculates hash
# We verify this by checking that it doesn't override the method
assert scanner._create_default_metadata.__qualname__ == "ModelScanner._create_default_metadata"

View File

@@ -132,4 +132,59 @@ async def test_persisted_cache_restores_model_type(tmp_path: Path, monkeypatch):
assert types_by_path[normalized_unet_file] == "diffusion_model"
assert ws_stub.payloads
assert ws_stub.payloads[-1]["stage"] == "loading_cache"
@pytest.mark.asyncio
async def test_checkpoint_scanner_get_model_roots_includes_extra_paths(monkeypatch, tmp_path):
"""Test that get_model_roots includes both main and extra paths."""
checkpoints_root = tmp_path / "checkpoints"
extra_checkpoints_root = tmp_path / "extra_checkpoints"
unet_root = tmp_path / "unet"
extra_unet_root = tmp_path / "extra_unet"
for directory in (checkpoints_root, extra_checkpoints_root, unet_root, extra_unet_root):
directory.mkdir()
normalized_checkpoints = _normalize(checkpoints_root)
normalized_extra_checkpoints = _normalize(extra_checkpoints_root)
normalized_unet = _normalize(unet_root)
normalized_extra_unet = _normalize(extra_unet_root)
monkeypatch.setattr(
model_scanner.config,
"base_models_roots",
[normalized_checkpoints, normalized_unet],
raising=False,
)
monkeypatch.setattr(
model_scanner.config,
"checkpoints_roots",
[normalized_checkpoints],
raising=False,
)
monkeypatch.setattr(
model_scanner.config,
"unet_roots",
[normalized_unet],
raising=False,
)
monkeypatch.setattr(
model_scanner.config,
"extra_checkpoints_roots",
[normalized_extra_checkpoints],
raising=False,
)
monkeypatch.setattr(
model_scanner.config,
"extra_unet_roots",
[normalized_extra_unet],
raising=False,
)
scanner = CheckpointScanner()
roots = scanner.get_model_roots()
assert normalized_checkpoints in roots
assert normalized_unet in roots
assert normalized_extra_checkpoints in roots
assert normalized_extra_unet in roots

View File

@@ -470,6 +470,100 @@ def test_upsert_library_creates_entry_and_activates(manager, tmp_path):
assert str(lora_dir).replace(os.sep, "/") in normalized_stored_paths
def test_extra_folder_paths_stored_separately(manager, tmp_path):
lora_dir = tmp_path / "loras"
extra_dir = tmp_path / "extra_loras"
lora_dir.mkdir()
extra_dir.mkdir()
manager.upsert_library(
"test_library",
folder_paths={"loras": [str(lora_dir)]},
extra_folder_paths={"loras": [str(extra_dir)]},
activate=True,
)
libraries = manager.get_libraries()
lib = libraries["test_library"]
# Verify folder_paths contains main path
assert str(lora_dir) in lib["folder_paths"]["loras"]
# Verify extra_folder_paths contains extra path
assert str(extra_dir) in lib["extra_folder_paths"]["loras"]
# Verify they are separate
assert str(extra_dir) not in lib["folder_paths"]["loras"]
def test_get_extra_folder_paths(manager, tmp_path):
extra_dir = tmp_path / "extra_loras"
extra_dir.mkdir()
manager.update_extra_folder_paths({"loras": [str(extra_dir)]})
extra_paths = manager.get_extra_folder_paths()
assert str(extra_dir) in extra_paths.get("loras", [])
def test_library_switch_preserves_extra_paths(manager, tmp_path):
"""Test that switching libraries preserves each library's extra paths."""
lora_dir1 = tmp_path / "lib1_loras"
extra_dir1 = tmp_path / "lib1_extra"
lora_dir2 = tmp_path / "lib2_loras"
extra_dir2 = tmp_path / "lib2_extra"
for directory in (lora_dir1, extra_dir1, lora_dir2, extra_dir2):
directory.mkdir()
manager.create_library(
"library1",
folder_paths={"loras": [str(lora_dir1)]},
extra_folder_paths={"loras": [str(extra_dir1)]},
activate=True,
)
manager.create_library(
"library2",
folder_paths={"loras": [str(lora_dir2)]},
extra_folder_paths={"loras": [str(extra_dir2)]},
)
assert manager.get_active_library_name() == "library1"
lib1 = manager.get_active_library()
assert str(lora_dir1) in lib1["folder_paths"]["loras"]
assert str(extra_dir1) in lib1["extra_folder_paths"]["loras"]
manager.activate_library("library2")
assert manager.get_active_library_name() == "library2"
lib2 = manager.get_active_library()
assert str(lora_dir2) in lib2["folder_paths"]["loras"]
assert str(extra_dir2) in lib2["extra_folder_paths"]["loras"]
def test_extra_paths_validation_no_overlap_with_other_libraries(manager, tmp_path):
"""Test that extra paths cannot overlap with other libraries' paths."""
lora_dir1 = tmp_path / "lib1_loras"
lora_dir1.mkdir()
manager.create_library(
"library1",
folder_paths={"loras": [str(lora_dir1)]},
activate=True,
)
extra_dir = tmp_path / "extra_loras"
extra_dir.mkdir()
manager.create_library(
"library2",
folder_paths={"loras": [str(extra_dir)]},
activate=True,
)
with pytest.raises(ValueError, match="already assigned to library"):
manager.update_extra_folder_paths({"loras": [str(lora_dir1)]})
def test_delete_library_switches_active(manager, tmp_path):
other_dir = tmp_path / "other"
other_dir.mkdir()

View File

@@ -147,7 +147,23 @@ function createLoraRandomizerWidget(node) {
forwardMiddleMouseToCanvas(container)
let internalValue: RandomizerConfig | undefined
// Initialize with default config to avoid sending undefined/empty string to backend
const defaultConfig: RandomizerConfig = {
count_mode: 'range',
count_fixed: 3,
count_min: 2,
count_max: 5,
model_strength_min: 0.0,
model_strength_max: 1.0,
use_same_clip_strength: true,
clip_strength_min: 0.0,
clip_strength_max: 1.0,
roll_mode: 'fixed',
use_recommended_strength: false,
recommended_strength_scale_min: 0.5,
recommended_strength_scale_max: 1.0,
}
let internalValue: RandomizerConfig = defaultConfig
const widget = node.addDOMWidget(
'randomizer_config',

View File

@@ -16,6 +16,9 @@ const PROMPT_TAG_AUTOCOMPLETE_DEFAULT = true;
const TAG_SPACE_REPLACEMENT_SETTING_ID = "loramanager.tag_space_replacement";
const TAG_SPACE_REPLACEMENT_DEFAULT = false;
const USAGE_STATISTICS_SETTING_ID = "loramanager.usage_statistics";
const USAGE_STATISTICS_DEFAULT = true;
// ============================================================================
// Helper Functions
// ============================================================================
@@ -124,6 +127,32 @@ const getTagSpaceReplacementPreference = (() => {
};
})();
const getUsageStatisticsPreference = (() => {
let settingsUnavailableLogged = false;
return () => {
const settingManager = app?.extensionManager?.setting;
if (!settingManager || typeof settingManager.get !== "function") {
if (!settingsUnavailableLogged) {
console.warn("LoRA Manager: settings API unavailable, using default usage statistics setting.");
settingsUnavailableLogged = true;
}
return USAGE_STATISTICS_DEFAULT;
}
try {
const value = settingManager.get(USAGE_STATISTICS_SETTING_ID);
return value ?? USAGE_STATISTICS_DEFAULT;
} catch (error) {
if (!settingsUnavailableLogged) {
console.warn("LoRA Manager: unable to read usage statistics setting, using default.", error);
settingsUnavailableLogged = true;
}
return USAGE_STATISTICS_DEFAULT;
}
};
})();
// ============================================================================
// Register Extension with All Settings
// ============================================================================
@@ -168,6 +197,14 @@ app.registerExtension({
tooltip: "When enabled, tag names with underscores will have them replaced with spaces when inserted (e.g., 'blonde_hair' becomes 'blonde hair').",
category: ["LoRA Manager", "Autocomplete", "Tag Formatting"],
},
{
id: USAGE_STATISTICS_SETTING_ID,
name: "Enable usage statistics tracking",
type: "boolean",
defaultValue: USAGE_STATISTICS_DEFAULT,
tooltip: "When enabled, LoRA Manager will track model usage statistics during workflow execution. Disabling this will prevent unnecessary disk writes.",
category: ["LoRA Manager", "Statistics", "Usage Tracking"],
},
],
});
@@ -175,4 +212,4 @@ app.registerExtension({
// Exports
// ============================================================================
export { getWheelSensitivity, getAutoPathCorrectionPreference, getPromptTagAutocompletePreference, getTagSpaceReplacementPreference };
export { getWheelSensitivity, getAutoPathCorrectionPreference, getPromptTagAutocompletePreference, getTagSpaceReplacementPreference, getUsageStatisticsPreference };

View File

@@ -2,7 +2,7 @@
import { app } from "../../scripts/app.js";
import { api } from "../../scripts/api.js";
import { showToast } from "./utils.js";
import { getAutoPathCorrectionPreference } from "./settings.js";
import { getAutoPathCorrectionPreference, getUsageStatisticsPreference } from "./settings.js";
// Define target nodes and their widget configurations
const PATH_CORRECTION_TARGETS = [
@@ -25,6 +25,11 @@ app.registerExtension({
setup() {
// Listen for successful executions
api.addEventListener("execution_success", ({ detail }) => {
// Skip if usage statistics is disabled
if (!getUsageStatisticsPreference()) {
return;
}
if (detail && detail.prompt_id) {
this.updateUsageStats(detail.prompt_id);
}

View File

@@ -14695,7 +14695,22 @@ function createLoraRandomizerWidget(node) {
container.style.flexDirection = "column";
container.style.overflow = "hidden";
forwardMiddleMouseToCanvas(container);
let internalValue;
const defaultConfig = {
count_mode: "range",
count_fixed: 3,
count_min: 2,
count_max: 5,
model_strength_min: 0,
model_strength_max: 1,
use_same_clip_strength: true,
clip_strength_min: 0,
clip_strength_max: 1,
roll_mode: "fixed",
use_recommended_strength: false,
recommended_strength_scale_min: 0.5,
recommended_strength_scale_max: 1
};
let internalValue = defaultConfig;
const widget = node.addDOMWidget(
"randomizer_config",
"RANDOMIZER_CONFIG",

File diff suppressed because one or more lines are too long

View File

@@ -62,6 +62,7 @@ app.registerExtension({
title: node.title || node.comfyClass,
type: node.comfyClass,
comfy_class: node.comfyClass,
mode: node.mode,
capabilities: {
supports_lora: supportsLora,
widget_names: widgetNames,