Compare commits

..
108 Commits
Author SHA1 Message Date
m0rtus59 59e69ffebe Merge pull request #20 from m0rtus59/docs/icon-and-banner
Docs/icon and banner
2026-11-23 00:43:48 +05:00
m0rtus59 f5aacadd34 Merge pull request #19 from m0rtus59/docs/queue-controls-overview
Docs/queue controls overview
2026-11-23 00:42:58 +05:00
m0rtus59 b9a0271fca Merge pull request #18 from m0rtus59/experimental/gallery-similar-preview-navigation
Experimental/gallery similar preview navigation
2026-11-23 00:42:15 +05:00
Claude b2822c6af7 Bump version to 1.9.0 2026-11-22 19:40:31 +00:00
Claude 1c5f0e135e pyproject: add Registry Banner (21:9) 2026-11-22 19:39:35 +00:00
Claude 9685fa53b4 Branding: new Comfy Sidebar icon (yellow wordmark) and 21:9 banner; banner at top of README 2026-11-22 19:37:20 +00:00
Claude eda45eaa6f docs: Queue overview with batch widget pointer and Ctrl actions; mention Move to Outputs in README 2026-11-22 19:20:13 +00:00
m0rtus59 ddd15259e0 Hide avatar button without relying on localized labels 2026-11-22 22:52:55 +05:00
m0rtus59 2cda35562a Translate Hide Run on Comfy Cloud setting 2026-11-22 22:46:11 +05:00
m0rtus59 9e6672cddd Translate Hide Run on Comfy Cloud setting 2026-11-22 22:46:08 +05:00
m0rtus59 2beae3a017 Translate Hide Run on Comfy Cloud setting 2026-11-22 22:46:06 +05:00
m0rtus59 ee7768120a Translate Hide Run on Comfy Cloud setting 2026-11-22 22:46:04 +05:00
m0rtus59 a270c268ba Translate Hide Run on Comfy Cloud setting 2026-11-22 22:46:02 +05:00
m0rtus59 c8496a0d2c Translate Hide Run on Comfy Cloud setting 2026-11-22 22:46:00 +05:00
m0rtus59 9df90421c3 Translate Hide Run on Comfy Cloud setting 2026-11-22 22:45:58 +05:00
m0rtus59 5354fe7854 Translate Hide Run on Comfy Cloud setting 2026-11-22 22:45:56 +05:00
m0rtus59 b4b4bb2ed9 Translate Hide Run on Comfy Cloud setting 2026-11-22 22:45:44 +05:00
m0rtus59 ce414d710a Translate Hide Run on Comfy Cloud setting 2026-11-22 22:45:42 +05:00
m0rtus59 37569315bd Translate Hide Run on Comfy Cloud setting 2026-11-22 22:45:40 +05:00
m0rtus59 867adcfc8d Translate Hide Run on Comfy Cloud setting 2026-11-22 22:45:38 +05:00
m0rtus59 7d684125a6 Translate Hide Run on Comfy Cloud setting 2026-11-22 22:45:36 +05:00
m0rtus59 e8873eeb83 Translate Hide Run on Comfy Cloud setting 2026-11-22 22:45:34 +05:00
m0rtus59 79bd741f77 Add Hide junk setting for Comfy Cloud button 2026-11-22 22:45:09 +05:00
m0rtus59 33951dd82a Add Hide junk support for Comfy Cloud button 2026-11-22 22:45:07 +05:00
m0rtus59 4aeeccb11f Match Active queue button without translated text 2026-11-22 22:45:05 +05:00
m0rtus59 190f1ff999 Add translations for experimental gallery and preview UI 2026-11-22 22:24:18 +05:00
m0rtus59 f134976f6b Add translations for experimental gallery and preview UI 2026-11-22 22:24:16 +05:00
m0rtus59 f6a97a8f4d Add translations for experimental gallery and preview UI 2026-11-22 22:24:14 +05:00
m0rtus59 bbbd27c2f7 Add translations for experimental gallery and preview UI 2026-11-22 22:24:13 +05:00
m0rtus59 3d391bfff3 Add translations for experimental gallery and preview UI 2026-11-22 22:24:11 +05:00
m0rtus59 5b1118c962 Add translations for experimental gallery and preview UI 2026-11-22 22:24:09 +05:00
m0rtus59 1df1d5f47e Add translations for experimental gallery and preview UI 2026-11-22 22:24:07 +05:00
m0rtus59 ce2c16a4a4 Add translations for experimental gallery and preview UI 2026-11-22 22:23:56 +05:00
m0rtus59 3d8af78a12 Add translations for experimental gallery and preview UI 2026-11-22 22:23:54 +05:00
m0rtus59 ca3cc677a6 Add translations for experimental gallery and preview UI 2026-11-22 22:23:52 +05:00
m0rtus59 023638664c Add translations for experimental gallery and preview UI 2026-11-22 22:23:50 +05:00
m0rtus59 539518498e Add translations for experimental gallery and preview UI 2026-11-22 22:23:48 +05:00
m0rtus59 25169294ab Add translations for experimental gallery and preview UI 2026-11-22 22:23:46 +05:00
m0rtus59 50b804f4c6 Add translations for experimental gallery and preview UI 2026-11-22 22:23:44 +05:00
m0rtus59 deb7ec052b Add translations for experimental gallery and preview UI 2026-11-22 22:23:20 +05:00
m0rtus59 f574fe75b0 Add translations for experimental gallery and preview UI 2026-11-22 22:23:18 +05:00
m0rtus59 8b46e8c0eb Add translations for experimental gallery and preview UI 2026-11-22 22:23:16 +05:00
m0rtus59 0817beff1b Add translations for experimental gallery and preview UI 2026-11-22 22:23:14 +05:00
m0rtus59 f0a0e9cc4e Add translations for experimental gallery and preview UI 2026-11-22 22:23:12 +05:00
m0rtus59 cb65684554 Add translations for experimental gallery and preview UI 2026-11-22 22:23:09 +05:00
m0rtus59 6f97a9c8a5 Add Move to Outputs action to batch inspect cards 2026-11-22 21:56:42 +05:00
Claude 8310c95f95 docs: add Gallery controls overview image to the README 2026-11-22 15:16:09 +00:00
Claude 43cd6660ae docs: refresh Queue controls overview (new header buttons, accurate pointers) 2026-11-22 15:06:37 +00:00
m0rtus59 99f1dcf2e4 Merge pull request #17 from m0rtus59/fix/gallery-toggle-register-unregister
Fix 'Enable Output Gallery Sidebar' toggle
2026-11-22 18:52:20 +05:00
Claude 22b2fdc748 Fix 'Enable Output Gallery Sidebar' toggle: register/unregister the tab instead of hiding its button
The setting hid the tab button by scanning the sidebar DOM for the first button
whose data-tab-id, title or icon looked like the gallery, once, and (on startup)
after a fixed 50ms. The sidebar renders asynchronously and re-renders on its own,
so the button reappeared after reload, and the loose match could hide a different
tab's button. Now the tab is registered only while the setting is on and
unregistered when it is turned off, so state no longer depends on DOM timing.
A disabled gallery also no longer builds its view at startup.
2026-11-22 09:54:00 +00:00
Claude bfa59866af Faster card hover: near-instant spotlight/border on enter, quicker fade-out 2026-11-22 09:48:24 +00:00
Claude b3d3750f1e Card action buttons: no slide/grow on Ctrl, fade instead
The Ctrl delete state swapped width/padding/border on a button that has no
label in Similar Prompts, so with 'transition: all' it snapped to icon width
and then grew back, looking like the button was replaced. Action buttons now
keep a constant border-box (transparent border) and only transition colors,
the wider Ctrl layout is applied only to buttons that actually gain a text
label, and elements that appear in Ctrl mode use a shared fade-in.
2026-11-22 09:43:20 +00:00
Claude 2d9449a0ff Similar Prompts: justified row layout instead of vertical masonry columns
Groups are wide and short, so cards now flow left to right in rows that wrap,
each sized from its real aspect ratio (equal height per row, last row keeps
natural size). PNG dimensions are read from the IHDR header, cached with the
prompt text, and sent with each item, so layout is exact before images load.
Card size slider now sets the target row height.
2026-11-22 09:30:40 +00:00
Claude fa8152c030 Similar Prompts: ignore boilerplate text shared verbatim by many different images
LLM enhancer meta-prompts are stored in every image made with them, which put
all of those images in one 100% group. Cache the prompt as separate segments
(one per text input, interned) and, before grouping, drop any segment that at
least 3 images share while being otherwise different from each other. Identical
prompts across a seed sweep are still kept, so real duplicates are found.
2026-11-22 09:23:18 +00:00
Claude ebf0c0ea28 Similar Prompts: masonry layout, fix gallery teardown crash, faster grouping
- Lay out each group with shortest-column masonry (like Gallery/Queue) instead of a uniform CSS grid; relayout on resize and card-size change
- Fix ReferenceError in teardownGalleryView (similarPromptsDialog was never declared); track the dialog and prevent duplicate opens
- Deleting an image now updates the group's count and removes empty groups
- Replace O(n^2) preview asset lookup with index
- prompt_search: count shared tokens via the inverted index and prune by size ratio instead of building/intersecting sets per pair (identical output, ~2.5-6x faster)
- Drop unused showFullscreenPreview import in galleryView
2026-11-22 09:10:51 +00:00
m0rtus59 fb8f8dcf81 Remove optical offset from preview trash icon 2026-11-22 13:57:11 +05:00
m0rtus59 042b8fb35d Fix preview stacking and delete control alignment 2026-11-22 13:51:53 +05:00
m0rtus59 5550aae5d7 Expose delete confirmation state to preview controls 2026-11-22 13:51:51 +05:00
m0rtus59 cfac1f8d03 Normalize nested paths before sending files to Recycle Bin 2026-11-22 13:39:03 +05:00
m0rtus59 2a586cfa39 Style fullscreen preview delete confirmation 2026-11-22 13:39:02 +05:00
m0rtus59 4a1f69f1ca Keep fullscreen previews above lower-priority overlays 2026-11-22 13:39:00 +05:00
m0rtus59 fc03bf2262 Polish fullscreen preview controls and keyboard delete feedback 2026-11-22 13:38:58 +05:00
m0rtus59 6f24fdbf1a Enable deleting the selected runtime preview image 2026-11-22 13:22:09 +05:00
m0rtus59 62e212ca02 Match preview control sizing to the close button 2026-11-22 13:21:36 +05:00
m0rtus59 0dd346bd83 Keep preview selection anchored to the clicked sidebar item 2026-11-22 13:21:15 +05:00
m0rtus59 a9f1fcb3f6 Align preview delete control with the shared overlay buttons 2026-11-22 13:21:13 +05:00
m0rtus59 064b917074 Delete the selected Similar Prompts group image only 2026-11-22 13:20:47 +05:00
m0rtus59 a3c0621fbf Keep preview deletion tied to the selected sidebar card 2026-11-22 13:20:45 +05:00
m0rtus59 438fc2820e Persist Similar Prompts viewer preferences 2026-11-22 13:20:28 +05:00
m0rtus59 08f7ebec51 Navigate and delete visible sidebar preview items 2026-11-22 13:20:25 +05:00
m0rtus59 ee1c613dab Add delete controls to fullscreen previews 2026-11-22 13:20:24 +05:00
m0rtus59 8ddc22ae7d Tweak group status spacing and themed slider accent 2026-11-22 13:02:54 +05:00
m0rtus59 3ae1109ca2 Polish full-width group overlay controls 2026-11-22 12:54:44 +05:00
m0rtus59 6d92775d6a Use full shared overlay for Similar Prompts 2026-11-22 12:54:35 +05:00
m0rtus59 0e3fd15987 Move Similar Prompts into shared overlay stack 2026-11-22 12:41:06 +05:00
m0rtus59 69869fd778 Use shared overlay for similar prompt groups 2026-11-22 12:40:41 +05:00
m0rtus59 d184bdb861 Support stacked sidebar overlays 2026-11-22 12:40:39 +05:00
m0rtus59 0adc42371f Polish Similar Prompts modal backdrop 2026-11-22 12:29:52 +05:00
m0rtus59 1106e366ff Use native modal and Gallery cards in Similar Prompts 2026-11-22 12:29:44 +05:00
m0rtus59 90aa5e3759 Fix Similar Prompts module import path 2026-11-22 12:14:03 +05:00
m0rtus59 ac7a83ce46 Preserve current Gallery folder in Similar Prompts finder 2026-11-22 12:04:39 +05:00
m0rtus59 425c5a1d39 Move Similar Prompts dialog out of Gallery view 2026-11-22 12:04:22 +05:00
m0rtus59 3800c54a44 Extract Similar Prompts dialog into dedicated module 2026-11-22 12:04:17 +05:00
m0rtus59 6e0102d59e Polish similar prompt cards and spotlight glow 2026-11-22 12:04:04 +05:00
m0rtus59 a15c417701 Fix Queue preview navigation and preload next image 2026-11-22 12:04:02 +05:00
m0rtus59 326d18cadf Improve similar prompt cards and add safe delete controls 2026-11-22 11:42:31 +05:00
m0rtus59 22fd5d819d Add image navigation to runtime Queue preview 2026-11-22 11:42:22 +05:00
m0rtus59 23536657e7 Use angle-bracket preview navigation controls 2026-11-22 01:58:50 +05:00
m0rtus59 187d44cf36 Keep preview navigation index aligned with filtered images 2026-11-22 01:58:23 +05:00
m0rtus59 ca7742858c Cancel superseded similarity scans 2026-11-22 01:57:50 +05:00
m0rtus59 384ad09107 Use an isolated native Comfy dialog for similar prompts 2026-11-22 01:57:28 +05:00
m0rtus59 a28b51249f Center fitted runtime previews independently of image zoom 2026-11-22 01:57:08 +05:00
m0rtus59 fdefa9aae9 Optimize similarity group scoring 2026-11-22 01:56:15 +05:00
m0rtus59 dc513a0199 Stop Gallery prompt scan when dialog request is cancelled 2026-11-22 01:55:45 +05:00
m0rtus59 4c44af1486 Keep runtime fit mode separate from saved zoom state 2026-11-22 01:54:48 +05:00
m0rtus59 90ad6aac23 Keep runtime preview cursor in fit mode 2026-11-22 01:54:22 +05:00
m0rtus59 f681a80148 Open prompt-group images in the preview viewer 2026-11-22 01:54:20 +05:00
m0rtus59 869dfcf78a Tune common-token filtering for prompt groups 2026-11-22 01:54:18 +05:00
m0rtus59 9b56ff7dd0 Add preview navigation and runtime fit mode 2026-11-22 01:53:27 +05:00
m0rtus59 aed377f327 Pass sibling images to fullscreen preview navigation 2026-11-22 01:52:41 +05:00
m0rtus59 92716efb26 Add native similar-prompts Gallery popup 2026-11-22 01:52:30 +05:00
m0rtus59 08b911377a Expose Gallery similar prompt endpoint 2026-11-22 01:51:29 +05:00
m0rtus59 ef45f9266c Add similar prompt grouping helper 2026-11-22 01:51:27 +05:00
m0rtus59 398c8c4adc Merge pull request #16 from m0rtus59/feature/about-version-badge
Show ComfySidebar build version in About panel
2026-11-19 22:07:51 +05:00
m0rtus59 2b265aaf40 Fix version string parsing 2026-11-19 21:56:36 +05:00
m0rtus59 9567209ce4 Fix pyproject version parsing 2026-11-19 21:56:29 +05:00
m0rtus59 a83c0f82ea Show build version in ComfyUI About panel 2026-11-19 21:56:15 +05:00
m0rtus59 a13030b96b Expose extension version and commit metadata 2026-11-19 21:56:13 +05:00
47 changed files with 1538 additions and 119 deletions
+7 -1
View File
@@ -1,3 +1,7 @@
<p align="center">
<img src="assets/banner.png" alt="Comfy Sidebar" width="100%">
</p>
# ComfyUI-ComfySidebar
A compact and powerful layout overhaul for ComfyUI that makes generation results easier to browse, preview, compare, and manage.
@@ -10,7 +14,7 @@ A compact and powerful layout overhaul for ComfyUI that makes generation results
* **Left or right side:** Choose which side the sidebar appears on in ComfyUI settings.
* **Simplified mouse-friendly workflow** with drag-and-drop support and convenient actions for moving results back into the workflow, opening files, and managing outputs. Hold `Ctrl` for extra actions such as opening an image's location or deleting it directly from your device.
* **Simplified mouse-friendly workflow** with drag-and-drop support and convenient actions for moving results back into the workflow, opening files, and managing outputs. Hold `Ctrl` for extra actions such as opening an image's location, deleting it directly from your device, or moving a temporary image to your Outputs folder.
<img src="assets/controls.png" alt="ComfySidebar controls overview">
@@ -20,6 +24,8 @@ A compact and powerful layout overhaul for ComfyUI that makes generation results
* **Output Gallery sidebar:** Browse files and subfolders directly from your ComfyUI `output` directory without leaving the interface. Features dedicated cards for images, videos, audio, and 3D assets (`.glb`/`.gltf`), breadcrumb navigation, filename and prompt metadata search across subfolders, and persistent sorting.
<img src="assets/gallery.png" alt="ComfySidebar Gallery controls overview">
* **Hotkeys on any keyboard layout:** Shortcuts such as `Q`, `Ctrl+Q` and `Alt+R` keep working while a non-Latin layout (for example Russian) is active. Non-Latin keys are treated as the Latin key in the same physical position, and typing in text fields is not affected. Can be turned off with **Fix non-ASCII keybinds** in the settings.
* **Runtime preview mode** combined with workflow overview makes ComfyUI practical for running and monitoring workflows in a more streamlined, queue-oriented way.
+115
View File
@@ -2,6 +2,7 @@ import asyncio
import filecmp
import os
import platform
import re
import shutil
import subprocess
import sys
@@ -290,6 +291,46 @@ _LOCALES_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "locale
_ALLOWED_LOCALE_FILES = {"main.json", "settings.json"}
def _get_extension_build_info():
"""Read the package version and the checked-out Git commit for the About panel."""
version = "unknown"
commit = "unknown"
try:
pyproject_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "pyproject.toml")
with open(pyproject_path, "r", encoding="utf-8") as f:
pyproject = f.read()
project_match = re.search(r"(?ms)^\[project\]\s*(.*?)(?=^\[|\Z)", pyproject)
if project_match:
version_match = re.search(r'(?m)^\s*version\s*=\s*"([^"]+)"', project_match.group(1))
if version_match:
version = version_match.group(1)
except (OSError, UnicodeError):
pass
try:
result = subprocess.run(
["git", "rev-parse", "--short=7", "HEAD"],
cwd=os.path.dirname(os.path.realpath(__file__)),
capture_output=True,
text=True,
check=True,
timeout=2
)
candidate = result.stdout.strip()
if re.fullmatch(r"[0-9a-fA-F]{7,40}", candidate):
commit = candidate[:7]
except (OSError, subprocess.SubprocessError):
pass
return {"version": version, "commit": commit}
@PromptServer.instance.routes.get("/comfy-sidebar/version")
async def version_handler(request):
return web.json_response(_get_extension_build_info())
@PromptServer.instance.routes.get("/comfy-sidebar/locales/{lang}/{filename}")
async def locale_file_handler(request):
lang = request.match_info.get("lang", "").strip()
@@ -304,6 +345,73 @@ async def locale_file_handler(request):
return web.FileResponse(target_file)
def _find_similar_prompts(subfolder, threshold, cancel):
output_dir = os.path.realpath(folder_paths.get_output_directory())
target_dir = os.path.realpath(os.path.join(output_dir, subfolder)) if subfolder else output_dir
if not is_path_safe(output_dir, target_dir):
return 403, {"error": "Unsafe path"}
if not os.path.isdir(target_dir):
return 200, {"groups": []}
documents = []
for root, dirs, fnames in os.walk(target_dir):
dirs[:] = [d for d in dirs if not d.startswith(".")]
for filename in fnames:
if cancel.is_set():
return 200, {"groups": []}
if filename.startswith(".") or os.path.splitext(filename)[1].lower() != ".png":
continue
path = os.path.join(root, filename)
segments = prompt_search.get_prompt_segments(path)
if not segments:
continue
try:
stat = os.stat(path)
except (PermissionError, FileNotFoundError):
continue
documents.append({
"id": len(documents),
"filename": filename,
"subfolder": _relative_subfolder(root, output_dir),
"mtime": stat.st_mtime,
"segments": segments,
"width": prompt_search.get_png_dimensions(path)[0],
"height": prompt_search.get_png_dimensions(path)[1],
"prompt": "\n".join(segments)
})
groups = prompt_search.find_similar_prompt_groups(documents, threshold)
for group in groups:
for item in group["items"]:
item.pop("prompt", None)
item.pop("segments", None)
return 200, {"groups": groups, "scanned": len(documents)}
@PromptServer.instance.routes.get("/comfy-sidebar/gallery/similar-prompts")
async def gallery_similar_prompts_handler(request):
try:
subfolder = request.query.get("subfolder", "").strip().strip("/\\\\")
try:
threshold = float(request.query.get("threshold", "0.55"))
except (TypeError, ValueError):
threshold = 0.55
threshold = min(0.9, max(0.25, threshold))
cancel = threading.Event()
loop = asyncio.get_running_loop()
try:
status, payload = await loop.run_in_executor(
None, _find_similar_prompts, subfolder, threshold, cancel
)
except asyncio.CancelledError:
cancel.set()
raise
return web.json_response(payload, status=status)
except Exception as e:
return web.json_response({"error": str(e)}, status=500)
@PromptServer.instance.routes.get("/comfy-sidebar/gallery/list")
async def gallery_list_handler(request):
try:
@@ -392,6 +500,13 @@ async def delete_file_handler(request):
target_file, root = resolve_existing_path(filename, subfolder, folder_type, candidate_roots=delete_roots, strict=True)
# Normalize nested paths before calling Windows Shell APIs used by send2trash.
# Mixed separators are accepted by Python's path helpers but can trigger
# ERROR_INVALID_PARAMETER in the Recycle Bin operation on Windows.
if target_file:
target_file = os.path.realpath(os.path.abspath(os.path.normpath(target_file)))
root = os.path.realpath(root) if root else root
if not target_file or not os.path.isfile(target_file) or not is_path_safe(root, target_file):
return web.json_response({"error": "File not found or outside output directory"}, status=404)
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 789 KiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 51 KiB

+7 -9
View File
@@ -146,15 +146,13 @@ export function findActiveQueueIndicator() {
const container = findTopbarContainer();
if (!container) return null;
const buttons = container.querySelectorAll("button, .p-button, .comfyui-menu-item");
for (const btn of buttons) {
if (btn.classList.contains("comfy-sidebar-custom-properties-toggle")) continue;
const text = (btn.textContent || "").toLowerCase();
if (text.includes("active") || text.includes("queued") || text.includes("running") || text.includes("pending")) {
return btn;
}
}
return null;
// ComfyUI's Active queue control has a distinctive button layout. Match its
// structural classes rather than its translated label ("Active", etc.).
return container.querySelector(
"button.px-3.text-xs.p-2.rounded-lg.h-8, " +
".p-button.px-3.text-xs.p-2.rounded-lg.h-8, " +
".comfyui-menu-item.px-3.text-xs.p-2.rounded-lg.h-8"
);
}
export function findNativeExtensionsPanel() {
+24
View File
@@ -454,6 +454,10 @@ function syncAvatarVisibility() {
styleEl = document.createElement("style");
styleEl.id = STYLE_AVATAR_ID;
styleEl.textContent = `
/* Current ComfyUI profile/avatar control. Match stable class tokens,
not its localized tooltip or accessible label. */
button[class~="hover:bg-transparent"][class~="p-1"][class~="text-xs"][class~="rounded-lg"][class~="h-8"][class~="text-muted-foreground"][class~="bg-transparent"],
[role="button"][class~="hover:bg-transparent"][class~="p-1"][class~="text-xs"][class~="rounded-lg"][class~="h-8"][class~="text-muted-foreground"][class~="bg-transparent"],
img[alt*="User Avatar"],
img[alt*="user avatar"],
button:has(img[alt*="User Avatar"]),
@@ -681,6 +685,25 @@ function syncActiveQueueIndicator(isClassicLayoutEnabled) {
}
}
function syncRunOnComfyCloudButton() {
const shouldHide = getSetting("Comfy Sidebar.Hide Junk.Run on Comfy Cloud", false);
const container = findTopbarContainer();
if (!container) return;
// The cloud action is currently the second compact square button in the
// topbar. Keep this scoped to the action bar to avoid matching other UI.
const cloudButton = container.querySelector("button.rounded-lg.size-8:nth-of-type(2)");
if (!cloudButton) return;
if (shouldHide) {
if (cloudButton.style.display !== "none") {
cloudButton.style.setProperty("display", "none", "important");
}
} else if (cloudButton.style.display === "none") {
cloudButton.style.removeProperty("display");
}
}
export function syncRuntimePreviewButton() {
const panel = findPropertiesPanel();
if (!panel) return;
@@ -756,6 +779,7 @@ export function syncClassicLayout() {
syncExtensionsPanel(isClassicLayoutEnabled);
syncPropertiesButton(isClassicLayoutEnabled);
syncActiveQueueIndicator(isClassicLayoutEnabled);
syncRunOnComfyCloudButton();
updateSidebarTabsVisibility();
applySidebarOverride();
if (!sidebarTopObserver) {
+79 -41
View File
@@ -19,6 +19,28 @@ import { getScrollContainer } from "./utils/utils.js";
import { store } from "./core/store.js";
import { getSetting, setSetting } from "./core/settings.js";
// The About panel supports extension-provided badges. Resolve build metadata before
// registering the extension so the badge is part of its initial registration.
let aboutPageBadges = [];
try {
const response = await fetch("/comfy-sidebar/version", { cache: "no-store" });
if (response.ok) {
const { version, commit } = await response.json();
if (version && version !== "unknown") {
const hasCommit = typeof commit === "string" && /^[0-9a-f]{7}$/i.test(commit);
aboutPageBadges = [{
label: `Comfy Sidebar v${version}${hasCommit ? ` (${commit})` : ""}`,
url: hasCommit
? `https://github.com/m0rtus59/ComfyUI-ComfySidebar/commit/${commit}`
: "https://github.com/m0rtus59/ComfyUI-ComfySidebar",
icon: "icon-[lucide--github]"
}];
}
}
} catch (error) {
console.warn("[ComfySidebar] Could not load version information for the About panel:", error);
}
let isInitialized = false;
let activeKeydownHandler = null;
let cleanupFns = [];
@@ -51,21 +73,10 @@ function setupKeydownShortcuts() {
document.addEventListener("keydown", activeKeydownHandler, true);
}
function setGalleryButtonVisible(visible) {
try {
const buttons = document.querySelectorAll(".side-bar-button, [data-tab-id]");
for (const btn of buttons) {
if (btn.getAttribute("data-tab-id") === "classic-comfy-gallery" ||
btn.getAttribute("title")?.includes("Gallery") ||
btn.querySelector(".pi-folder")) {
btn.style.display = visible ? "" : "none";
break;
}
}
} catch (e) {
console.warn("[ComfySidebar] Error toggling gallery tab button:", e);
}
}
// Assigned in setup(): registers/unregisters the Gallery sidebar tab to match the
// "Enable Output Gallery Sidebar" setting. Null until setup() has run (the setting's
// initial onChange fires earlier, in init(), when there is nothing to toggle yet).
let syncGalleryTab = null;
function registerSettings() {
app.ui.settings.addSetting({
@@ -102,7 +113,7 @@ function registerSettings() {
type: "boolean",
defaultValue: true,
onChange: (val) => {
setGalleryButtonVisible(val ?? true);
syncGalleryTab?.(val ?? true);
}
});
@@ -170,6 +181,16 @@ function registerSettings() {
}
});
app.ui.settings.addSetting({
id: "Comfy Sidebar.Hide Junk.Run on Comfy Cloud",
name: t("Hide Run on Comfy Cloud button"),
type: "boolean",
defaultValue: false,
onChange: () => {
setTimeout(() => { syncClassicLayout(); }, 0);
}
});
app.ui.settings.addSetting({
id: "Comfy Sidebar.Hide Junk.Floating Canvas Controls",
name: t("Floating Canvas Controls"),
@@ -301,6 +322,7 @@ function setupWorkflowTabsPositionWatcher() {
app.registerExtension({
name: "ComfySidebar.ClassicRestore",
aboutPageBadges,
async init() {
await initI18n();
@@ -445,32 +467,47 @@ app.registerExtension({
}
});
const galleryContainer = setupGalleryView();
app.extensionManager.registerSidebarTab({
id: "classic-comfy-gallery",
icon: "pi pi-folder",
title: t("Gallery"),
tooltip: t("Gallery (Outputs)"),
type: "custom",
render: (el) => {
document.querySelectorAll(".comfy-sidebar-scroll-top-btn").forEach(btn => { btn.style.display = "none"; });
const scrollParent = getScrollContainer(el);
if (activeSidebarTab === "queue" && scrollParent) {
queueScrollPos = scrollParent.scrollTop;
}
activeSidebarTab = "gallery";
el.replaceChildren(galleryContainer);
requestAnimationFrame(() => {
const sp = getScrollContainer(el);
if (sp) sp.scrollTop = galleryScrollPos;
});
}
});
// The Gallery tab is only registered while the setting is enabled. Hiding its
// button in the DOM was unreliable: the sidebar renders asynchronously and
// re-renders on its own, so the button came back (or the wrong one was hidden).
let galleryContainer = null;
let galleryTabRegistered = false;
const isGalleryEnabled = getSetting("Comfy Sidebar.Enable Gallery", true);
if (!isGalleryEnabled) {
setTimeout(() => setGalleryButtonVisible(false), 50);
}
const registerGalleryTab = () => {
if (galleryTabRegistered) return;
galleryContainer ||= setupGalleryView();
app.extensionManager.registerSidebarTab({
id: "classic-comfy-gallery",
icon: "pi pi-folder",
title: t("Gallery"),
tooltip: t("Gallery (Outputs)"),
type: "custom",
render: (el) => {
document.querySelectorAll(".comfy-sidebar-scroll-top-btn").forEach(btn => { btn.style.display = "none"; });
const scrollParent = getScrollContainer(el);
if (activeSidebarTab === "queue" && scrollParent) {
queueScrollPos = scrollParent.scrollTop;
}
activeSidebarTab = "gallery";
el.replaceChildren(galleryContainer);
requestAnimationFrame(() => {
const sp = getScrollContainer(el);
if (sp) sp.scrollTop = galleryScrollPos;
});
}
});
galleryTabRegistered = true;
};
const unregisterGalleryTab = () => {
if (!galleryTabRegistered) return;
if (activeSidebarTab === "gallery") activeSidebarTab = "queue";
app.extensionManager.unregisterSidebarTab?.("classic-comfy-gallery");
galleryTabRegistered = false;
};
syncGalleryTab = (enabled) => (enabled ? registerGalleryTab() : unregisterGalleryTab());
syncGalleryTab(getSetting("Comfy Sidebar.Enable Gallery", true));
requestAnimationFrame(() => {
applySidebarOverride();
@@ -478,6 +515,7 @@ app.registerExtension({
},
destroy() {
syncGalleryTab = null;
for (const fn of cleanupFns.splice(0)) {
try { if (typeof fn === "function") fn(); } catch (e) {}
}
+12 -1
View File
@@ -5,9 +5,11 @@ import { extractWorkflowFromPng, isImageFormat, animateCardRemoval, getScrollCon
import { getSetting } from "../core/settings.js";
import { renderCardImages } from "./mediaPreview.js";
import { showNotification } from "../utils/nodeRenumber.js";
import { openSimilarPromptsDialog } from "./similarPrompts.js";
let galleryContainerEl = null;
let cardStackEl = null;
let similarPromptsDialog = null;
let scrollToTopBtnEl = null;
let currentColumnCount = 1;
let currentSubfolder = "";
@@ -274,6 +276,7 @@ function createFileCard(file) {
pid: `gallery-${file.filename}`,
status: PromptStatus.COMPLETED,
images: [fileAsset],
_previewImages: cachedFiles,
workflow: null
});
@@ -582,7 +585,11 @@ export function setupGalleryView() {
renderGallery();
});
actionsGroup.append(btnSort, btnUp, btnOpenFolder, btnRefresh);
const btnSimilar = createHeaderBtn("pi pi-clone", t("Find Similar Prompts"), async () => {
if (similarPromptsDialog && !similarPromptsDialog.destroyed) return;
similarPromptsDialog = await openSimilarPromptsDialog(currentSubfolder);
});
actionsGroup.append(btnSort, btnUp, btnOpenFolder, btnSimilar, btnRefresh);
standardHeader.appendChild(actionsGroup);
const searchContainer = document.createElement("div");
@@ -727,6 +734,10 @@ export function teardownGalleryView() {
galleryResizeObserver.disconnect();
galleryResizeObserver = null;
}
if (similarPromptsDialog) {
similarPromptsDialog.destroy();
similarPromptsDialog = null;
}
// Reset header-reveal state so a re-opened gallery starts with a visible header
lastScrollTop = 0;
scrollDeltaAccumulator = 0;
+95 -2
View File
@@ -1,10 +1,11 @@
import { isImageFormat, isVideoFormat, is3DFormat, isAudioFormat, getFilenameFromUrl, findImagesInOutputs } from "../utils/utils.js";
import { openFileOrFolder, removeImageFromNodeOutputs } from "./mediaActions.js";
import { openFileOrFolder, removeImageFromNodeOutputs, deleteFileOnServer } from "./mediaActions.js";
import { stopAllAudioPlayback, isAudioViewerOpen, setCurrentlyPlayingAudio, getCurrentlyPlayingAudio } from "./audioController.js";
import { showFullscreenPreview } from "../utils/comparison.js";
import { store } from "../core/store.js";
import { handleMissingMedia } from "../queue/missingFiles.js";
import { t } from "../core/i18n.js";
import { showNotification } from "../utils/nodeRenumber.js";
export function findWorkflowBackgroundThumbnail(state, randParam = "") {
if (!state) return null;
@@ -433,6 +434,11 @@ export function renderCardImages(cardObj, state, onNavigateBatch) {
const idx = cardObj.currentImageIndex;
const img = state.images[idx];
if (cardObj.element) {
cardObj.element._sidebarPreviewAsset = img || null;
cardObj.element._sidebarPreviewState = state;
cardObj.element._sidebarPreviewCardObj = cardObj;
}
// The Queue's advanced action follows the currently selected batch image.
if (cardObj.btnMove) {
@@ -564,7 +570,94 @@ export function renderCardImages(cardObj, state, onNavigateBatch) {
activeSrc = canvas.toDataURL("image/png");
} catch (_) {}
}
showFullscreenPreview([activeSrc], ev.shiftKey, state?.pid);
const visibleCardAssets = Array.from(store.ui.cardStack?.querySelectorAll(".comfy-sidebar-card") || [])
.filter(card => card._sidebarPreviewAsset && isImageFormat(card._sidebarPreviewAsset.filename || card._sidebarPreviewAsset.url))
.map(card => ({
...card._sidebarPreviewAsset,
_sidebarOwnerState: card._sidebarPreviewState,
_sidebarOwnerCardObj: card._sidebarPreviewCardObj
}));
const sourceItems = state?._previewImages || (visibleCardAssets.length > 1 ? visibleCardAssets : (state?.images || [img]));
const previewSourceItems = sourceItems
.filter(item => item && isImageFormat(item.filename || item.url))
.map(item => item._sidebarOwnerState ? item : {
...item,
_sidebarOwnerState: state,
_sidebarOwnerCardObj: cardObj
});
const previewItems = previewSourceItems.map(item =>
item.url || "/view?filename=" + encodeURIComponent(item.filename) +
"&type=" + encodeURIComponent(item.type || "output") +
"&subfolder=" + encodeURIComponent(item.subfolder || "") +
(state?.pid ? "&rand=" + encodeURIComponent(state.pid) : "")
);
const currentIndex = Math.max(0, previewSourceItems.findIndex(item =>
item.filename === img.filename && (item.subfolder || "") === (img.subfolder || "")
));
if (previewItems.length) previewItems[currentIndex] = activeSrc;
const onDeletePreviewAsset = async (asset) => {
const action = await deleteFileOnServer(asset);
if (!["trashed", "deleted", "missing"].includes(action)) return false;
if (action !== "missing") {
showNotification(
action === "trashed" ? t("Moved file to Recycle Bin.") : t("Permanently deleted file."),
"success", t("Delete File")
);
}
const ownerState = asset._sidebarOwnerState || state;
const ownerCardObj = asset._sidebarOwnerCardObj || cardObj;
if (typeof asset?._onPreviewAssetDeleted === "function") {
asset._onPreviewAssetDeleted();
} else if (typeof ownerState?._onPreviewAssetDeleted === "function") {
ownerState._onPreviewAssetDeleted(asset);
} else {
const sameFile = candidate => candidate &&
candidate.filename === asset.filename &&
(candidate.subfolder || "") === (asset.subfolder || "") &&
(candidate.type || "output") === (asset.type || "output");
const cardId = ownerCardObj.element?.id || "";
if (cardId.startsWith("card-batch-")) {
const batchInfo = store.ui.activeSubmenuBatchImages;
if (Array.isArray(batchInfo?.images)) {
const index = batchInfo.images.findIndex(sameFile);
if (index >= 0) batchInfo.images.splice(index, 1);
}
const parentPid = ownerState.parentPromptId || batchInfo?.parentPromptId || ownerState.pid;
const parent = store.getPrompt(parentPid);
if (parent) {
parent.images = (parent.images || []).filter(item => !sameFile(item));
if (parent.nodeOutputs) removeImageFromNodeOutputs(parent.nodeOutputs, asset);
store.updatePrompt(parentPid, parent);
}
ownerCardObj.element?.remove();
} else if (cardId.startsWith("card-submenu-")) {
ownerState.images = (ownerState.images || []).filter(item => !sameFile(item));
const parent = store.getPrompt(ownerState.pid);
if (parent?.nodeOutputs) {
removeImageFromNodeOutputs(parent.nodeOutputs, asset);
store.updatePrompt(parent.pid, parent);
}
if (ownerState.images.length) renderCardImages(ownerCardObj, ownerState, onNavigateBatch);
else ownerCardObj.element?.remove();
} else {
const liveState = store.getPrompt(ownerState.pid) || ownerState;
liveState.images = (liveState.images || []).filter(item => !sameFile(item));
if (liveState.nodeOutputs) removeImageFromNodeOutputs(liveState.nodeOutputs, asset);
if (store.getPrompt(liveState.pid)) store.updatePrompt(liveState.pid, liveState);
else if (liveState.images.length) renderCardImages(ownerCardObj, liveState, onNavigateBatch);
else ownerCardObj.element?.remove();
}
}
return true;
};
showFullscreenPreview(
previewItems.length ? previewItems : [activeSrc],
ev.shiftKey,
state?.pid,
currentIndex,
{ assets: previewSourceItems, onDelete: onDeletePreviewAsset }
);
};
mediaEl.onerror = () => {
+54 -1
View File
@@ -568,6 +568,15 @@ export function renderSidebar() {
btnDelLabel.textContent = t("Delete File");
btnDel.appendChild(btnDelLabel);
const btnMove = document.createElement("span");
btnMove.className = "pi pi-folder-open comfy-sidebar-card-action-btn comfy-sidebar-btn-move";
btnMove.title = t("Move selected image to Outputs (Ctrl+Click)");
const btnMoveLabel = document.createElement("span");
btnMoveLabel.className = "comfy-sidebar-move-label";
btnMoveLabel.textContent = t("Move to Outputs");
btnMove.appendChild(btnMoveLabel);
btnMove.style.display = "none";
attachDeleteConfirmation(btnDel, {
idleTitle: t("Remove from batch (Hold Ctrl to delete file from disk)"),
confirmTitle: t("Click again to confirm removing from batch"),
@@ -616,7 +625,7 @@ export function renderSidebar() {
}
});
hoverPanel.append(btnImg, btnDel);
hoverPanel.append(btnImg, btnMove, btnDel);
const leftHoverPanel = document.createElement("div");
leftHoverPanel.className = "comfy-sidebar-left-hover-panel";
@@ -675,12 +684,56 @@ export function renderSidebar() {
btnCopy,
btnFocus,
btnDel,
btnMove,
firstImgElement: null
};
cardPool.set(cardId, cardObj);
}
if (cardObj.btnMove) {
const canMoveImage = Boolean(
img &&
img.type === "temp" &&
isImageFormat(img.filename || img.url)
);
if (canMoveImage) {
cardObj.btnMove.title = t("Move selected image to Outputs (Ctrl+Click)");
cardObj.btnMove.onclick = async (ev) => {
ev.stopPropagation();
if (!ev.ctrlKey && !ev.metaKey) return;
if (cardObj._isMovingTempImage) return;
const pid = batchInfo.parentPromptId || batchInfo.pid;
const liveState = store.getPrompt(pid);
const imageToMove = img;
if (!imageToMove || imageToMove.type !== "temp") return;
cardObj._isMovingTempImage = true;
cardObj.btnMove.style.opacity = "0.5";
const moved = await moveTempImageToOutput(imageToMove);
if (moved?.success) {
updateMovedImageReferences(liveState?.images, imageToMove, moved);
updateMovedImageReferences(liveState?.nodeOutputs, imageToMove, moved);
updateMovedImageReferences(batchInfo.images, imageToMove, moved);
updateMovedImageReferences(batchInfo.nodeOutputs, imageToMove, moved);
if (liveState) store.updatePrompt(pid, liveState);
showNotification(t("Moved selected image to Outputs."), "success", t("Move to Outputs"));
renderSidebar();
} else {
showNotification(t("Failed to move image to Outputs."), "error", t("Move to Outputs"));
}
cardObj._isMovingTempImage = false;
cardObj.btnMove.style.opacity = "";
};
} else {
cardObj.btnMove.onclick = null;
}
}
cardObj.placeholder.style.display = "none";
renderCardImages(cardObj, {
pid: batchInfo.pid,
+323
View File
@@ -0,0 +1,323 @@
import { t } from "../core/i18n.js";
import { deleteFileOnServer } from "./mediaActions.js";
import { attachDeleteConfirmation, setupSpotlightTracker } from "../utils/utils.js";
import { showNotification } from "../utils/nodeRenumber.js";
import { renderCardImages } from "./mediaPreview.js";
import { SidebarOverlay } from "../utils/overlay.js";
export async function openSimilarPromptsDialog(currentSubfolder = "") {
let requestId = 0;
let requestController = null;
let debounce = null;
const closeGroupViewer = () => {
requestController?.abort();
clearTimeout(debounce);
};
// The group viewer shares the same overlay system as fullscreen previews.
// A preview opened from a card is appended later and becomes the top layer.
const overlay = new SidebarOverlay({
className: "comfy-sidebar-similar-prompts-overlay",
background: "rgba(0, 0, 0, 0.58)",
zIndex: 1000,
onUserClose: closeGroupViewer
});
// Render directly on the shared overlay. Its bounds already account for
// open sidebars, so the group UI naturally uses the remaining workspace.
const content = document.createElement("div");
Object.assign(content.style, {
position: "absolute", inset: "0", width: "100%", height: "100%",
minHeight: "0", display: "flex", flexDirection: "column", gap: "12px",
padding: "20px 24px", boxSizing: "border-box", font: "inherit",
pointerEvents: "auto", userSelect: "auto", overflow: "hidden", zIndex: "20"
});
const heading = document.createElement("div");
Object.assign(heading.style, {
display: "flex", alignItems: "center", justifyContent: "space-between", gap: "12px", flex: "none"
});
const title = document.createElement("strong");
title.textContent = t("Similar prompt groups");
const status = document.createElement("span");
Object.assign(status.style, { marginLeft: "auto", marginRight: "44px", fontSize: "11px", opacity: "0.65" });
// SidebarOverlay supplies the same round close control used by previews.
heading.append(title, status);
const controls = document.createElement("div");
Object.assign(controls.style, {
display: "flex", alignItems: "center", flexWrap: "wrap", gap: "18px",
fontSize: "12px", flex: "none", padding: "4px 0"
});
const thresholdLabel = document.createElement("label");
thresholdLabel.textContent = t("Similarity threshold");
Object.assign(thresholdLabel.style, { display: "flex", alignItems: "center", gap: "10px", lineHeight: "1" });
const threshold = document.createElement("input");
threshold.type = "range";
threshold.min = "25";
threshold.max = "90";
threshold.step = "5";
const savedSettings = (() => {
try { return JSON.parse(localStorage.getItem("comfy-sidebar-similar-prompts-settings-v1") || "{}"); }
catch (_) { return {}; }
})();
threshold.value = String(Math.max(25, Math.min(90, Number(savedSettings.threshold) || 55)));
Object.assign(threshold.style, { verticalAlign: "middle", accentColor: "var(--primary, var(--p-primary-color, var(--primary-color, var(--accent, currentColor))))", cursor: "pointer" });
const thresholdValue = document.createElement("span");
Object.assign(thresholdValue.style, { alignSelf: "center", minWidth: "34px", fontVariantNumeric: "tabular-nums" });
thresholdValue.textContent = threshold.value + "%";
thresholdLabel.append(threshold, thresholdValue);
controls.appendChild(thresholdLabel);
const cardSizeLabel = document.createElement("label");
cardSizeLabel.textContent = t("Card size");
Object.assign(cardSizeLabel.style, { display: "flex", alignItems: "center", gap: "10px", lineHeight: "1" });
const cardSize = document.createElement("input");
cardSize.type = "range";
cardSize.min = "100";
cardSize.max = "280";
cardSize.step = "10";
cardSize.value = String(Math.max(100, Math.min(280, Number(savedSettings.cardSize) || 150)));
Object.assign(cardSize.style, { verticalAlign: "middle", accentColor: "var(--primary, var(--p-primary-color, var(--primary-color, var(--accent, currentColor))))", cursor: "pointer" });
cardSizeLabel.appendChild(cardSize);
controls.appendChild(cardSizeLabel);
const results = document.createElement("div");
Object.assign(results.style, {
overflowY: "auto", minHeight: "0", flex: "1", paddingRight: "4px",
display: "flex", flexDirection: "column", gap: "12px"
});
content.append(heading, controls, results);
overlay.container.appendChild(content);
overlay.addCleanup(closeGroupViewer);
setupSpotlightTracker(results, ".comfy-sidebar-card");
const saveSettings = () => {
try {
localStorage.setItem("comfy-sidebar-similar-prompts-settings-v1", JSON.stringify({
threshold: Number(threshold.value),
cardSize: Number(cardSize.value)
}));
} catch (_) {}
};
// Justified-row layout: cards flow left to right and wrap like text, each
// sized from its real aspect ratio so every card in a row shares a height
// and each row fills the width. (Vertical masonry columns looked odd here
// because the groups are wide and short, so we read them row by row.)
// Dimensions come from the server, so layout is exact before images load.
const GAP = 8;
const ROW_HEIGHT_PER_SIZE = 1.5; // slider value -> target row height in px
let groupViews = [];
let cardChrome = null; // horizontal/vertical padding+border of a card
const measureChrome = (card) => {
const cs = getComputedStyle(card);
const px = (v) => parseFloat(v) || 0;
return {
h: px(cs.paddingLeft) + px(cs.paddingRight) + px(cs.borderLeftWidth) + px(cs.borderRightWidth),
v: px(cs.paddingTop) + px(cs.paddingBottom) + px(cs.borderTopWidth) + px(cs.borderBottomWidth)
};
};
const sizeCard = (card) => {
const rowHeight = Number(cardSize.value) * ROW_HEIGHT_PER_SIZE;
const chrome = cardChrome || { h: 18, v: 18 };
const basis = card._aspect * Math.max(20, rowHeight - chrome.v) + chrome.h;
// Grow in proportion to width so cards in a row keep equal heights.
card.style.flex = `${basis} 1 ${basis}px`;
};
const resizeAllCards = () => {
const sample = groupViews.flatMap(view => view.cards)[0];
if (sample?.isConnected) cardChrome = measureChrome(sample);
groupViews.forEach(view => view.cards.forEach(sizeCard));
};
const updateCardSize = () => {
resizeAllCards();
saveSettings();
};
cardSize.addEventListener("input", updateCardSize);
const loadGroups = async () => {
if (requestController) requestController.abort();
const controller = new AbortController();
requestController = controller;
const id = ++requestId;
status.textContent = t("Scanning prompts...");
results.replaceChildren();
groupViews = [];
thresholdValue.textContent = threshold.value + "%";
try {
const params = new URLSearchParams({
subfolder: currentSubfolder,
threshold: (Number(threshold.value) / 100).toFixed(2)
});
const response = await fetch("/comfy-sidebar/gallery/similar-prompts?" + params.toString(), {
signal: controller.signal
});
if (!response.ok) throw new Error("HTTP " + response.status);
const data = await response.json();
if (id !== requestId || overlay.destroyed) return;
status.textContent = t("{count} groups · {scanned} PNGs scanned", {
count: data.groups?.length || 0, scanned: data.scanned || 0
});
if (!data.groups?.length) {
const empty = document.createElement("div");
empty.textContent = t("No similar prompt groups found at this threshold.");
empty.style.cssText = "padding:28px;text-align:center;opacity:.65;font-size:12px";
results.appendChild(empty);
return;
}
data.groups.forEach((group, groupIndex) => {
const section = document.createElement("section");
Object.assign(section.style, {
border: "1px solid var(--border-color, rgba(255,255,255,.12))",
borderRadius: "8px", padding: "10px", display: "flex",
flexDirection: "column", gap: "8px"
});
const groupHeader = document.createElement("div");
Object.assign(groupHeader.style, {
display: "flex", justifyContent: "space-between", fontSize: "11px", opacity: ".8"
});
const groupName = document.createElement("strong");
const view = { grid: null, cards: [] };
const updateGroupTitle = () => {
groupName.textContent = t("Group") + " " + (groupIndex + 1) + " · " + view.cards.length + " " + t("images");
};
const removeCard = (card) => {
card.remove();
const at = view.cards.indexOf(card);
if (at >= 0) view.cards.splice(at, 1);
if (!view.cards.length) {
section.remove();
groupViews = groupViews.filter(v => v !== view);
} else {
updateGroupTitle();
}
};
const score = document.createElement("span");
score.textContent = group.similarity + "% " + t("similarity");
groupHeader.append(groupName, score);
const grid = document.createElement("div");
grid.className = "comfy-sidebar-similar-grid";
Object.assign(grid.style, {
display: "flex", flexWrap: "wrap", gap: GAP + "px", alignItems: "flex-start", width: "100%"
});
view.grid = grid;
// Zero-height spacer soaking up the free space on the last row so
// it keeps natural card sizes instead of stretching to full width.
const tailSpacer = document.createElement("div");
Object.assign(tailSpacer.style, {
flex: "1000000 1 0px", height: "0", marginTop: "-" + GAP + "px"
});
const previewAssets = group.items.map(item => ({
filename: item.filename,
subfolder: item.subfolder || "",
type: "output"
}));
group.items.forEach((item, itemIndex) => {
const card = document.createElement("div");
card.className = "comfy-sidebar-card completed";
Object.assign(card.style, {
position: "relative", cursor: "pointer", minWidth: "0", boxSizing: "border-box"
});
card._aspect = item.width > 0 && item.height > 0 ? item.width / item.height : 1;
const previewUrl = "/view?filename=" + encodeURIComponent(item.filename) +
"&type=output&subfolder=" + encodeURIComponent(item.subfolder || "");
const gridContent = document.createElement("div");
gridContent.style.width = "100%";
// Reserve the right height before the image arrives.
if (item.width > 0 && item.height > 0) gridContent.style.aspectRatio = item.width + " / " + item.height;
const cardObj = {
element: card,
grid: gridContent,
dimEl: null,
currentImageIndex: 0,
firstImgElement: null
};
const asset = {
filename: item.filename,
subfolder: item.subfolder || "",
type: "output",
url: previewUrl
};
previewAssets[itemIndex]._onPreviewAssetDeleted = () => removeCard(card);
// Use Gallery's media renderer so the image keeps its native
// aspect ratio and the spotlight remains on the card surface.
renderCardImages(cardObj, {
pid: `similar-${groupIndex}-${item.filename}`,
images: [asset],
_previewImages: previewAssets,
workflow: null
});
const nameBadge = document.createElement("div");
nameBadge.className = "comfy-sidebar-card-filename-badge";
nameBadge.textContent = item.filename;
nameBadge.title = item.filename;
const actions = document.createElement("div");
actions.className = "comfy-sidebar-hover-panel";
Object.assign(actions.style, {
position: "absolute", bottom: "4px", right: "4px",
flexDirection: "column", gap: "4px", zIndex: "20"
});
const deleteButton = document.createElement("span");
deleteButton.className = "pi pi-trash comfy-sidebar-card-action-btn comfy-sidebar-btn-del";
attachDeleteConfirmation(deleteButton, {
idleTitle: t("Delete file"),
confirmTitle: t("Click again to confirm deleting file"),
confirmDiskTitle: t("Ctrl+Click again to delete file from DISK / TRASH"),
onConfirm: async () => {
const action = await deleteFileOnServer({
filename: item.filename,
subfolder: item.subfolder || "",
type: "output"
});
if (action && action !== "missing") {
showNotification(
action === "trashed" ? t("Moved file to Recycle Bin.") : t("Permanently deleted file."),
"success", t("Delete File")
);
}
if (action) removeCard(card);
}
});
actions.appendChild(deleteButton);
card.append(gridContent, nameBadge, actions);
view.cards.push(card);
sizeCard(card);
grid.appendChild(card);
});
grid.appendChild(tailSpacer);
updateGroupTitle();
section.append(groupHeader, grid);
results.appendChild(section);
groupViews.push(view);
if (!cardChrome) resizeAllCards();
});
} catch (error) {
if (error?.name === "AbortError" || id !== requestId) return;
status.textContent = t("Could not scan prompts");
const message = document.createElement("div");
message.textContent = error?.message || String(error);
message.style.cssText = "padding:20px;color:var(--error-text,#f87171);font-size:12px";
results.appendChild(message);
} finally {
if (requestController === controller) requestController = null;
}
};
threshold.addEventListener("input", () => {
thresholdValue.textContent = threshold.value + "%";
saveSettings();
clearTimeout(debounce);
debounce = setTimeout(loadGroups, 250);
});
await loadGroups();
return overlay;
}
+223 -13
View File
@@ -1,4 +1,4 @@
import { isVideoFormat, is3DFormat, isAudioFormat, getFilenameFromUrl } from "./utils.js";
import { isVideoFormat, is3DFormat, isAudioFormat, getFilenameFromUrl, isImageFormat, findImagesInOutputs, attachDeleteConfirmation } from "./utils.js";
import { create3DViewer } from "./viewer3d.js";
import { createTextReader } from "./text_reader.js";
import { stopAllAudioPlayback } from "../ui/audioController.js";
@@ -6,11 +6,32 @@ import { SidebarOverlay } from "./overlay.js";
import { store } from "../core/store.js";
import { PromptStatus } from "../core/constants.js";
import { t } from "../core/i18n.js";
import { deleteFileOnServer, removeImageFromNodeOutputs } from "../ui/mediaActions.js";
import { showNotification } from "./nodeRenumber.js";
let activeComparisonViewer = null;
let isRuntimePreviewActive = false;
let onRuntimePreviewStateChange = null;
async function deletePromptPreviewAsset(state, asset) {
const action = await deleteFileOnServer(asset);
if (!["trashed", "deleted", "missing"].includes(action)) return false;
if (action !== "missing") {
showNotification(
action === "trashed" ? t("Moved file to Recycle Bin.") : t("Permanently deleted file."),
"success", t("Delete File")
);
}
const sameFile = item => item &&
item.filename === asset.filename &&
(item.subfolder || "") === (asset.subfolder || "") &&
(item.type || "output") === (asset.type || "output");
state.images = (state.images || []).filter(item => !sameFile(item));
if (state.nodeOutputs) removeImageFromNodeOutputs(state.nodeOutputs, asset);
store.updatePrompt(state.pid, state);
return true;
}
export function isRuntimePreviewEnabled() {
return isRuntimePreviewActive;
}
@@ -64,7 +85,20 @@ export function focusRuntimePreviewTarget() {
if (activePrompt && activePrompt.status === PromptStatus.ACTIVE) {
const previewSrc = activePrompt._previewBlobUrl ||
(activePrompt.images && activePrompt.images.length > 0 ? (activePrompt.images[0].url || activePrompt.images[0].filename) : null);
showFullscreenPreview([previewSrc || ""], false, activePrompt.pid);
const promptImages = [
...(activePrompt.images || []),
...(activePrompt.nodeOutputs ? findImagesInOutputs(activePrompt.nodeOutputs, activePrompt.workflow) : [])
];
const previewImages = promptImages.filter((img, index, all) =>
img && isImageFormat(img.filename || img.url) &&
all.findIndex(other => other && (other.filename || other.url) === (img.filename || img.url)) === index
);
const previewUrls = previewImages.map(img => img.url || `/view?filename=${encodeURIComponent(img.filename)}&type=${img.type || "output"}&subfolder=${encodeURIComponent(img.subfolder || "")}${activePrompt.pid ? "&rand=" + encodeURIComponent(activePrompt.pid) : ""}`);
const startIndex = previewImages.findIndex(img => img.url === previewSrc || img.filename === activePrompt.images?.[0]?.filename);
showFullscreenPreview(previewUrls.length ? previewUrls : [previewSrc || ""], false, activePrompt.pid, Math.max(0, startIndex), {
assets: previewImages,
onDelete: asset => deletePromptPreviewAsset(activePrompt, asset)
});
return;
}
@@ -77,7 +111,19 @@ export function focusRuntimePreviewTarget() {
const randParam = latest.pid ? `&rand=${encodeURIComponent(latest.pid)}` : "";
const src = latest._previewBlobUrl ||
(firstImg ? (firstImg.url || `/view?filename=${encodeURIComponent(firstImg.filename)}&type=${firstImg.type || 'output'}&subfolder=${encodeURIComponent(firstImg.subfolder || '')}${randParam}`) : "");
showFullscreenPreview([src || ""], false, latest.pid);
const promptImages = [
...(latest.images || []),
...(latest.nodeOutputs ? findImagesInOutputs(latest.nodeOutputs, latest.workflow) : [])
];
const previewImages = promptImages.filter((img, index, all) =>
img && isImageFormat(img.filename || img.url) &&
all.findIndex(other => other && (other.filename || other.url) === (img.filename || img.url)) === index
);
const previewUrls = previewImages.map(img => img.url || `/view?filename=${encodeURIComponent(img.filename)}&type=${img.type || "output"}&subfolder=${encodeURIComponent(img.subfolder || "")}${randParam}`);
showFullscreenPreview(previewUrls.length ? previewUrls : [src || ""], false, latest.pid, 0, {
assets: previewImages,
onDelete: asset => deletePromptPreviewAsset(latest, asset)
});
} else {
// Queue is totally empty
showFullscreenPreview([""], false, null);
@@ -124,6 +170,7 @@ function createAudioViewer(baseSrc, onSwitchMedia = () => {}, onDestroy = () =>
let togglePlayFn = () => {};
const overlay = new SidebarOverlay({
zIndex: 1100,
onDestroy,
onUserClose: () => {
if (isRuntimePreviewActive) setRuntimePreviewEnabled(false, false);
@@ -463,18 +510,32 @@ const setupVideoPlayback = (vid, container) => {
};
};
function createComparisonViewer(baseSrc, onDestroy = () => {}) {
function createComparisonViewer(baseSrc, onDestroy = () => {}, navigationItems = [], startIndex = 0, previewOptions = {}) {
const isBaseVideo = isVideoFormat(baseSrc);
let splitRatio = 50;
let splitRatio = 50;
let mediaB = null;
let navItems = Array.isArray(navigationItems) ? navigationItems.filter(Boolean) : [];
let navAssets = Array.isArray(previewOptions.assets) ? previewOptions.assets.slice() : [];
let navIndex = Math.max(0, Math.min(startIndex, navItems.length - 1));
let navigate = () => {};
const overlay = new SidebarOverlay({
zIndex: 1100,
onDestroy,
onUserClose: () => {
if (isRuntimePreviewActive) setRuntimePreviewEnabled(false, false);
},
onKeyDown: (e) => {
if (e.key === " " && mediaB) {
if ((e.key === "ArrowLeft" || e.key === "ArrowRight") && navItems.length > 1) {
e.preventDefault();
e.stopPropagation();
navigate(e.key === "ArrowRight" ? 1 : -1);
} else if (e.key === "Delete" && !e.repeat && navAssets[navIndex] && typeof previewOptions.onDelete === "function") {
e.preventDefault();
e.stopPropagation();
// Uses the same two-step confirmation state as clicking the trash icon.
deleteButton.click();
} else if (e.key === " " && mediaB) {
e.preventDefault();
updateSliderPosition(splitRatio > 50 ? 0 : 100);
}
@@ -630,6 +691,13 @@ function createComparisonViewer(baseSrc, onDestroy = () => {}) {
const hA = mediaA.naturalHeight || mediaA.videoHeight || 0;
if (!wA || !hA) return;
// Runtime previews always stay centered and fitted, without changing the
// zoom preference retained for ordinary image inspection.
if (isRuntimePreviewActive) {
scrollContainer.scrollTop = 0;
scrollContainer.scrollLeft = 0;
}
// Calculate available space inside the preview area
const availW = Math.max(100, (scrollContainer.clientWidth || window.innerWidth) - 48);
const availH = Math.max(100, (scrollContainer.clientHeight || window.innerHeight) - 96);
@@ -647,9 +715,9 @@ function createComparisonViewer(baseSrc, onDestroy = () => {}) {
if (!mediaB) {
slider.style.display = "none";
wrapper.style.cursor = isBaseVideo ? "default" : (isZoomed ? "zoom-out" : "zoom-in");
wrapper.style.cursor = isBaseVideo || isRuntimePreviewActive ? "default" : (isZoomed ? "zoom-out" : "zoom-in");
if (mediaA) mediaA.style.pointerEvents = isBaseVideo ? "none" : "auto";
if (isZoomed) {
if (isZoomed && !isRuntimePreviewActive) {
wrapper.style.maxWidth = "none";
wrapper.style.maxHeight = "none";
wrapper.style.width = `${wA}px`;
@@ -776,7 +844,7 @@ function createComparisonViewer(baseSrc, onDestroy = () => {}) {
}
const toggleZoom = () => {
if (isBaseVideo) return;
if (isBaseVideo || isRuntimePreviewActive) return;
isZoomed = !isZoomed;
syncImageScales();
if (!isZoomed) {
@@ -861,8 +929,142 @@ function createComparisonViewer(baseSrc, onDestroy = () => {}) {
cleanupMedia(mediaB);
});
const navButtonStyle = {
position: "absolute", top: "50%", transform: "translateY(-50%)",
width: "30px", height: "30px", borderRadius: "50%",
border: "1px solid var(--border-color, rgba(255,255,255,.18))",
background: "color-mix(in srgb, var(--card, #181818) 88%, transparent)",
color: "var(--fg-color, #eee)", fontSize: "18px", cursor: "pointer",
zIndex: "35", pointerEvents: "auto", backdropFilter: "blur(8px)"
};
const prevButton = document.createElement("button");
prevButton.type = "button";
prevButton.title = t("Previous image (←)");
Object.assign(prevButton.style, navButtonStyle, {
left: "18px", padding: "0", lineHeight: "1", appearance: "none",
display: "flex", alignItems: "center", justifyContent: "center"
});
const prevIcon = document.createElement("span");
prevIcon.className = "pi pi-angle-left";
prevIcon.style.pointerEvents = "none";
prevButton.appendChild(prevIcon);
const nextButton = document.createElement("button");
nextButton.type = "button";
nextButton.title = t("Next image (→)");
Object.assign(nextButton.style, navButtonStyle, {
right: "18px", padding: "0", lineHeight: "1", appearance: "none",
display: "flex", alignItems: "center", justifyContent: "center"
});
const nextIcon = document.createElement("span");
nextIcon.className = "pi pi-angle-right";
nextIcon.style.pointerEvents = "none";
nextButton.appendChild(nextIcon);
const deleteButton = document.createElement("button");
deleteButton.type = "button";
deleteButton.className = "comfy-sidebar-preview-delete";
deleteButton.title = t("Delete current image");
Object.assign(deleteButton.style, navButtonStyle, {
top: "auto", bottom: "24px", right: "24px", transform: "none",
padding: "0", lineHeight: "1", appearance: "none",
fontSize: "15px", display: "none", alignItems: "center", justifyContent: "center"
});
const deleteIcon = document.createElement("span");
deleteIcon.className = "pi pi-trash";
Object.assign(deleteIcon.style, {
display: "block", lineHeight: "1", pointerEvents: "none",
transform: "none"
});
deleteButton.appendChild(deleteIcon);
attachDeleteConfirmation(deleteButton, {
canDiskDelete: false,
idleTitle: t("Delete current image"),
confirmTitle: t("Click again to confirm deleting this image"),
confirmDiskTitle: t("Click again to confirm deleting this image"),
onStateChange: (pending, disk) => {
if (pending) {
deleteButton.style.setProperty("background-color", disk ? "#7f1d1d" : "#dc3545", "important");
deleteButton.style.setProperty("color", disk ? "#ffc9c9" : "#ffffff", "important");
deleteButton.style.setProperty("box-shadow", disk
? "0 0 10px rgba(220, 38, 38, 0.85)"
: "0 0 8px rgba(220, 53, 69, 0.6)", "important");
deleteButton.style.setProperty("border-color", disk ? "#ef4444" : "#dc3545", "important");
} else {
for (const property of ["background-color", "color", "box-shadow", "border-color"]) {
deleteButton.style.removeProperty(property);
}
}
},
onConfirm: async () => {
const asset = navAssets[navIndex];
if (!asset || typeof previewOptions.onDelete !== "function") return;
const removed = await previewOptions.onDelete(asset);
if (!removed) return;
navItems.splice(navIndex, 1);
navAssets.splice(navIndex, 1);
if (!navItems.length) {
overlay.destroy();
return;
}
navIndex = Math.min(navIndex, navItems.length - 1);
navigate(0);
updateNavigation();
}
});
const updateNavigation = () => {
const visible = navItems.length > 1;
prevButton.style.display = nextButton.style.display = visible ? "flex" : "none";
prevButton.style.alignItems = nextButton.style.alignItems = "center";
prevButton.style.justifyContent = nextButton.style.justifyContent = "center";
deleteButton.style.display = navAssets[navIndex] && typeof previewOptions.onDelete === "function" ? "flex" : "none";
};
navigate = (delta) => {
if (!navItems.length || (navItems.length < 2 && delta !== 0)) return;
navIndex = (navIndex + delta + navItems.length) % navItems.length;
const targetSrc = navItems[navIndex];
if (!targetSrc) return;
if (mediaB) {
cleanupMedia(mediaB);
mediaB.remove();
mediaB = null;
}
slider.style.display = "none";
// Keep the current frame visible while the next image loads to avoid a blank flash.
const preload = new Image();
preload.onload = () => {
mediaA.onload = null;
mediaA.onerror = () => showPlaceholder();
mediaA.src = targetSrc;
hidePlaceholder();
infoText.style.color = "#aaa";
infoText.textContent = t("Click image to zoom (100%/Fit) | Shift+Click another card to compare.");
syncImageScales();
};
preload.onerror = () => {
mediaA.onerror = () => showPlaceholder();
mediaA.src = targetSrc;
};
preload.src = targetSrc;
if (!isZoomed) {
scrollContainer.scrollTop = 0;
scrollContainer.scrollLeft = 0;
}
};
prevButton.onclick = (e) => { e.stopPropagation(); navigate(-1); };
nextButton.onclick = (e) => { e.stopPropagation(); navigate(1); };
overlay.container.append(prevButton, nextButton, deleteButton);
updateNavigation();
return {
is3D: false,
setNavigationItems(items, index = 0, assets = null, options = null) {
navItems = Array.isArray(items) ? items.filter(Boolean) : [];
if (Array.isArray(assets)) navAssets = assets.slice();
if (options) previewOptions = options;
navIndex = Math.max(0, Math.min(index, navItems.length - 1));
updateNavigation();
},
isAudio: false,
isText: false,
loadTarget(targetSrc, isShiftClick) {
@@ -915,10 +1117,14 @@ function createComparisonViewer(baseSrc, onDestroy = () => {}) {
};
}
export function showFullscreenPreview(imgSrcs, isShiftClick = false, pid = null) {
export function showFullscreenPreview(imgSrcs, isShiftClick = false, pid = null, startIndex = 0, previewOptions = {}) {
if (!imgSrcs || imgSrcs.length === 0) return;
const item = imgSrcs[0];
const selectedIndex = Math.max(0, Math.min(Number(startIndex) || 0, imgSrcs.length - 1));
const item = imgSrcs[selectedIndex];
const navigationItems = imgSrcs.map(entry =>
typeof entry === "string" ? entry : (entry?.url || entry?.filename || "")
).filter(Boolean);
const targetPid = pid || (typeof item === "object" && item ? item.pid : null);
const pidStr = targetPid ? String(targetPid) : null;
@@ -1006,14 +1212,18 @@ export function showFullscreenPreview(imgSrcs, isShiftClick = false, pid = null)
activeComparisonViewer = null;
} else {
activeComparisonViewer.targetPid = pidStr;
activeComparisonViewer.setNavigationItems?.(navigationItems, selectedIndex, previewOptions.assets, previewOptions);
activeComparisonViewer.loadTarget(src, isShiftClick);
return;
}
}
activeComparisonViewer = createComparisonViewer(
src,
() => { activeComparisonViewer = null; }
src,
() => { activeComparisonViewer = null; },
navigationItems,
selectedIndex,
previewOptions
);
if (activeComparisonViewer) {
activeComparisonViewer.targetPid = pidStr;
+22 -4
View File
@@ -1,13 +1,16 @@
import { findActiveSidebars } from "../comfy/adapter.js";
const activeOverlays = [];
export class SidebarOverlay {
constructor(options = {}) {
this.onDestroy = options.onDestroy || (() => {});
this.onUserClose = options.onUserClose || (() => {});
this.cleanupFns = [];
this.observedElements = new Set();
activeOverlays.push(this);
// Elevate sidebars above overlay
// Keep sidebars elevated until the final stacked overlay is closed.
document.body.classList.add("comfy-sidebar-overlay-active");
// Root container: visual backdrop (covers 100% flush from sidebar to sidebar, zero gap)
@@ -19,7 +22,7 @@ export class SidebarOverlay {
backdropFilter: "blur(8px)",
color: "var(--fg-color, #eee)",
display: "flex", flexDirection: "column", alignItems: "center",
justifyContent: "center", zIndex: "1000", boxSizing: "border-box",
justifyContent: "center", zIndex: String(options.zIndex ?? 1000), boxSizing: "border-box",
overflow: "hidden", pointerEvents: "none", userSelect: "none"
});
@@ -37,7 +40,7 @@ export class SidebarOverlay {
});
this.container.appendChild(this.backdrop);
// Close button
// Optional built-in close button
this.closeBtn = document.createElement("span");
this.closeBtn.className = "pi pi-times";
this.closeBtn.title = "Close (Esc)";
@@ -63,6 +66,7 @@ export class SidebarOverlay {
this.onUserClose();
this.destroy();
};
if (options.closeButton === false) this.closeBtn.style.display = "none";
this.container.appendChild(this.closeBtn);
// ResizeObserver to track live drag-resizing on all active sidebars
@@ -103,10 +107,22 @@ export class SidebarOverlay {
// Global Key Handler (Esc to close)
const onKeyDown = (e) => {
// Highest z-index wins; ties go to the most recently opened overlay.
// This lets fullscreen previews remain interactive above utility overlays
// even when those overlays are opened afterwards.
const topmostOverlay = activeOverlays.reduce((top, candidate) => {
if (!top) return candidate;
const candidateZ = Number(candidate.container.style.zIndex) || 0;
const topZ = Number(top.container.style.zIndex) || 0;
return candidateZ >= topZ ? candidate : top;
}, null);
if (topmostOverlay !== this) return;
if (e.key === "Escape") {
e.preventDefault();
e.stopImmediatePropagation();
this.onUserClose();
this.destroy();
return;
}
if (options.onKeyDown) options.onKeyDown(e);
};
@@ -189,7 +205,9 @@ export class SidebarOverlay {
destroy() {
if (this.destroyed) return;
this.destroyed = true;
document.body.classList.remove("comfy-sidebar-overlay-active");
const stackIndex = activeOverlays.indexOf(this);
if (stackIndex >= 0) activeOverlays.splice(stackIndex, 1);
if (activeOverlays.length === 0) document.body.classList.remove("comfy-sidebar-overlay-active");
for (const fn of this.cleanupFns.splice(0)) {
try { fn(); } catch (e) {}
+48 -8
View File
@@ -16,7 +16,7 @@ export function injectStyles() {
.comfy-sidebar-card:hover {
border-color: color-mix(in srgb, var(--border, var(--border-color, #555)) 50%, var(--foreground, var(--fg-color, #fff)) 50%) !important;
background: color-mix(in srgb, var(--card, var(--secondary, var(--p-surface-800, var(--comfy-menu-bg, #262626)))) 85%, var(--foreground, var(--fg-color, #fff)) 15%) !important;
transition: border-color 0.2s, background-color 0.2s;
transition: border-color 0.1s ease-out, background-color 0.1s ease-out;
}
/* Border & Frame Spotlight (Uses the theme's main hue) */
@@ -32,7 +32,8 @@ export function injectStyles() {
transparent 70%
);
opacity: 0;
transition: opacity 0.25s ease;
/* Leaving fades out quickly so a fast sweep over many cards doesn't leave a glow trail */
transition: opacity 0.12s ease-out;
pointer-events: none;
z-index: 1;
}
@@ -40,6 +41,8 @@ export function injectStyles() {
.comfy-sidebar-card:hover::before,
.comfy-sidebar-folder-card:hover::before {
opacity: 0.65;
/* Entering is near-instant so the glow keeps up with the cursor */
transition: opacity 0.05s ease-out;
}
/* Active job uses the theme accent (orange); Cancelled & Error remain standout Yellow & Red */
.comfy-sidebar-card.active { border-color: var(--primary, var(--p-primary-color, #ea580c)) !important; --hover-color: var(--primary, var(--p-primary-color, #ea580c)); }
@@ -149,7 +152,12 @@ export function injectStyles() {
font-size: 13px !important;
border-radius: 6px !important;
cursor: pointer !important;
transition: all 0.15s ease !important;
/* Constant box: Ctrl mode only recolors the border, so size and padding
never animate. Only colors transition (no slide/grow effects). */
box-sizing: border-box;
border: 1px solid transparent;
transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease,
box-shadow 0.15s ease, opacity 0.15s ease !important;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
z-index: 20 !important;
transform: translateZ(0);
@@ -170,6 +178,22 @@ export function injectStyles() {
letter-spacing: 0.3px;
}
/* Fullscreen preview trash button uses the same confirmation glow as card deletes. */
.comfy-sidebar-preview-delete.confirm-delete,
.comfy-sidebar-preview-delete.confirm-delete:hover {
background-color: #dc3545 !important;
color: #ffffff !important;
box-shadow: 0 0 8px rgba(220, 53, 69, 0.6) !important;
}
.comfy-sidebar-preview-delete.confirm-delete-disk,
.comfy-sidebar-preview-delete.confirm-delete-disk:hover {
background-color: #7f1d1d !important;
color: #ffc9c9 !important;
box-shadow: 0 0 10px rgba(220, 38, 38, 0.85) !important;
border: 1px solid #ef4444 !important;
}
/* Delete Confirmation Active State */
.comfy-sidebar-card-action-btn.confirm-delete,
.comfy-sidebar-card-action-btn.confirm-delete:hover {
@@ -215,7 +239,7 @@ export function injectStyles() {
display: inline-flex !important;
background-color: #166534 !important;
color: #ffffff !important;
border: 1px solid #22c55e !important;
border-color: #22c55e !important;
width: auto !important;
padding: 0 8px !important;
}
@@ -223,17 +247,33 @@ export function injectStyles() {
body.comfy-sidebar-ctrl-active .comfy-sidebar-btn-del {
background-color: #991b1b !important;
color: #ffffff !important;
border: 1px solid #ef4444 !important;
width: auto !important;
padding: 0 8px !important;
border-color: #ef4444 !important;
border-radius: 6px !important;
box-shadow: 0 0 10px rgba(239, 68, 68, 0.6) !important;
}
/* Only buttons that gain a text label (Queue/Gallery) get wider; icon-only
delete buttons (Similar Prompts) keep their size and just glow. */
body.comfy-sidebar-ctrl-active .comfy-sidebar-btn-del:has(.comfy-sidebar-del-label) {
width: auto !important;
padding: 0 8px !important;
}
body.comfy-sidebar-ctrl-active .comfy-sidebar-btn-del .comfy-sidebar-del-label {
display: inline;
}
/* Anything that appears because Ctrl is held fades in instead of sliding/growing. */
@keyframes comfy-sidebar-fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
body.comfy-sidebar-ctrl-active .comfy-sidebar-btn-move,
body.comfy-sidebar-ctrl-active .comfy-sidebar-gallery-btn-del,
body.comfy-sidebar-ctrl-active .comfy-sidebar-btn-del .comfy-sidebar-del-label {
animation: comfy-sidebar-fade-in 0.15s ease both;
}
/* Translucent Folder Indicator on Ctrl Press */
.comfy-sidebar-ctrl-overlay {
position: absolute;
@@ -846,7 +886,7 @@ export function injectStyles() {
display: flex;
align-items: center;
gap: 8px;
transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
transition: border-color 0.1s ease-out, background-color 0.1s ease-out, transform 0.1s ease;
user-select: none;
min-width: 0;
position: relative;
+2
View File
@@ -574,6 +574,7 @@ export function attachDeleteConfirmation(btn, options = {}) {
isDisk = false;
btn.classList.remove("confirm-delete", "confirm-delete-disk");
btn.title = typeof idleTitle === "function" ? idleTitle() : idleTitle;
if (typeof options.onStateChange === "function") options.onStateChange(false, false);
if (timer) {
clearTimeout(timer);
timer = null;
@@ -590,6 +591,7 @@ export function attachDeleteConfirmation(btn, options = {}) {
isPending = true;
isDisk = wantsDisk;
btn.classList.add(wantsDisk ? "confirm-delete-disk" : "confirm-delete");
if (typeof options.onStateChange === "function") options.onStateChange(true, wantsDisk);
btn.title = wantsDisk
? (typeof confirmDiskTitle === "function" ? confirmDiskTitle() : confirmDiskTitle)
: (typeof confirmTitle === "function" ? confirmTitle() : confirmTitle);
+17 -1
View File
@@ -142,5 +142,21 @@
"Permanently deleted {count} TEMP item(s).": "تم حذف {count} من عناصر TEMP نهائيًا.",
"Could not delete {count} TEMP item(s).": "تعذّر حذف {count} من عناصر TEMP.",
"TEMP cleanup stopped because a workflow entered the queue.": "توقّف تنظيف TEMP بسبب دخول مهمة سير عمل إلى قائمة الانتظار.",
"Click again to clear all history": "انقر مرة أخرى لمسح السجل بالكامل"
"Click again to clear all history": "انقر مرة أخرى لمسح السجل بالكامل",
"Card size": "حجم البطاقة",
"Click again to confirm deleting this image": "انقر مرة أخرى لتأكيد حذف هذه الصورة",
"Could not scan prompts": "تعذّر فحص المطالبات",
"Delete current image": "حذف الصورة الحالية",
"Delete file": "حذف الملف",
"Find Similar Prompts": "العثور على مطالبات مشابهة",
"Group": "مجموعة",
"Next image (→)": "الصورة التالية (→)",
"No similar prompt groups found at this threshold.": "لم يتم العثور على مجموعات مطالبات مشابهة عند حدّ التشابه هذا.",
"Previous image (←)": "الصورة السابقة (←)",
"Scanning prompts...": "جارٍ فحص المطالبات...",
"Similar prompt groups": "مجموعات المطالبات المتشابهة",
"Similarity threshold": "حدّ التشابه",
"images": "صور",
"similarity": "التشابه",
"{count} groups · {scanned} PNGs scanned": "{count} مجموعة · تم فحص {scanned} صورة PNG"
}
+4 -1
View File
@@ -62,5 +62,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "منتقي سير العمل السريع",
"tooltip": "إظهار منتقي سير العمل السريع عند إنشاء سير عمل فارغ جديد"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "إخفاء زر التشغيل على Comfy Cloud"
}
}
}
+17 -1
View File
@@ -159,5 +159,21 @@
"Moved selected image to Outputs.": "Moved selected image to Outputs.",
"Failed to move image to Outputs.": "Failed to move image to Outputs.",
"Move to Outputs": "Move to Outputs",
"Click again to clear all history": "Click again to clear all history"
"Click again to clear all history": "Click again to clear all history",
"Card size": "Card size",
"Click again to confirm deleting this image": "Click again to confirm deleting this image",
"Could not scan prompts": "Could not scan prompts",
"Delete current image": "Delete current image",
"Delete file": "Delete file",
"Find Similar Prompts": "Find Similar Prompts",
"Group": "Group",
"Next image (→)": "Next image (→)",
"No similar prompt groups found at this threshold.": "No similar prompt groups found at this threshold.",
"Previous image (←)": "Previous image (←)",
"Scanning prompts...": "Scanning prompts...",
"Similar prompt groups": "Similar prompt groups",
"Similarity threshold": "Similarity threshold",
"images": "images",
"similarity": "similarity",
"{count} groups · {scanned} PNGs scanned": "{count} groups · {scanned} PNGs scanned"
}
+4 -1
View File
@@ -65,5 +65,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "Quick Workflow Picker",
"tooltip": "Show quick workflow picker when creating a new blank workflow"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "Hide Run on Comfy Cloud button"
}
}
}
+17 -1
View File
@@ -142,5 +142,21 @@
"Permanently deleted {count} TEMP item(s).": "Se eliminaron permanentemente {count} elementos TEMP.",
"Could not delete {count} TEMP item(s).": "No se pudieron eliminar {count} elementos TEMP.",
"TEMP cleanup stopped because a workflow entered the queue.": "La limpieza de TEMP se detuvo porque se añadió un flujo de trabajo a la cola.",
"Click again to clear all history": "Haz clic de nuevo para borrar todo el historial"
"Click again to clear all history": "Haz clic de nuevo para borrar todo el historial",
"Card size": "Tamaño de tarjeta",
"Click again to confirm deleting this image": "Haz clic de nuevo para confirmar que quieres eliminar esta imagen",
"Could not scan prompts": "No se pudieron analizar los prompts",
"Delete current image": "Eliminar imagen actual",
"Delete file": "Eliminar archivo",
"Find Similar Prompts": "Buscar prompts similares",
"Group": "Grupo",
"Next image (→)": "Imagen siguiente (→)",
"No similar prompt groups found at this threshold.": "No se encontraron grupos de prompts similares con este umbral.",
"Previous image (←)": "Imagen anterior (←)",
"Scanning prompts...": "Analizando prompts...",
"Similar prompt groups": "Grupos de prompts similares",
"Similarity threshold": "Umbral de similitud",
"images": "imágenes",
"similarity": "similitud",
"{count} groups · {scanned} PNGs scanned": "{count} grupos · {scanned} archivos PNG analizados"
}
+4 -1
View File
@@ -62,5 +62,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "Selector rápido de flujos de trabajo",
"tooltip": "Mostrar el selector rápido de flujos de trabajo al crear un nuevo flujo en blanco"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "Ocultar el botón Ejecutar en Comfy Cloud"
}
}
}
+17 -1
View File
@@ -142,5 +142,21 @@
"Permanently deleted {count} TEMP item(s).": "{count} مورد TEMP برای همیشه حذف شد.",
"Could not delete {count} TEMP item(s).": "حذف {count} مورد TEMP ممکن نشد.",
"TEMP cleanup stopped because a workflow entered the queue.": "پاک‌سازی TEMP متوقف شد، چون یک گردش‌کار وارد صف شد.",
"Click again to clear all history": "برای پاک کردن کل تاریخچه دوباره کلیک کنید"
"Click again to clear all history": "برای پاک کردن کل تاریخچه دوباره کلیک کنید",
"Card size": "اندازه کارت",
"Click again to confirm deleting this image": "برای تأیید حذف این تصویر دوباره کلیک کنید",
"Could not scan prompts": "اسکن پرامپت‌ها انجام نشد",
"Delete current image": "حذف تصویر فعلی",
"Delete file": "حذف فایل",
"Find Similar Prompts": "پیدا کردن پرامپت‌های مشابه",
"Group": "گروه",
"Next image (→)": "تصویر بعدی (→)",
"No similar prompt groups found at this threshold.": "در این آستانه، گروهی از پرامپت‌های مشابه پیدا نشد.",
"Previous image (←)": "تصویر قبلی (←)",
"Scanning prompts...": "در حال اسکن پرامپت‌ها...",
"Similar prompt groups": "گروه‌های پرامپت مشابه",
"Similarity threshold": "آستانه شباهت",
"images": "تصاویر",
"similarity": "شباهت",
"{count} groups · {scanned} PNGs scanned": "{count} گروه · {scanned} فایل PNG اسکن شد"
}
+4 -1
View File
@@ -62,5 +62,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "انتخابگر سریع گردش کار",
"tooltip": "نمایش انتخابگر سریع گردش کار هنگام ایجاد یک گردش کار خالی جدید"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "پنهان کردن دکمه اجرا در Comfy Cloud"
}
}
}
+17 -1
View File
@@ -142,5 +142,21 @@
"Permanently deleted {count} TEMP item(s).": "{count} élément(s) TEMP supprimé(s) définitivement.",
"Could not delete {count} TEMP item(s).": "Impossible de supprimer {count} élément(s) TEMP.",
"TEMP cleanup stopped because a workflow entered the queue.": "Le nettoyage de TEMP a été interrompu car un workflow a été ajouté à la file.",
"Click again to clear all history": "Cliquez à nouveau pour effacer tout l’historique"
"Click again to clear all history": "Cliquez à nouveau pour effacer tout l’historique",
"Card size": "Taille des cartes",
"Click again to confirm deleting this image": "Cliquez à nouveau pour confirmer la suppression de cette image",
"Could not scan prompts": "Impossible d’analyser les prompts",
"Delete current image": "Supprimer l’image actuelle",
"Delete file": "Supprimer le fichier",
"Find Similar Prompts": "Trouver des prompts similaires",
"Group": "Groupe",
"Next image (→)": "Image suivante (→)",
"No similar prompt groups found at this threshold.": "Aucun groupe de prompts similaires trouvé avec ce seuil.",
"Previous image (←)": "Image précédente (←)",
"Scanning prompts...": "Analyse des prompts...",
"Similar prompt groups": "Groupes de prompts similaires",
"Similarity threshold": "Seuil de similarité",
"images": "images",
"similarity": "similarité",
"{count} groups · {scanned} PNGs scanned": "{count} groupes · {scanned} fichiers PNG analysés"
}
+4 -1
View File
@@ -62,5 +62,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "Sélecteur rapide de workflow",
"tooltip": "Afficher le sélecteur rapide de workflow lors de la création d'un nouveau workflow vide"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "Masquer le bouton Exécuter sur Comfy Cloud"
}
}
}
+17 -1
View File
@@ -142,5 +142,21 @@
"Permanently deleted {count} TEMP item(s).": "{count} פריטי TEMP נמחקו לצמיתות.",
"Could not delete {count} TEMP item(s).": "לא ניתן למחוק {count} פריטי TEMP.",
"TEMP cleanup stopped because a workflow entered the queue.": "ניקוי TEMP נעצר כי תהליך עבודה נוסף לתור.",
"Click again to clear all history": "לחצו שוב כדי לנקות את כל ההיסטוריה"
"Click again to clear all history": "לחצו שוב כדי לנקות את כל ההיסטוריה",
"Card size": "גודל הכרטיס",
"Click again to confirm deleting this image": "לחצו שוב כדי לאשר את מחיקת התמונה הזו",
"Could not scan prompts": "לא ניתן לסרוק את הפרומפטים",
"Delete current image": "מחיקת התמונה הנוכחית",
"Delete file": "מחיקת הקובץ",
"Find Similar Prompts": "מציאת פרומפטים דומים",
"Group": "קבוצה",
"Next image (→)": "התמונה הבאה (→)",
"No similar prompt groups found at this threshold.": "לא נמצאו קבוצות של פרומפטים דומים בסף הזה.",
"Previous image (←)": "התמונה הקודמת (←)",
"Scanning prompts...": "סורק פרומפטים...",
"Similar prompt groups": "קבוצות פרומפטים דומים",
"Similarity threshold": "סף הדמיון",
"images": "תמונות",
"similarity": "דמיון",
"{count} groups · {scanned} PNGs scanned": "{count} קבוצות · נסרקו {scanned} קובצי PNG"
}
+4 -1
View File
@@ -62,5 +62,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "בוחר תהליכי עבודה מהיר",
"tooltip": "הצג בוחר תהליכי עבודה מהיר בעת יצירת תהליך עבודה ריק חדש"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "הסתרת כפתור ההפעלה ב-Comfy Cloud"
}
}
}
+17 -1
View File
@@ -142,5 +142,21 @@
"Permanently deleted {count} TEMP item(s).": "{count} elementi TEMP eliminati definitivamente.",
"Could not delete {count} TEMP item(s).": "Impossibile eliminare {count} elementi TEMP.",
"TEMP cleanup stopped because a workflow entered the queue.": "Pulizia di TEMP interrotta perché è stato aggiunto un flusso di lavoro alla coda.",
"Click again to clear all history": "Fai di nuovo clic per cancellare tutta la cronologia"
"Click again to clear all history": "Fai di nuovo clic per cancellare tutta la cronologia",
"Card size": "Dimensione scheda",
"Click again to confirm deleting this image": "Fai di nuovo clic per confermare l’eliminazione di questa immagine",
"Could not scan prompts": "Impossibile analizzare i prompt",
"Delete current image": "Elimina immagine corrente",
"Delete file": "Elimina file",
"Find Similar Prompts": "Trova prompt simili",
"Group": "Gruppo",
"Next image (→)": "Immagine successiva (→)",
"No similar prompt groups found at this threshold.": "Nessun gruppo di prompt simili trovato con questa soglia.",
"Previous image (←)": "Immagine precedente (←)",
"Scanning prompts...": "Analisi dei prompt...",
"Similar prompt groups": "Gruppi di prompt simili",
"Similarity threshold": "Soglia di somiglianza",
"images": "immagini",
"similarity": "somiglianza",
"{count} groups · {scanned} PNGs scanned": "{count} gruppi · {scanned} file PNG analizzati"
}
+4 -1
View File
@@ -62,5 +62,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "Selettore rapido dei workflow",
"tooltip": "Mostra il selettore rapido dei workflow quando crei un nuovo workflow vuoto"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "Nascondi il pulsante Esegui su Comfy Cloud"
}
}
}
+17 -1
View File
@@ -142,5 +142,21 @@
"Permanently deleted {count} TEMP item(s).": "TEMP項目を{count}件完全に削除しました。",
"Could not delete {count} TEMP item(s).": "TEMP項目を{count}件削除できませんでした。",
"TEMP cleanup stopped because a workflow entered the queue.": "ワークフローがキューに追加されたため、TEMPのクリーンアップを中止しました。",
"Click again to clear all history": "もう一度クリックすると、すべての履歴を消去します"
"Click again to clear all history": "もう一度クリックすると、すべての履歴を消去します",
"Card size": "カードサイズ",
"Click again to confirm deleting this image": "この画像の削除を確定するには、もう一度クリックしてください",
"Could not scan prompts": "プロンプトをスキャンできませんでした",
"Delete current image": "現在の画像を削除",
"Delete file": "ファイルを削除",
"Find Similar Prompts": "類似プロンプトを検索",
"Group": "グループ",
"Next image (→)": "次の画像 (→)",
"No similar prompt groups found at this threshold.": "このしきい値では類似プロンプトのグループは見つかりませんでした。",
"Previous image (←)": "前の画像 (←)",
"Scanning prompts...": "プロンプトをスキャン中...",
"Similar prompt groups": "類似プロンプトのグループ",
"Similarity threshold": "類似度のしきい値",
"images": "枚の画像",
"similarity": "類似度",
"{count} groups · {scanned} PNGs scanned": "{count} グループ · {scanned} 件の PNG をスキャン"
}
+4 -1
View File
@@ -62,5 +62,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "クイックワークフローピッカー",
"tooltip": "新しい空のワークフローを作成するときにクイックワークフローピッカーを表示する"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "Comfy Cloudで実行ボタンを非表示"
}
}
}
+17 -1
View File
@@ -142,5 +142,21 @@
"Permanently deleted {count} TEMP item(s).": "TEMP 항목 {count}개를 영구 삭제했습니다.",
"Could not delete {count} TEMP item(s).": "TEMP 항목 {count}개를 삭제할 수 없습니다.",
"TEMP cleanup stopped because a workflow entered the queue.": "워크플로가 대기열에 추가되어 TEMP 정리를 중단했습니다.",
"Click again to clear all history": "모든 기록을 지우려면 한 번 더 클릭하세요"
"Click again to clear all history": "모든 기록을 지우려면 한 번 더 클릭하세요",
"Card size": "카드 크기",
"Click again to confirm deleting this image": "이 이미지를 삭제하려면 다시 클릭하세요",
"Could not scan prompts": "프롬프트를 스캔할 수 없습니다",
"Delete current image": "현재 이미지 삭제",
"Delete file": "파일 삭제",
"Find Similar Prompts": "유사한 프롬프트 찾기",
"Group": "그룹",
"Next image (→)": "다음 이미지 (→)",
"No similar prompt groups found at this threshold.": "이 임계값에서는 유사한 프롬프트 그룹을 찾지 못했습니다.",
"Previous image (←)": "이전 이미지 (←)",
"Scanning prompts...": "프롬프트 스캔 중...",
"Similar prompt groups": "유사한 프롬프트 그룹",
"Similarity threshold": "유사도 임계값",
"images": "개 이미지",
"similarity": "유사도",
"{count} groups · {scanned} PNGs scanned": "그룹 {count}개 · PNG {scanned}개 스캔 완료"
}
+4 -1
View File
@@ -62,5 +62,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "빠른 워크플로우 선택기",
"tooltip": "새 빈 워크플로우를 만들 때 빠른 워크플로우 선택기 표시"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "Comfy Cloud에서 실행 버튼 숨기기"
}
}
}
+17 -1
View File
@@ -142,5 +142,21 @@
"Permanently deleted {count} TEMP item(s).": "{count} item(ns) TEMP excluído(s) permanentemente.",
"Could not delete {count} TEMP item(s).": "Não foi possível excluir {count} item(ns) TEMP.",
"TEMP cleanup stopped because a workflow entered the queue.": "A limpeza de TEMP foi interrompida porque um fluxo de trabalho entrou na fila.",
"Click again to clear all history": "Clique novamente para limpar todo o histórico"
"Click again to clear all history": "Clique novamente para limpar todo o histórico",
"Card size": "Tamanho do cartão",
"Click again to confirm deleting this image": "Clique novamente para confirmar a exclusão desta imagem",
"Could not scan prompts": "Não foi possível analisar os prompts",
"Delete current image": "Excluir imagem atual",
"Delete file": "Excluir arquivo",
"Find Similar Prompts": "Encontrar prompts semelhantes",
"Group": "Grupo",
"Next image (→)": "Próxima imagem (→)",
"No similar prompt groups found at this threshold.": "Nenhum grupo de prompts semelhantes encontrado neste limite.",
"Previous image (←)": "Imagem anterior (←)",
"Scanning prompts...": "Analisando prompts...",
"Similar prompt groups": "Grupos de prompts semelhantes",
"Similarity threshold": "Limite de similaridade",
"images": "imagens",
"similarity": "similaridade",
"{count} groups · {scanned} PNGs scanned": "{count} grupos · {scanned} arquivos PNG analisados"
}
+4 -1
View File
@@ -62,5 +62,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "Seletor Rápido de Fluxos",
"tooltip": "Mostrar seletor rápido de fluxos ao criar um novo fluxo em branco"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "Ocultar o botão Executar no Comfy Cloud"
}
}
}
+17 -1
View File
@@ -153,5 +153,21 @@
"Move selected image to Outputs (Ctrl+Click)": "Переместить выбранное изображение в Outputs (Ctrl+щелчок)",
"Moved selected image to Outputs.": "Выбранное изображение перемещено в Outputs.",
"Failed to move image to Outputs.": "Не удалось переместить изображение в Outputs.",
"Click again to clear all history": "Нажмите ещё раз, чтобы очистить всю историю"
"Click again to clear all history": "Нажмите ещё раз, чтобы очистить всю историю",
"Card size": "Размер карточки",
"Click again to confirm deleting this image": "Нажмите ещё раз, чтобы подтвердить удаление этого изображения",
"Could not scan prompts": "Не удалось просканировать промпты",
"Delete current image": "Удалить текущее изображение",
"Delete file": "Удалить файл",
"Find Similar Prompts": "Найти похожие промпты",
"Group": "Группа",
"Next image (→)": "Следующее изображение (→)",
"No similar prompt groups found at this threshold.": "При этом пороге похожих групп промптов не найдено.",
"Previous image (←)": "Предыдущее изображение (←)",
"Scanning prompts...": "Сканирование промптов...",
"Similar prompt groups": "Группы похожих промптов",
"Similarity threshold": "Порог сходства",
"images": "изображений",
"similarity": "сходство",
"{count} groups · {scanned} PNGs scanned": "Групп: {count} · Просканировано PNG: {scanned}"
}
+4 -1
View File
@@ -65,5 +65,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "Быстрый выбор рабочего процесса",
"tooltip": "Показывать быстрый выбор при создании нового пустого рабочего процесса"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "Скрыть кнопку «Запустить в Comfy Cloud»"
}
}
}
+17 -1
View File
@@ -142,5 +142,21 @@
"Permanently deleted {count} TEMP item(s).": "{count} TEMP öğesi kalıcı olarak silindi.",
"Could not delete {count} TEMP item(s).": "{count} TEMP öğesi silinemedi.",
"TEMP cleanup stopped because a workflow entered the queue.": "Kuyruğa bir iş akışı eklendiği için TEMP temizliği durduruldu.",
"Click again to clear all history": "Tüm geçmişi temizlemek için tekrar tıklayın"
"Click again to clear all history": "Tüm geçmişi temizlemek için tekrar tıklayın",
"Card size": "Kart boyutu",
"Click again to confirm deleting this image": "Bu görseli silmeyi onaylamak için tekrar tıklayın",
"Could not scan prompts": "İstemler taranamadı",
"Delete current image": "Geçerli görseli sil",
"Delete file": "Dosyayı sil",
"Find Similar Prompts": "Benzer istemleri bul",
"Group": "Grup",
"Next image (→)": "Sonraki görsel (→)",
"No similar prompt groups found at this threshold.": "Bu eşikte benzer istem grubu bulunamadı.",
"Previous image (←)": "Önceki görsel (←)",
"Scanning prompts...": "İstemler taranıyor...",
"Similar prompt groups": "Benzer istem grupları",
"Similarity threshold": "Benzerlik eşiği",
"images": "görsel",
"similarity": "benzerlik",
"{count} groups · {scanned} PNGs scanned": "{count} grup · {scanned} PNG tarandı"
}
+4 -1
View File
@@ -62,5 +62,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "Hızlı İş Akışı Seçici",
"tooltip": "Yeni bir boş iş akışı oluştururken hızlı iş akışı seçiciyi göster"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "Comfy Cloud'da Çalıştır düğmesini gizle"
}
}
}
+17 -1
View File
@@ -142,5 +142,21 @@
"Permanently deleted {count} TEMP item(s).": "已永久刪除 {count} 個 TEMP 項目。",
"Could not delete {count} TEMP item(s).": "無法刪除 {count} 個 TEMP 項目。",
"TEMP cleanup stopped because a workflow entered the queue.": "工作流程進入佇列,因此已停止 TEMP 清理。",
"Click again to clear all history": "再次點擊以清除所有歷史記錄"
"Click again to clear all history": "再次點擊以清除所有歷史記錄",
"Card size": "卡片大小",
"Click again to confirm deleting this image": "再次點擊以確認刪除此圖片",
"Could not scan prompts": "無法掃描提示詞",
"Delete current image": "刪除目前圖片",
"Delete file": "刪除檔案",
"Find Similar Prompts": "尋找相似提示詞",
"Group": "群組",
"Next image (→)": "下一張圖片 (→)",
"No similar prompt groups found at this threshold.": "在此相似度門檻下找不到相似提示詞群組。",
"Previous image (←)": "上一張圖片 (←)",
"Scanning prompts...": "正在掃描提示詞...",
"Similar prompt groups": "相似提示詞群組",
"Similarity threshold": "相似度門檻",
"images": "張圖片",
"similarity": "相似度",
"{count} groups · {scanned} PNGs scanned": "{count} 個群組 · 已掃描 {scanned} 張 PNG"
}
+4 -1
View File
@@ -62,5 +62,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "快速工作流程選擇器",
"tooltip": "建立新的空白工作流程時顯示快速工作流程選擇器"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "隱藏「在 Comfy Cloud 上執行」按鈕"
}
}
}
+17 -1
View File
@@ -142,5 +142,21 @@
"Permanently deleted {count} TEMP item(s).": "已永久删除 {count} 个 TEMP 项目。",
"Could not delete {count} TEMP item(s).": "无法删除 {count} 个 TEMP 项目。",
"TEMP cleanup stopped because a workflow entered the queue.": "工作流进入队列,因此已停止 TEMP 清理。",
"Click again to clear all history": "再次点击以清除所有历史记录"
"Click again to clear all history": "再次点击以清除所有历史记录",
"Card size": "卡片大小",
"Click again to confirm deleting this image": "再次点击以确认删除此图像",
"Could not scan prompts": "无法扫描提示词",
"Delete current image": "删除当前图像",
"Delete file": "删除文件",
"Find Similar Prompts": "查找相似提示词",
"Group": "分组",
"Next image (→)": "下一张图片 (→)",
"No similar prompt groups found at this threshold.": "在此相似度阈值下未找到相似提示词组。",
"Previous image (←)": "上一张图片 (←)",
"Scanning prompts...": "正在扫描提示词...",
"Similar prompt groups": "相似提示词组",
"Similarity threshold": "相似度阈值",
"images": "张图片",
"similarity": "相似度",
"{count} groups · {scanned} PNGs scanned": "{count} 个分组 · 已扫描 {scanned} 张 PNG"
}
+4 -1
View File
@@ -62,5 +62,8 @@
"Comfy Sidebar_Quick Workflow Picker": {
"name": "快速工作流选择器",
"tooltip": "创建新的空白工作流时显示快速工作流选择器"
},
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
"name": "隐藏“在 Comfy Cloud 上运行”按钮"
}
}
}
+230 -9
View File
@@ -17,6 +17,9 @@ How it works
import json
import os
import re
import struct
import sys
import threading
import zlib
from collections import OrderedDict
@@ -34,7 +37,7 @@ _MAX_PROMPT_CHUNK_BYTES = 16 * 1024 * 1024
_MAX_TEXT_CHARS_PER_FILE = 50_000
_CACHE_MAX_ENTRIES = 20_000
_cache = OrderedDict() # path -> ((mtime_ns, size), lowercased prompt text)
_cache = OrderedDict() # path -> ((mtime_ns, size), lowercased prompt text, segments, (width, height))
_cache_lock = threading.Lock()
@@ -96,6 +99,25 @@ def extract_prompt_texts(prompt):
return texts
def get_prompt_segments_from_graph(prompt):
"""Return the individual lower-cased prompt strings (one per text input).
Kept separate (not joined) so callers can tell apart text that is shared
verbatim by many images, such as an LLM enhancer's meta-prompt, from the
text that is unique to one image. Strings are interned so identical
boilerplate is stored once across the whole cache.
"""
segments = []
budget = _MAX_TEXT_CHARS_PER_FILE
for text in extract_prompt_texts(prompt):
if budget <= 0:
break
text = text.lower()[:budget]
budget -= len(text)
segments.append(sys.intern(text))
return tuple(segments)
def get_prompt_search_text_from_graph(prompt):
"""Return lower-cased text-encoder prompt text from an API-format graph."""
return "\n".join(extract_prompt_texts(prompt)).lower()[:_MAX_TEXT_CHARS_PER_FILE]
@@ -131,6 +153,18 @@ def _decode_text_chunk(chunk_type, data, nul):
return body.decode("utf-8", errors="replace")
def read_png_size(fileobj):
"""Return (width, height) from the IHDR chunk of an open PNG, or (0, 0)."""
try:
fileobj.seek(0)
head = fileobj.read(24)
if len(head) == 24 and head[:8] == _PNG_SIGNATURE and head[12:16] == b"IHDR":
return struct.unpack(">II", head[16:24])
except Exception:
pass
return (0, 0)
def read_png_prompt(fileobj):
"""Return the parsed ``prompt`` JSON from an open PNG file, or None."""
if fileobj.read(8) != _PNG_SIGNATURE:
@@ -162,38 +196,225 @@ def read_png_prompt(fileobj):
# Cached per-file text
# --------------------------------------------------------------------------- #
def get_prompt_search_text(path):
"""Lower-cased prompt text of a PNG ('' if none). Cached by mtime + size."""
def _load_entry(path):
"""Return (text, segments, (width, height)) for a PNG, cached by mtime + size."""
try:
st = os.stat(path)
except OSError:
return ""
return "", (), (0, 0)
signature = (st.st_mtime_ns, st.st_size)
with _cache_lock:
hit = _cache.get(path)
if hit and hit[0] == signature:
_cache.move_to_end(path)
return hit[1]
return hit[1], hit[2], hit[3]
text = ""
text, segments, dims = "", (), (0, 0)
try:
with open(path, "rb") as f:
dims = read_png_size(f)
f.seek(0)
prompt = read_png_prompt(f)
if prompt is not None:
text = get_prompt_search_text_from_graph(prompt)
segments = get_prompt_segments_from_graph(prompt)
except Exception:
# Corrupt / truncated / non-ComfyUI PNG: treat as "no prompt".
text = ""
text, segments = "", ()
with _cache_lock:
_cache[path] = (signature, text)
_cache[path] = (signature, text, segments, dims)
_cache.move_to_end(path)
while len(_cache) > _CACHE_MAX_ENTRIES:
_cache.popitem(last=False)
return text
return text, segments, dims
def get_prompt_search_text(path):
"""Lower-cased prompt text of a PNG ('' if none). Cached by mtime + size."""
return _load_entry(path)[0]
def get_png_dimensions(path):
"""(width, height) of a PNG as read from its header, (0, 0) if unknown."""
return _load_entry(path)[2]
def get_prompt_segments(path):
"""Lower-cased prompt strings of a PNG, one per text input (() if none)."""
return _load_entry(path)[1]
def clear_cache():
with _cache_lock:
_cache.clear()
# --------------------------------------------------------------------------- #
# Similar-prompt grouping
# --------------------------------------------------------------------------- #
_BOILERPLATE_MIN_DOCS = 3
_BOILERPLATE_DISTINCT_RATIO = 0.5
def _strip_shared_boilerplate(documents):
"""Drop text that many *different* images share verbatim.
Typical case: an LLM prompt-enhancer node whose long meta-prompt is stored
in every image made with it. Counting such a string as evidence would put
all of those images in one 100% group.
A string is boilerplate when at least a few images contain it and those
images are otherwise different from each other. If they are also identical
in all their other text (a plain seed sweep of one prompt), the string is
real content and is kept, so true duplicates are still found.
Documents may carry a "segments" list (one entry per text input); documents
without it are left untouched. Returns new dicts with "prompt" rebuilt.
"""
seg_sets = []
holders = {}
for index, item in enumerate(documents):
segments = item.get("segments")
normalized = None
if segments:
normalized = frozenset(
" ".join(str(seg).split()) for seg in segments if str(seg).strip()
)
seg_sets.append(normalized)
for seg in normalized or ():
holders.setdefault(seg, []).append(index)
boilerplate = set()
for seg, indices in holders.items():
if len(indices) < _BOILERPLATE_MIN_DOCS:
continue
rests = {seg_sets[i] - {seg} for i in indices}
if len(rests) / len(indices) >= _BOILERPLATE_DISTINCT_RATIO:
boilerplate.add(seg)
if not boilerplate:
return documents
cleaned = []
for item, segs in zip(documents, seg_sets):
if segs is None:
cleaned.append(item)
continue
kept = sorted(seg for seg in segs if seg not in boilerplate)
cleaned.append({**item, "prompt": "\n".join(kept)})
return cleaned
def find_similar_prompt_groups(documents, threshold=0.55):
"""Group prompt documents by token-set Jaccard similarity.
Documents are dictionaries containing an id and prompt text. Candidate
pairs are generated through an inverted index, avoiding a full all-pairs
comparison for unrelated prompts.
"""
documents = _strip_shared_boilerplate(documents)
docs = []
for item in documents:
text = str(item.get("prompt") or "").lower()
tokens = {
token for token in re.findall(r"[a-z0-9_]+", text)
if len(token) > 2
}
if tokens:
docs.append({**item, "_tokens": tokens})
if len(docs) < 2:
return []
# Remove very common tokens: they add little evidence of a duplicate.
frequencies = {}
for doc in docs:
for token in doc["_tokens"]:
frequencies[token] = frequencies.get(token, 0) + 1
common_limit = max(3, int(len(docs) * 0.8))
for doc in docs:
doc["_tokens"] = {
token for token in doc["_tokens"]
if frequencies[token] <= common_limit
}
inverted = {}
for index, doc in enumerate(docs):
for token in doc["_tokens"]:
inverted.setdefault(token, []).append(index)
# Count shared tokens per candidate pair straight from the inverted index.
# Jaccard then needs no set intersection/union: |A∪B| = |A| + |B| - shared.
overlaps = {}
for indices in inverted.values():
if len(indices) > 500:
continue
for offset, left in enumerate(indices):
for right in indices[offset + 1:]:
key = (left, right)
overlaps[key] = overlaps.get(key, 0) + 1
parent = list(range(len(docs)))
rank = [0] * len(docs)
def find(index):
while parent[index] != index:
parent[index] = parent[parent[index]]
index = parent[index]
return index
def union(left, right):
left_root, right_root = find(left), find(right)
if left_root == right_root:
return
if rank[left_root] < rank[right_root]:
left_root, right_root = right_root, left_root
parent[right_root] = left_root
if rank[left_root] == rank[right_root]:
rank[left_root] += 1
scores = {}
sizes = [len(doc["_tokens"]) for doc in docs]
for (left, right), shared in overlaps.items():
size_a, size_b = sizes[left], sizes[right]
if not size_a or not size_b:
continue
# Jaccard can never exceed min/max of the set sizes: cheap early exit.
if min(size_a, size_b) / max(size_a, size_b) < threshold:
continue
score = shared / (size_a + size_b - shared)
if score >= threshold:
scores[(left, right)] = score
union(left, right)
groups = {}
for index in range(len(docs)):
root = find(index)
groups.setdefault(root, []).append(index)
group_scores = {}
for (left, _right), score in scores.items():
group_scores.setdefault(find(left), []).append(score)
result = []
for root, indices in groups.items():
if len(indices) < 2:
continue
items = []
for index in indices:
item = {key: value for key, value in docs[index].items() if key != "_tokens"}
items.append(item)
items.sort(key=lambda item: item.get("mtime", 0), reverse=True)
matched_scores = group_scores.get(root, [])
average_score = sum(matched_scores) / len(matched_scores) if matched_scores else 0
result.append({
"similarity": round(average_score * 100),
"items": items
})
result.sort(key=lambda group: (group["similarity"], len(group["items"])), reverse=True)
return result
+3 -2
View File
@@ -1,7 +1,7 @@
[project]
name = "comfy-sidebar"
description = "A compact and powerful layout overhaul for ComfyUI that makes generation results easier to browse, preview, compare, and manage."
version = "1.8.7"
version = "1.9.0"
license = { file = "LICENSE" }
dependencies = [
"send2trash>=1.8.0",
@@ -13,4 +13,5 @@ Repository = "https://github.com/m0rtus59/ComfyUI-ComfySidebar"
[tool.comfy]
PublisherId = "soundslikethunder"
DisplayName = "Comfy Sidebar"
Icon = "https://raw.githubusercontent.com/m0rtus59/ComfyUI-ComfySidebar/main/assets/icon.png"
Icon = "https://raw.githubusercontent.com/m0rtus59/ComfyUI-ComfySidebar/main/assets/icon.png"
Banner = "https://raw.githubusercontent.com/m0rtus59/ComfyUI-ComfySidebar/main/assets/banner.png"