Commit Graph
13 Commits
Author SHA1 Message Date
Dariusz L b64597fd3f Add CivitAI URN download UI and metadata
Move direct URN->CivitAI download handling into the frontend and enrich backend metadata. Removed server-side immediate URN download exposure and adjusted comment numbering. Backend now selects a primary file from resolved CivitAI model info, includes model_id, version_id, size, and a modelVersionId query on model URLs.

Frontend: add renderDownloadSourceSection to render download buttons and CivitAI model-card links, display file sizes, and format names. Store missingModels for later updates; render a placeholder URN download section while resolving; when URN resolution returns, inject civitai info into the missing entry, build a download_source object, replace the placeholder with the rendered download UI, and attach the download button handler. Improved error handling and model URL construction to include modelVersionId when available.
2026-04-24 20:38:11 +02:00
Dariusz L c8272a8a45 Add source-filtered search and URN CivitAI support
Backend: add explicit URN handling to resolve CivitAI model/version into a direct download source; normalize and accept a `sources` parameter (local, huggingface, civitai, all) and drive per-source searching. Reorder and tighten search logic (local/popular, model-list, HuggingFace, CivitAI) and include `searched_sources` in results and improved logging. Frontend: add per-missing-item search result cache and state, UI buttons to pick search sources, merge incremental results instead of overwriting, show selected-source helper text, pass selected source to the server, clear cache on refresh, and improve search status messages and UX. Overall: enables targeted online searches, preserves previous results, and surfaces direct CivitAI downloads for URNs.
2026-04-24 19:27:53 +02:00
Dariusz L 4fef6c66d9 Defer CivitAI lookups; add async URN resolution
Stop performing automatic online searches during scanning and matching: HuggingFace/CivitAI lookups are no longer done synchronously for each missing file. Core linker now marks URN entries for async resolution instead of calling CivitAI during scan, avoiding blocking network calls and reducing noise. Server-side /model_linker/search remains the on-demand endpoint; __init__.py adds resolve_urn import and tightens validation for URN requests (require model_id+version_id for URN-only requests). Frontend (web/linker.js) updated to show a loading indicator for URN entries and to fetch CivitAI info asynchronously via a new resolveUrnAsync() routine, then update the UI when results arrive. Also includes minor formatting/import grouping and UI label tweaks.
2026-04-23 05:02:08 +02:00
Dariusz L 236ca180e9 Use log_system helpers for module logging
Replace direct uses of the logging module and module-level loggers with the centralized log_system.log_funcs (log_debug/log_info/log_warn/log_error/log_exception) across multiple modules. Updated imports and removed unused logging.getLogger() instances in downloader, scanner, sources (civitai, huggingface, model_list, popular), workflow_analyzer, workflow_updater, and __init__.py. Minor message/text tweaks and import formatting applied; behavior unchanged aside from routing logs through the shared logging helpers.
2026-04-22 00:08:51 +02:00
Dariusz L e8b49dd184 Add AzLogs logging system and integrate
Introduce a new logging subsystem under core/log_system (logger.py, config.py, log_funcs.py) implementing AzLogs (LogLevel enum, colored console output, optional file rotation) and a lightweight wrapper (log_debug/info/warn/error/exception) with safe fallback when AzLogs is unavailable. Integrate these log functions across many core modules (downloader, linker, matcher, scanner, workflow_analyzer, workflow_updater, sources and related files) and export logger and helper log functions from core.__init__. Replace several direct logging calls in linker with the new log_* helpers and update core.__init__ exports. Also include small code style and robustness tweaks (path/filename normalization, JSON/file handling, minor refactors and formatting fixes) to improve matching and model-list/popular lookups.
2026-04-21 23:51:46 +02:00
Dariusz L 040fa64584 Add CivitAI hash lookup and context menu UI
Enhance model linking with CivitAI integration and UI improvements.

- __init__.py: Expand model path resolution by building filename→path lookup (including no-ext keys) and using folder_paths to map common categories; add a /model_linker/civitai-search POST route that attempts metadata/hash-based lookup (or filename fallback) and returns CivitAI model/version info for the frontend.
- core/sources/civitai.py: Add hashing and metadata handling utilities: _get_sha256_hash, metadata discovery/reading, helpers to extract images/trained-words, get_model_info_by_hash and get_model_info_for_file (which prefers local metadata and otherwise queries CivitAI by hash). Also tidy/normalize existing search/resolve functions and add caching for hash lookups.
- web/linker.js: Add a right-click context menu for model chips with actions (Show Info, Open in CivitAI), implement dialog UI to display model info, and wire calls to the new civitai-search endpoint. Includes positioning/closing behavior and dialog population from returned data.

These changes enable accurate model identification via local metadata or sha256 lookups on CivitAI and provide convenient frontend actions to view model details or open CivitAI pages.
2026-04-21 20:35:10 +02:00
Dariusz L 259e491c96 Handle LoraManager lora detection and updates
Filter out LoraManager (LoraLoaderV2) entries that already exist locally so they don't appear as missing, and skip matching for those entries. Integrate scanner data to detect local lora files (full_path/exists) in workflow analysis. Add special handling in update_model_path/update_workflow_nodes to update LoraManager lora lists and the formatted lora text widget (widgets_values[2] and [1]) when a new lora is resolved, using mapping fields is_lora_v2 and original_lora_name. Improve convert_to_relative_path and get_base_directory_for_model to prefer folder_paths lookup and preserve exact ComfyUI filename formats. In the web UI, make resolve button IDs unique by including a missingIndex, avoid duplicate listeners, forward is_lora_v2/original_lora_name to the resolve API, and add extra logging for debugging.
2026-04-18 02:51:06 +02:00
Dariusz L 50fe87c99d Support LoraV2 active/inactive and UI filters
Add support for text-based Lora loaders (LoraLoaderV2 / LoraManager) and mark model refs with activity/connection state, plus UI improvements.

- __init__.py: clarify comment and propagate new flags from refs (is_lora_v2, active, connected).
- core/workflow_analyzer.py: reformatting and small style changes; add LoraLoaderV2 and LoraManager node hints; detect node connected/bypassed state; parse text-based Lora widget lists (name/strength/active) and emit model refs with strength, is_lora_v2, active and connected flags; include connected flag for URN and file refs; keep existing URN/file resolution and dedup logic but annotate refs with subgraph/context info.
- web/linker.js: group loaded models into active/inactive per-category, add UI filter buttons (All / Active / Inactive), separate copy buttons for active/inactive/all, update display to indicate active vs inactive models and copy behavior, and add global helper functions for filtering and clipboard operations.

These changes enable accurate detection of LoraV2 loader states and provide a clearer UI for copying model spec strings while preserving existing behavior for standard loaders.
2026-04-18 01:12:10 +02:00
Dariusz L 25b424bab9 Add Loaded Models API and UI tab
Add a new POST /model_linker/loaded API that analyzes a workflow JSON to extract all referenced models (including URNs, embedded node.properties.models and Lora strength extraction) and returns a structured list of loaded models. Update the LinkerManagerDialog UI: add tabs (Missing Models / Loaded Models), styles for the loaded models view, tab switching logic, and new functions to load and render loaded models grouped by category with copy buttons and a consolidated copy-all string. Also hide download/auto-resolve controls when viewing the Loaded Models tab and adjust header layout to accommodate the tabs. Error handling and logging were added for robust API behavior.
2026-04-18 00:21:09 +02:00
Dariusz L 3ab6a9cc55 Enhance Model Linker routes, downloader, and linker
Refactor and harden the Model Linker extension: normalize string quoting/formatting and improve logging and error responses across API routes. Make route registration more robust to missing PromptServer and dependencies. Add/expand download-related features: safer request parsing (including is_urn handling), CivitAI URN support & direct download URL resolution, popular/model-list/HuggingFace/CivitAI search fallbacks, improved header handling for HF/CivitAI, and better category/directory mapping. Improve downloader reliability and UX: folder_paths fallback, pre-initialize download progress entries, smoother speed calculation and CLI logging, cancellation cleanup on Windows, stronger exception handling, and consistent JSON responses from endpoints.
2026-04-17 21:23:25 +02:00
unknown 91acff7c78 Enhance download system with speed display, workflow URLs, and UX improvements 2026-01-18 15:59:27 +01:00
unknown 2843373c58 Add download integration with auto-search on startup 2026-01-18 05:44:31 +01:00
unknown 7b972d6dfa chore: Rename comfyui-Model-Linker to comfyui-model-linker (kebab-case) 2025-11-01 19:15:03 +01:00