Compare commits
98
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59e69ffebe | ||
|
|
f5aacadd34 | ||
|
|
b9a0271fca | ||
|
|
b2822c6af7 | ||
|
|
1c5f0e135e | ||
|
|
9685fa53b4 | ||
|
|
ddd15259e0 | ||
|
|
2cda35562a | ||
|
|
9e6672cddd | ||
|
|
2beae3a017 | ||
|
|
ee7768120a | ||
|
|
a270c268ba | ||
|
|
c8496a0d2c | ||
|
|
9df90421c3 | ||
|
|
5354fe7854 | ||
|
|
b4b4bb2ed9 | ||
|
|
ce414d710a | ||
|
|
37569315bd | ||
|
|
867adcfc8d | ||
|
|
7d684125a6 | ||
|
|
e8873eeb83 | ||
|
|
79bd741f77 | ||
|
|
33951dd82a | ||
|
|
4aeeccb11f | ||
|
|
190f1ff999 | ||
|
|
f134976f6b | ||
|
|
f6a97a8f4d | ||
|
|
bbbd27c2f7 | ||
|
|
3d391bfff3 | ||
|
|
5b1118c962 | ||
|
|
1df1d5f47e | ||
|
|
ce2c16a4a4 | ||
|
|
3d8af78a12 | ||
|
|
ca3cc677a6 | ||
|
|
023638664c | ||
|
|
539518498e | ||
|
|
25169294ab | ||
|
|
50b804f4c6 | ||
|
|
deb7ec052b | ||
|
|
f574fe75b0 | ||
|
|
8b46e8c0eb | ||
|
|
0817beff1b | ||
|
|
f0a0e9cc4e | ||
|
|
cb65684554 | ||
|
|
6f97a9c8a5 | ||
|
|
bfa59866af | ||
|
|
b3d3750f1e | ||
|
|
2d9449a0ff | ||
|
|
fa8152c030 | ||
|
|
ebf0c0ea28 | ||
|
|
fb8f8dcf81 | ||
|
|
042b8fb35d | ||
|
|
5550aae5d7 | ||
|
|
cfac1f8d03 | ||
|
|
2a586cfa39 | ||
|
|
4a1f69f1ca | ||
|
|
fc03bf2262 | ||
|
|
6f24fdbf1a | ||
|
|
62e212ca02 | ||
|
|
0dd346bd83 | ||
|
|
a9f1fcb3f6 | ||
|
|
064b917074 | ||
|
|
a3c0621fbf | ||
|
|
438fc2820e | ||
|
|
08f7ebec51 | ||
|
|
ee1c613dab | ||
|
|
8ddc22ae7d | ||
|
|
3ae1109ca2 | ||
|
|
6d92775d6a | ||
|
|
0e3fd15987 | ||
|
|
69869fd778 | ||
|
|
d184bdb861 | ||
|
|
0adc42371f | ||
|
|
1106e366ff | ||
|
|
90aa5e3759 | ||
|
|
ac7a83ce46 | ||
|
|
425c5a1d39 | ||
|
|
3800c54a44 | ||
|
|
6e0102d59e | ||
|
|
a15c417701 | ||
|
|
326d18cadf | ||
|
|
22fd5d819d | ||
|
|
23536657e7 | ||
|
|
187d44cf36 | ||
|
|
ca7742858c | ||
|
|
384ad09107 | ||
|
|
a28b51249f | ||
|
|
fdefa9aae9 | ||
|
|
dc513a0199 | ||
|
|
4c44af1486 | ||
|
|
90ad6aac23 | ||
|
|
f681a80148 | ||
|
|
869dfcf78a | ||
|
|
9b56ff7dd0 | ||
|
|
aed377f327 | ||
|
|
92716efb26 | ||
|
|
08b911377a | ||
|
|
ef45f9266c |
@@ -1,3 +1,7 @@
|
|||||||
|
<p align="center">
|
||||||
|
<img src="assets/banner.png" alt="Comfy Sidebar" width="100%">
|
||||||
|
</p>
|
||||||
|
|
||||||
# ComfyUI-ComfySidebar
|
# ComfyUI-ComfySidebar
|
||||||
|
|
||||||
A compact and powerful layout overhaul for ComfyUI that makes generation results easier to browse, preview, compare, and manage.
|
A compact and powerful layout overhaul for ComfyUI that makes generation results easier to browse, preview, compare, and manage.
|
||||||
|
|||||||
+74
@@ -345,6 +345,73 @@ async def locale_file_handler(request):
|
|||||||
return web.FileResponse(target_file)
|
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")
|
@PromptServer.instance.routes.get("/comfy-sidebar/gallery/list")
|
||||||
async def gallery_list_handler(request):
|
async def gallery_list_handler(request):
|
||||||
try:
|
try:
|
||||||
@@ -433,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)
|
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):
|
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)
|
return web.json_response({"error": "File not found or outside output directory"}, status=404)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 181 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 51 KiB |
+7
-9
@@ -146,15 +146,13 @@ export function findActiveQueueIndicator() {
|
|||||||
const container = findTopbarContainer();
|
const container = findTopbarContainer();
|
||||||
if (!container) return null;
|
if (!container) return null;
|
||||||
|
|
||||||
const buttons = container.querySelectorAll("button, .p-button, .comfyui-menu-item");
|
// ComfyUI's Active queue control has a distinctive button layout. Match its
|
||||||
for (const btn of buttons) {
|
// structural classes rather than its translated label ("Active", etc.).
|
||||||
if (btn.classList.contains("comfy-sidebar-custom-properties-toggle")) continue;
|
return container.querySelector(
|
||||||
const text = (btn.textContent || "").toLowerCase();
|
"button.px-3.text-xs.p-2.rounded-lg.h-8, " +
|
||||||
if (text.includes("active") || text.includes("queued") || text.includes("running") || text.includes("pending")) {
|
".p-button.px-3.text-xs.p-2.rounded-lg.h-8, " +
|
||||||
return btn;
|
".comfyui-menu-item.px-3.text-xs.p-2.rounded-lg.h-8"
|
||||||
}
|
);
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function findNativeExtensionsPanel() {
|
export function findNativeExtensionsPanel() {
|
||||||
|
|||||||
@@ -454,6 +454,10 @@ function syncAvatarVisibility() {
|
|||||||
styleEl = document.createElement("style");
|
styleEl = document.createElement("style");
|
||||||
styleEl.id = STYLE_AVATAR_ID;
|
styleEl.id = STYLE_AVATAR_ID;
|
||||||
styleEl.textContent = `
|
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"],
|
||||||
img[alt*="user avatar"],
|
img[alt*="user avatar"],
|
||||||
button:has(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() {
|
export function syncRuntimePreviewButton() {
|
||||||
const panel = findPropertiesPanel();
|
const panel = findPropertiesPanel();
|
||||||
if (!panel) return;
|
if (!panel) return;
|
||||||
@@ -756,6 +779,7 @@ export function syncClassicLayout() {
|
|||||||
syncExtensionsPanel(isClassicLayoutEnabled);
|
syncExtensionsPanel(isClassicLayoutEnabled);
|
||||||
syncPropertiesButton(isClassicLayoutEnabled);
|
syncPropertiesButton(isClassicLayoutEnabled);
|
||||||
syncActiveQueueIndicator(isClassicLayoutEnabled);
|
syncActiveQueueIndicator(isClassicLayoutEnabled);
|
||||||
|
syncRunOnComfyCloudButton();
|
||||||
updateSidebarTabsVisibility();
|
updateSidebarTabsVisibility();
|
||||||
applySidebarOverride();
|
applySidebarOverride();
|
||||||
if (!sidebarTopObserver) {
|
if (!sidebarTopObserver) {
|
||||||
|
|||||||
@@ -181,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({
|
app.ui.settings.addSetting({
|
||||||
id: "Comfy Sidebar.Hide Junk.Floating Canvas Controls",
|
id: "Comfy Sidebar.Hide Junk.Floating Canvas Controls",
|
||||||
name: t("Floating Canvas Controls"),
|
name: t("Floating Canvas Controls"),
|
||||||
|
|||||||
+12
-1
@@ -5,9 +5,11 @@ import { extractWorkflowFromPng, isImageFormat, animateCardRemoval, getScrollCon
|
|||||||
import { getSetting } from "../core/settings.js";
|
import { getSetting } from "../core/settings.js";
|
||||||
import { renderCardImages } from "./mediaPreview.js";
|
import { renderCardImages } from "./mediaPreview.js";
|
||||||
import { showNotification } from "../utils/nodeRenumber.js";
|
import { showNotification } from "../utils/nodeRenumber.js";
|
||||||
|
import { openSimilarPromptsDialog } from "./similarPrompts.js";
|
||||||
|
|
||||||
let galleryContainerEl = null;
|
let galleryContainerEl = null;
|
||||||
let cardStackEl = null;
|
let cardStackEl = null;
|
||||||
|
let similarPromptsDialog = null;
|
||||||
let scrollToTopBtnEl = null;
|
let scrollToTopBtnEl = null;
|
||||||
let currentColumnCount = 1;
|
let currentColumnCount = 1;
|
||||||
let currentSubfolder = "";
|
let currentSubfolder = "";
|
||||||
@@ -274,6 +276,7 @@ function createFileCard(file) {
|
|||||||
pid: `gallery-${file.filename}`,
|
pid: `gallery-${file.filename}`,
|
||||||
status: PromptStatus.COMPLETED,
|
status: PromptStatus.COMPLETED,
|
||||||
images: [fileAsset],
|
images: [fileAsset],
|
||||||
|
_previewImages: cachedFiles,
|
||||||
workflow: null
|
workflow: null
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -582,7 +585,11 @@ export function setupGalleryView() {
|
|||||||
renderGallery();
|
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);
|
standardHeader.appendChild(actionsGroup);
|
||||||
|
|
||||||
const searchContainer = document.createElement("div");
|
const searchContainer = document.createElement("div");
|
||||||
@@ -727,6 +734,10 @@ export function teardownGalleryView() {
|
|||||||
galleryResizeObserver.disconnect();
|
galleryResizeObserver.disconnect();
|
||||||
galleryResizeObserver = null;
|
galleryResizeObserver = null;
|
||||||
}
|
}
|
||||||
|
if (similarPromptsDialog) {
|
||||||
|
similarPromptsDialog.destroy();
|
||||||
|
similarPromptsDialog = null;
|
||||||
|
}
|
||||||
// Reset header-reveal state so a re-opened gallery starts with a visible header
|
// Reset header-reveal state so a re-opened gallery starts with a visible header
|
||||||
lastScrollTop = 0;
|
lastScrollTop = 0;
|
||||||
scrollDeltaAccumulator = 0;
|
scrollDeltaAccumulator = 0;
|
||||||
|
|||||||
+95
-2
@@ -1,10 +1,11 @@
|
|||||||
import { isImageFormat, isVideoFormat, is3DFormat, isAudioFormat, getFilenameFromUrl, findImagesInOutputs } from "../utils/utils.js";
|
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 { stopAllAudioPlayback, isAudioViewerOpen, setCurrentlyPlayingAudio, getCurrentlyPlayingAudio } from "./audioController.js";
|
||||||
import { showFullscreenPreview } from "../utils/comparison.js";
|
import { showFullscreenPreview } from "../utils/comparison.js";
|
||||||
import { store } from "../core/store.js";
|
import { store } from "../core/store.js";
|
||||||
import { handleMissingMedia } from "../queue/missingFiles.js";
|
import { handleMissingMedia } from "../queue/missingFiles.js";
|
||||||
import { t } from "../core/i18n.js";
|
import { t } from "../core/i18n.js";
|
||||||
|
import { showNotification } from "../utils/nodeRenumber.js";
|
||||||
|
|
||||||
export function findWorkflowBackgroundThumbnail(state, randParam = "") {
|
export function findWorkflowBackgroundThumbnail(state, randParam = "") {
|
||||||
if (!state) return null;
|
if (!state) return null;
|
||||||
@@ -433,6 +434,11 @@ export function renderCardImages(cardObj, state, onNavigateBatch) {
|
|||||||
|
|
||||||
const idx = cardObj.currentImageIndex;
|
const idx = cardObj.currentImageIndex;
|
||||||
const img = state.images[idx];
|
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.
|
// The Queue's advanced action follows the currently selected batch image.
|
||||||
if (cardObj.btnMove) {
|
if (cardObj.btnMove) {
|
||||||
@@ -564,7 +570,94 @@ export function renderCardImages(cardObj, state, onNavigateBatch) {
|
|||||||
activeSrc = canvas.toDataURL("image/png");
|
activeSrc = canvas.toDataURL("image/png");
|
||||||
} catch (_) {}
|
} 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 = () => {
|
mediaEl.onerror = () => {
|
||||||
|
|||||||
+54
-1
@@ -568,6 +568,15 @@ export function renderSidebar() {
|
|||||||
btnDelLabel.textContent = t("Delete File");
|
btnDelLabel.textContent = t("Delete File");
|
||||||
btnDel.appendChild(btnDelLabel);
|
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, {
|
attachDeleteConfirmation(btnDel, {
|
||||||
idleTitle: t("Remove from batch (Hold Ctrl to delete file from disk)"),
|
idleTitle: t("Remove from batch (Hold Ctrl to delete file from disk)"),
|
||||||
confirmTitle: t("Click again to confirm removing from batch"),
|
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");
|
const leftHoverPanel = document.createElement("div");
|
||||||
leftHoverPanel.className = "comfy-sidebar-left-hover-panel";
|
leftHoverPanel.className = "comfy-sidebar-left-hover-panel";
|
||||||
@@ -675,12 +684,56 @@ export function renderSidebar() {
|
|||||||
btnCopy,
|
btnCopy,
|
||||||
btnFocus,
|
btnFocus,
|
||||||
btnDel,
|
btnDel,
|
||||||
|
btnMove,
|
||||||
firstImgElement: null
|
firstImgElement: null
|
||||||
};
|
};
|
||||||
|
|
||||||
cardPool.set(cardId, cardObj);
|
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";
|
cardObj.placeholder.style.display = "none";
|
||||||
renderCardImages(cardObj, {
|
renderCardImages(cardObj, {
|
||||||
pid: batchInfo.pid,
|
pid: batchInfo.pid,
|
||||||
|
|||||||
@@ -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
@@ -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 { create3DViewer } from "./viewer3d.js";
|
||||||
import { createTextReader } from "./text_reader.js";
|
import { createTextReader } from "./text_reader.js";
|
||||||
import { stopAllAudioPlayback } from "../ui/audioController.js";
|
import { stopAllAudioPlayback } from "../ui/audioController.js";
|
||||||
@@ -6,11 +6,32 @@ import { SidebarOverlay } from "./overlay.js";
|
|||||||
import { store } from "../core/store.js";
|
import { store } from "../core/store.js";
|
||||||
import { PromptStatus } from "../core/constants.js";
|
import { PromptStatus } from "../core/constants.js";
|
||||||
import { t } from "../core/i18n.js";
|
import { t } from "../core/i18n.js";
|
||||||
|
import { deleteFileOnServer, removeImageFromNodeOutputs } from "../ui/mediaActions.js";
|
||||||
|
import { showNotification } from "./nodeRenumber.js";
|
||||||
|
|
||||||
let activeComparisonViewer = null;
|
let activeComparisonViewer = null;
|
||||||
let isRuntimePreviewActive = false;
|
let isRuntimePreviewActive = false;
|
||||||
let onRuntimePreviewStateChange = null;
|
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() {
|
export function isRuntimePreviewEnabled() {
|
||||||
return isRuntimePreviewActive;
|
return isRuntimePreviewActive;
|
||||||
}
|
}
|
||||||
@@ -64,7 +85,20 @@ export function focusRuntimePreviewTarget() {
|
|||||||
if (activePrompt && activePrompt.status === PromptStatus.ACTIVE) {
|
if (activePrompt && activePrompt.status === PromptStatus.ACTIVE) {
|
||||||
const previewSrc = activePrompt._previewBlobUrl ||
|
const previewSrc = activePrompt._previewBlobUrl ||
|
||||||
(activePrompt.images && activePrompt.images.length > 0 ? (activePrompt.images[0].url || activePrompt.images[0].filename) : null);
|
(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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +111,19 @@ export function focusRuntimePreviewTarget() {
|
|||||||
const randParam = latest.pid ? `&rand=${encodeURIComponent(latest.pid)}` : "";
|
const randParam = latest.pid ? `&rand=${encodeURIComponent(latest.pid)}` : "";
|
||||||
const src = latest._previewBlobUrl ||
|
const src = latest._previewBlobUrl ||
|
||||||
(firstImg ? (firstImg.url || `/view?filename=${encodeURIComponent(firstImg.filename)}&type=${firstImg.type || 'output'}&subfolder=${encodeURIComponent(firstImg.subfolder || '')}${randParam}`) : "");
|
(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 {
|
} else {
|
||||||
// Queue is totally empty
|
// Queue is totally empty
|
||||||
showFullscreenPreview([""], false, null);
|
showFullscreenPreview([""], false, null);
|
||||||
@@ -124,6 +170,7 @@ function createAudioViewer(baseSrc, onSwitchMedia = () => {}, onDestroy = () =>
|
|||||||
let togglePlayFn = () => {};
|
let togglePlayFn = () => {};
|
||||||
|
|
||||||
const overlay = new SidebarOverlay({
|
const overlay = new SidebarOverlay({
|
||||||
|
zIndex: 1100,
|
||||||
onDestroy,
|
onDestroy,
|
||||||
onUserClose: () => {
|
onUserClose: () => {
|
||||||
if (isRuntimePreviewActive) setRuntimePreviewEnabled(false, false);
|
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);
|
const isBaseVideo = isVideoFormat(baseSrc);
|
||||||
let splitRatio = 50;
|
let splitRatio = 50;
|
||||||
let mediaB = null;
|
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({
|
const overlay = new SidebarOverlay({
|
||||||
|
zIndex: 1100,
|
||||||
onDestroy,
|
onDestroy,
|
||||||
onUserClose: () => {
|
onUserClose: () => {
|
||||||
if (isRuntimePreviewActive) setRuntimePreviewEnabled(false, false);
|
if (isRuntimePreviewActive) setRuntimePreviewEnabled(false, false);
|
||||||
},
|
},
|
||||||
onKeyDown: (e) => {
|
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();
|
e.preventDefault();
|
||||||
updateSliderPosition(splitRatio > 50 ? 0 : 100);
|
updateSliderPosition(splitRatio > 50 ? 0 : 100);
|
||||||
}
|
}
|
||||||
@@ -630,6 +691,13 @@ function createComparisonViewer(baseSrc, onDestroy = () => {}) {
|
|||||||
const hA = mediaA.naturalHeight || mediaA.videoHeight || 0;
|
const hA = mediaA.naturalHeight || mediaA.videoHeight || 0;
|
||||||
if (!wA || !hA) return;
|
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
|
// Calculate available space inside the preview area
|
||||||
const availW = Math.max(100, (scrollContainer.clientWidth || window.innerWidth) - 48);
|
const availW = Math.max(100, (scrollContainer.clientWidth || window.innerWidth) - 48);
|
||||||
const availH = Math.max(100, (scrollContainer.clientHeight || window.innerHeight) - 96);
|
const availH = Math.max(100, (scrollContainer.clientHeight || window.innerHeight) - 96);
|
||||||
@@ -647,9 +715,9 @@ function createComparisonViewer(baseSrc, onDestroy = () => {}) {
|
|||||||
|
|
||||||
if (!mediaB) {
|
if (!mediaB) {
|
||||||
slider.style.display = "none";
|
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 (mediaA) mediaA.style.pointerEvents = isBaseVideo ? "none" : "auto";
|
||||||
if (isZoomed) {
|
if (isZoomed && !isRuntimePreviewActive) {
|
||||||
wrapper.style.maxWidth = "none";
|
wrapper.style.maxWidth = "none";
|
||||||
wrapper.style.maxHeight = "none";
|
wrapper.style.maxHeight = "none";
|
||||||
wrapper.style.width = `${wA}px`;
|
wrapper.style.width = `${wA}px`;
|
||||||
@@ -776,7 +844,7 @@ function createComparisonViewer(baseSrc, onDestroy = () => {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const toggleZoom = () => {
|
const toggleZoom = () => {
|
||||||
if (isBaseVideo) return;
|
if (isBaseVideo || isRuntimePreviewActive) return;
|
||||||
isZoomed = !isZoomed;
|
isZoomed = !isZoomed;
|
||||||
syncImageScales();
|
syncImageScales();
|
||||||
if (!isZoomed) {
|
if (!isZoomed) {
|
||||||
@@ -861,8 +929,142 @@ function createComparisonViewer(baseSrc, onDestroy = () => {}) {
|
|||||||
cleanupMedia(mediaB);
|
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 {
|
return {
|
||||||
is3D: false,
|
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,
|
isAudio: false,
|
||||||
isText: false,
|
isText: false,
|
||||||
loadTarget(targetSrc, isShiftClick) {
|
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;
|
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 targetPid = pid || (typeof item === "object" && item ? item.pid : null);
|
||||||
const pidStr = targetPid ? String(targetPid) : null;
|
const pidStr = targetPid ? String(targetPid) : null;
|
||||||
|
|
||||||
@@ -1006,14 +1212,18 @@ export function showFullscreenPreview(imgSrcs, isShiftClick = false, pid = null)
|
|||||||
activeComparisonViewer = null;
|
activeComparisonViewer = null;
|
||||||
} else {
|
} else {
|
||||||
activeComparisonViewer.targetPid = pidStr;
|
activeComparisonViewer.targetPid = pidStr;
|
||||||
|
activeComparisonViewer.setNavigationItems?.(navigationItems, selectedIndex, previewOptions.assets, previewOptions);
|
||||||
activeComparisonViewer.loadTarget(src, isShiftClick);
|
activeComparisonViewer.loadTarget(src, isShiftClick);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
activeComparisonViewer = createComparisonViewer(
|
activeComparisonViewer = createComparisonViewer(
|
||||||
src,
|
src,
|
||||||
() => { activeComparisonViewer = null; }
|
() => { activeComparisonViewer = null; },
|
||||||
|
navigationItems,
|
||||||
|
selectedIndex,
|
||||||
|
previewOptions
|
||||||
);
|
);
|
||||||
if (activeComparisonViewer) {
|
if (activeComparisonViewer) {
|
||||||
activeComparisonViewer.targetPid = pidStr;
|
activeComparisonViewer.targetPid = pidStr;
|
||||||
|
|||||||
+22
-4
@@ -1,13 +1,16 @@
|
|||||||
import { findActiveSidebars } from "../comfy/adapter.js";
|
import { findActiveSidebars } from "../comfy/adapter.js";
|
||||||
|
|
||||||
|
const activeOverlays = [];
|
||||||
|
|
||||||
export class SidebarOverlay {
|
export class SidebarOverlay {
|
||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
this.onDestroy = options.onDestroy || (() => {});
|
this.onDestroy = options.onDestroy || (() => {});
|
||||||
this.onUserClose = options.onUserClose || (() => {});
|
this.onUserClose = options.onUserClose || (() => {});
|
||||||
this.cleanupFns = [];
|
this.cleanupFns = [];
|
||||||
this.observedElements = new Set();
|
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");
|
document.body.classList.add("comfy-sidebar-overlay-active");
|
||||||
|
|
||||||
// Root container: visual backdrop (covers 100% flush from sidebar to sidebar, zero gap)
|
// Root container: visual backdrop (covers 100% flush from sidebar to sidebar, zero gap)
|
||||||
@@ -19,7 +22,7 @@ export class SidebarOverlay {
|
|||||||
backdropFilter: "blur(8px)",
|
backdropFilter: "blur(8px)",
|
||||||
color: "var(--fg-color, #eee)",
|
color: "var(--fg-color, #eee)",
|
||||||
display: "flex", flexDirection: "column", alignItems: "center",
|
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"
|
overflow: "hidden", pointerEvents: "none", userSelect: "none"
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -37,7 +40,7 @@ export class SidebarOverlay {
|
|||||||
});
|
});
|
||||||
this.container.appendChild(this.backdrop);
|
this.container.appendChild(this.backdrop);
|
||||||
|
|
||||||
// Close button
|
// Optional built-in close button
|
||||||
this.closeBtn = document.createElement("span");
|
this.closeBtn = document.createElement("span");
|
||||||
this.closeBtn.className = "pi pi-times";
|
this.closeBtn.className = "pi pi-times";
|
||||||
this.closeBtn.title = "Close (Esc)";
|
this.closeBtn.title = "Close (Esc)";
|
||||||
@@ -63,6 +66,7 @@ export class SidebarOverlay {
|
|||||||
this.onUserClose();
|
this.onUserClose();
|
||||||
this.destroy();
|
this.destroy();
|
||||||
};
|
};
|
||||||
|
if (options.closeButton === false) this.closeBtn.style.display = "none";
|
||||||
this.container.appendChild(this.closeBtn);
|
this.container.appendChild(this.closeBtn);
|
||||||
|
|
||||||
// ResizeObserver to track live drag-resizing on all active sidebars
|
// ResizeObserver to track live drag-resizing on all active sidebars
|
||||||
@@ -103,10 +107,22 @@ export class SidebarOverlay {
|
|||||||
|
|
||||||
// Global Key Handler (Esc to close)
|
// Global Key Handler (Esc to close)
|
||||||
const onKeyDown = (e) => {
|
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") {
|
if (e.key === "Escape") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
e.stopImmediatePropagation();
|
||||||
this.onUserClose();
|
this.onUserClose();
|
||||||
this.destroy();
|
this.destroy();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (options.onKeyDown) options.onKeyDown(e);
|
if (options.onKeyDown) options.onKeyDown(e);
|
||||||
};
|
};
|
||||||
@@ -189,7 +205,9 @@ export class SidebarOverlay {
|
|||||||
destroy() {
|
destroy() {
|
||||||
if (this.destroyed) return;
|
if (this.destroyed) return;
|
||||||
this.destroyed = true;
|
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)) {
|
for (const fn of this.cleanupFns.splice(0)) {
|
||||||
try { fn(); } catch (e) {}
|
try { fn(); } catch (e) {}
|
||||||
|
|||||||
+48
-8
@@ -16,7 +16,7 @@ export function injectStyles() {
|
|||||||
.comfy-sidebar-card:hover {
|
.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;
|
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;
|
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) */
|
/* Border & Frame Spotlight (Uses the theme's main hue) */
|
||||||
@@ -32,7 +32,8 @@ export function injectStyles() {
|
|||||||
transparent 70%
|
transparent 70%
|
||||||
);
|
);
|
||||||
opacity: 0;
|
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;
|
pointer-events: none;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
@@ -40,6 +41,8 @@ export function injectStyles() {
|
|||||||
.comfy-sidebar-card:hover::before,
|
.comfy-sidebar-card:hover::before,
|
||||||
.comfy-sidebar-folder-card:hover::before {
|
.comfy-sidebar-folder-card:hover::before {
|
||||||
opacity: 0.65;
|
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 */
|
/* 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)); }
|
.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;
|
font-size: 13px !important;
|
||||||
border-radius: 6px !important;
|
border-radius: 6px !important;
|
||||||
cursor: pointer !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;
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
|
||||||
z-index: 20 !important;
|
z-index: 20 !important;
|
||||||
transform: translateZ(0);
|
transform: translateZ(0);
|
||||||
@@ -170,6 +178,22 @@ export function injectStyles() {
|
|||||||
letter-spacing: 0.3px;
|
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 */
|
/* Delete Confirmation Active State */
|
||||||
.comfy-sidebar-card-action-btn.confirm-delete,
|
.comfy-sidebar-card-action-btn.confirm-delete,
|
||||||
.comfy-sidebar-card-action-btn.confirm-delete:hover {
|
.comfy-sidebar-card-action-btn.confirm-delete:hover {
|
||||||
@@ -215,7 +239,7 @@ export function injectStyles() {
|
|||||||
display: inline-flex !important;
|
display: inline-flex !important;
|
||||||
background-color: #166534 !important;
|
background-color: #166534 !important;
|
||||||
color: #ffffff !important;
|
color: #ffffff !important;
|
||||||
border: 1px solid #22c55e !important;
|
border-color: #22c55e !important;
|
||||||
width: auto !important;
|
width: auto !important;
|
||||||
padding: 0 8px !important;
|
padding: 0 8px !important;
|
||||||
}
|
}
|
||||||
@@ -223,17 +247,33 @@ export function injectStyles() {
|
|||||||
body.comfy-sidebar-ctrl-active .comfy-sidebar-btn-del {
|
body.comfy-sidebar-ctrl-active .comfy-sidebar-btn-del {
|
||||||
background-color: #991b1b !important;
|
background-color: #991b1b !important;
|
||||||
color: #ffffff !important;
|
color: #ffffff !important;
|
||||||
border: 1px solid #ef4444 !important;
|
border-color: #ef4444 !important;
|
||||||
width: auto !important;
|
|
||||||
padding: 0 8px !important;
|
|
||||||
border-radius: 6px !important;
|
border-radius: 6px !important;
|
||||||
box-shadow: 0 0 10px rgba(239, 68, 68, 0.6) !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 {
|
body.comfy-sidebar-ctrl-active .comfy-sidebar-btn-del .comfy-sidebar-del-label {
|
||||||
display: inline;
|
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 */
|
/* Translucent Folder Indicator on Ctrl Press */
|
||||||
.comfy-sidebar-ctrl-overlay {
|
.comfy-sidebar-ctrl-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -846,7 +886,7 @@ export function injectStyles() {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
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;
|
user-select: none;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -574,6 +574,7 @@ export function attachDeleteConfirmation(btn, options = {}) {
|
|||||||
isDisk = false;
|
isDisk = false;
|
||||||
btn.classList.remove("confirm-delete", "confirm-delete-disk");
|
btn.classList.remove("confirm-delete", "confirm-delete-disk");
|
||||||
btn.title = typeof idleTitle === "function" ? idleTitle() : idleTitle;
|
btn.title = typeof idleTitle === "function" ? idleTitle() : idleTitle;
|
||||||
|
if (typeof options.onStateChange === "function") options.onStateChange(false, false);
|
||||||
if (timer) {
|
if (timer) {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
timer = null;
|
timer = null;
|
||||||
@@ -590,6 +591,7 @@ export function attachDeleteConfirmation(btn, options = {}) {
|
|||||||
isPending = true;
|
isPending = true;
|
||||||
isDisk = wantsDisk;
|
isDisk = wantsDisk;
|
||||||
btn.classList.add(wantsDisk ? "confirm-delete-disk" : "confirm-delete");
|
btn.classList.add(wantsDisk ? "confirm-delete-disk" : "confirm-delete");
|
||||||
|
if (typeof options.onStateChange === "function") options.onStateChange(true, wantsDisk);
|
||||||
btn.title = wantsDisk
|
btn.title = wantsDisk
|
||||||
? (typeof confirmDiskTitle === "function" ? confirmDiskTitle() : confirmDiskTitle)
|
? (typeof confirmDiskTitle === "function" ? confirmDiskTitle() : confirmDiskTitle)
|
||||||
: (typeof confirmTitle === "function" ? confirmTitle() : confirmTitle);
|
: (typeof confirmTitle === "function" ? confirmTitle() : confirmTitle);
|
||||||
|
|||||||
+17
-1
@@ -142,5 +142,21 @@
|
|||||||
"Permanently deleted {count} TEMP item(s).": "تم حذف {count} من عناصر TEMP نهائيًا.",
|
"Permanently deleted {count} TEMP item(s).": "تم حذف {count} من عناصر TEMP نهائيًا.",
|
||||||
"Could not delete {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 بسبب دخول مهمة سير عمل إلى قائمة الانتظار.",
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "منتقي سير العمل السريع",
|
"name": "منتقي سير العمل السريع",
|
||||||
"tooltip": "إظهار منتقي سير العمل السريع عند إنشاء سير عمل فارغ جديد"
|
"tooltip": "إظهار منتقي سير العمل السريع عند إنشاء سير عمل فارغ جديد"
|
||||||
|
},
|
||||||
|
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
|
||||||
|
"name": "إخفاء زر التشغيل على Comfy Cloud"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-1
@@ -159,5 +159,21 @@
|
|||||||
"Moved selected image to Outputs.": "Moved selected image to Outputs.",
|
"Moved selected image to Outputs.": "Moved selected image to Outputs.",
|
||||||
"Failed to move image to Outputs.": "Failed to move image to Outputs.",
|
"Failed to move image to Outputs.": "Failed to move image to Outputs.",
|
||||||
"Move to Outputs": "Move 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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,5 +65,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "Quick Workflow Picker",
|
"name": "Quick Workflow Picker",
|
||||||
"tooltip": "Show quick workflow picker when creating a new blank workflow"
|
"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
@@ -142,5 +142,21 @@
|
|||||||
"Permanently deleted {count} TEMP item(s).": "Se eliminaron permanentemente {count} elementos TEMP.",
|
"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.",
|
"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.",
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "Selector rápido de flujos de trabajo",
|
"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"
|
"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
@@ -142,5 +142,21 @@
|
|||||||
"Permanently deleted {count} TEMP item(s).": "{count} مورد TEMP برای همیشه حذف شد.",
|
"Permanently deleted {count} TEMP item(s).": "{count} مورد TEMP برای همیشه حذف شد.",
|
||||||
"Could not delete {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 متوقف شد، چون یک گردشکار وارد صف شد.",
|
"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 اسکن شد"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "انتخابگر سریع گردش کار",
|
"name": "انتخابگر سریع گردش کار",
|
||||||
"tooltip": "نمایش انتخابگر سریع گردش کار هنگام ایجاد یک گردش کار خالی جدید"
|
"tooltip": "نمایش انتخابگر سریع گردش کار هنگام ایجاد یک گردش کار خالی جدید"
|
||||||
|
},
|
||||||
|
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
|
||||||
|
"name": "پنهان کردن دکمه اجرا در Comfy Cloud"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-1
@@ -142,5 +142,21 @@
|
|||||||
"Permanently deleted {count} TEMP item(s).": "{count} élément(s) TEMP supprimé(s) définitivement.",
|
"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.",
|
"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.",
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "Sélecteur rapide de workflow",
|
"name": "Sélecteur rapide de workflow",
|
||||||
"tooltip": "Afficher le sélecteur rapide de workflow lors de la création d'un nouveau workflow vide"
|
"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
@@ -142,5 +142,21 @@
|
|||||||
"Permanently deleted {count} TEMP item(s).": "{count} פריטי TEMP נמחקו לצמיתות.",
|
"Permanently deleted {count} TEMP item(s).": "{count} פריטי TEMP נמחקו לצמיתות.",
|
||||||
"Could not delete {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 נעצר כי תהליך עבודה נוסף לתור.",
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "בוחר תהליכי עבודה מהיר",
|
"name": "בוחר תהליכי עבודה מהיר",
|
||||||
"tooltip": "הצג בוחר תהליכי עבודה מהיר בעת יצירת תהליך עבודה ריק חדש"
|
"tooltip": "הצג בוחר תהליכי עבודה מהיר בעת יצירת תהליך עבודה ריק חדש"
|
||||||
|
},
|
||||||
|
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
|
||||||
|
"name": "הסתרת כפתור ההפעלה ב-Comfy Cloud"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-1
@@ -142,5 +142,21 @@
|
|||||||
"Permanently deleted {count} TEMP item(s).": "{count} elementi TEMP eliminati definitivamente.",
|
"Permanently deleted {count} TEMP item(s).": "{count} elementi TEMP eliminati definitivamente.",
|
||||||
"Could not delete {count} TEMP item(s).": "Impossibile eliminare {count} elementi TEMP.",
|
"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.",
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "Selettore rapido dei workflow",
|
"name": "Selettore rapido dei workflow",
|
||||||
"tooltip": "Mostra il selettore rapido dei workflow quando crei un nuovo workflow vuoto"
|
"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
@@ -142,5 +142,21 @@
|
|||||||
"Permanently deleted {count} TEMP item(s).": "TEMP項目を{count}件完全に削除しました。",
|
"Permanently deleted {count} TEMP item(s).": "TEMP項目を{count}件完全に削除しました。",
|
||||||
"Could not delete {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のクリーンアップを中止しました。",
|
"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 をスキャン"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "クイックワークフローピッカー",
|
"name": "クイックワークフローピッカー",
|
||||||
"tooltip": "新しい空のワークフローを作成するときにクイックワークフローピッカーを表示する"
|
"tooltip": "新しい空のワークフローを作成するときにクイックワークフローピッカーを表示する"
|
||||||
|
},
|
||||||
|
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
|
||||||
|
"name": "Comfy Cloudで実行ボタンを非表示"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-1
@@ -142,5 +142,21 @@
|
|||||||
"Permanently deleted {count} TEMP item(s).": "TEMP 항목 {count}개를 영구 삭제했습니다.",
|
"Permanently deleted {count} TEMP item(s).": "TEMP 항목 {count}개를 영구 삭제했습니다.",
|
||||||
"Could not delete {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 정리를 중단했습니다.",
|
"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}개 스캔 완료"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "빠른 워크플로우 선택기",
|
"name": "빠른 워크플로우 선택기",
|
||||||
"tooltip": "새 빈 워크플로우를 만들 때 빠른 워크플로우 선택기 표시"
|
"tooltip": "새 빈 워크플로우를 만들 때 빠른 워크플로우 선택기 표시"
|
||||||
|
},
|
||||||
|
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
|
||||||
|
"name": "Comfy Cloud에서 실행 버튼 숨기기"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-1
@@ -142,5 +142,21 @@
|
|||||||
"Permanently deleted {count} TEMP item(s).": "{count} item(ns) TEMP excluído(s) permanentemente.",
|
"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.",
|
"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.",
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "Seletor Rápido de Fluxos",
|
"name": "Seletor Rápido de Fluxos",
|
||||||
"tooltip": "Mostrar seletor rápido de fluxos ao criar um novo fluxo em branco"
|
"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
@@ -153,5 +153,21 @@
|
|||||||
"Move selected image to Outputs (Ctrl+Click)": "Переместить выбранное изображение в Outputs (Ctrl+щелчок)",
|
"Move selected image to Outputs (Ctrl+Click)": "Переместить выбранное изображение в Outputs (Ctrl+щелчок)",
|
||||||
"Moved selected image to Outputs.": "Выбранное изображение перемещено в Outputs.",
|
"Moved selected image to Outputs.": "Выбранное изображение перемещено в Outputs.",
|
||||||
"Failed to move 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}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,5 +65,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "Быстрый выбор рабочего процесса",
|
"name": "Быстрый выбор рабочего процесса",
|
||||||
"tooltip": "Показывать быстрый выбор при создании нового пустого рабочего процесса"
|
"tooltip": "Показывать быстрый выбор при создании нового пустого рабочего процесса"
|
||||||
|
},
|
||||||
|
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
|
||||||
|
"name": "Скрыть кнопку «Запустить в Comfy Cloud»"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-1
@@ -142,5 +142,21 @@
|
|||||||
"Permanently deleted {count} TEMP item(s).": "{count} TEMP öğesi kalıcı olarak silindi.",
|
"Permanently deleted {count} TEMP item(s).": "{count} TEMP öğesi kalıcı olarak silindi.",
|
||||||
"Could not delete {count} TEMP item(s).": "{count} TEMP öğesi silinemedi.",
|
"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.",
|
"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ı"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "Hızlı İş Akışı Seçici",
|
"name": "Hızlı İş Akışı Seçici",
|
||||||
"tooltip": "Yeni bir boş iş akışı oluştururken hızlı iş akışı seçiciyi göster"
|
"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
@@ -142,5 +142,21 @@
|
|||||||
"Permanently deleted {count} TEMP item(s).": "已永久刪除 {count} 個 TEMP 項目。",
|
"Permanently deleted {count} TEMP item(s).": "已永久刪除 {count} 個 TEMP 項目。",
|
||||||
"Could not delete {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 清理。",
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "快速工作流程選擇器",
|
"name": "快速工作流程選擇器",
|
||||||
"tooltip": "建立新的空白工作流程時顯示快速工作流程選擇器"
|
"tooltip": "建立新的空白工作流程時顯示快速工作流程選擇器"
|
||||||
|
},
|
||||||
|
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
|
||||||
|
"name": "隱藏「在 Comfy Cloud 上執行」按鈕"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-1
@@ -142,5 +142,21 @@
|
|||||||
"Permanently deleted {count} TEMP item(s).": "已永久删除 {count} 个 TEMP 项目。",
|
"Permanently deleted {count} TEMP item(s).": "已永久删除 {count} 个 TEMP 项目。",
|
||||||
"Could not delete {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 清理。",
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,8 @@
|
|||||||
"Comfy Sidebar_Quick Workflow Picker": {
|
"Comfy Sidebar_Quick Workflow Picker": {
|
||||||
"name": "快速工作流选择器",
|
"name": "快速工作流选择器",
|
||||||
"tooltip": "创建新的空白工作流时显示快速工作流选择器"
|
"tooltip": "创建新的空白工作流时显示快速工作流选择器"
|
||||||
|
},
|
||||||
|
"Comfy Sidebar_Hide Junk_Run on Comfy Cloud": {
|
||||||
|
"name": "隐藏“在 Comfy Cloud 上运行”按钮"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+230
-9
@@ -17,6 +17,9 @@ How it works
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
import struct
|
||||||
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import zlib
|
import zlib
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
@@ -34,7 +37,7 @@ _MAX_PROMPT_CHUNK_BYTES = 16 * 1024 * 1024
|
|||||||
_MAX_TEXT_CHARS_PER_FILE = 50_000
|
_MAX_TEXT_CHARS_PER_FILE = 50_000
|
||||||
|
|
||||||
_CACHE_MAX_ENTRIES = 20_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()
|
_cache_lock = threading.Lock()
|
||||||
|
|
||||||
|
|
||||||
@@ -96,6 +99,25 @@ def extract_prompt_texts(prompt):
|
|||||||
return texts
|
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):
|
def get_prompt_search_text_from_graph(prompt):
|
||||||
"""Return lower-cased text-encoder prompt text from an API-format graph."""
|
"""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]
|
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")
|
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):
|
def read_png_prompt(fileobj):
|
||||||
"""Return the parsed ``prompt`` JSON from an open PNG file, or None."""
|
"""Return the parsed ``prompt`` JSON from an open PNG file, or None."""
|
||||||
if fileobj.read(8) != _PNG_SIGNATURE:
|
if fileobj.read(8) != _PNG_SIGNATURE:
|
||||||
@@ -162,38 +196,225 @@ def read_png_prompt(fileobj):
|
|||||||
# Cached per-file text
|
# Cached per-file text
|
||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
|
|
||||||
def get_prompt_search_text(path):
|
def _load_entry(path):
|
||||||
"""Lower-cased prompt text of a PNG ('' if none). Cached by mtime + size."""
|
"""Return (text, segments, (width, height)) for a PNG, cached by mtime + size."""
|
||||||
try:
|
try:
|
||||||
st = os.stat(path)
|
st = os.stat(path)
|
||||||
except OSError:
|
except OSError:
|
||||||
return ""
|
return "", (), (0, 0)
|
||||||
signature = (st.st_mtime_ns, st.st_size)
|
signature = (st.st_mtime_ns, st.st_size)
|
||||||
|
|
||||||
with _cache_lock:
|
with _cache_lock:
|
||||||
hit = _cache.get(path)
|
hit = _cache.get(path)
|
||||||
if hit and hit[0] == signature:
|
if hit and hit[0] == signature:
|
||||||
_cache.move_to_end(path)
|
_cache.move_to_end(path)
|
||||||
return hit[1]
|
return hit[1], hit[2], hit[3]
|
||||||
|
|
||||||
text = ""
|
text, segments, dims = "", (), (0, 0)
|
||||||
try:
|
try:
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
|
dims = read_png_size(f)
|
||||||
|
f.seek(0)
|
||||||
prompt = read_png_prompt(f)
|
prompt = read_png_prompt(f)
|
||||||
if prompt is not None:
|
if prompt is not None:
|
||||||
text = get_prompt_search_text_from_graph(prompt)
|
text = get_prompt_search_text_from_graph(prompt)
|
||||||
|
segments = get_prompt_segments_from_graph(prompt)
|
||||||
except Exception:
|
except Exception:
|
||||||
# Corrupt / truncated / non-ComfyUI PNG: treat as "no prompt".
|
# Corrupt / truncated / non-ComfyUI PNG: treat as "no prompt".
|
||||||
text = ""
|
text, segments = "", ()
|
||||||
|
|
||||||
with _cache_lock:
|
with _cache_lock:
|
||||||
_cache[path] = (signature, text)
|
_cache[path] = (signature, text, segments, dims)
|
||||||
_cache.move_to_end(path)
|
_cache.move_to_end(path)
|
||||||
while len(_cache) > _CACHE_MAX_ENTRIES:
|
while len(_cache) > _CACHE_MAX_ENTRIES:
|
||||||
_cache.popitem(last=False)
|
_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():
|
def clear_cache():
|
||||||
with _cache_lock:
|
with _cache_lock:
|
||||||
_cache.clear()
|
_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
@@ -1,7 +1,7 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "comfy-sidebar"
|
name = "comfy-sidebar"
|
||||||
description = "A compact and powerful layout overhaul for ComfyUI that makes generation results easier to browse, preview, compare, and manage."
|
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" }
|
license = { file = "LICENSE" }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"send2trash>=1.8.0",
|
"send2trash>=1.8.0",
|
||||||
@@ -13,4 +13,5 @@ Repository = "https://github.com/m0rtus59/ComfyUI-ComfySidebar"
|
|||||||
[tool.comfy]
|
[tool.comfy]
|
||||||
PublisherId = "soundslikethunder"
|
PublisherId = "soundslikethunder"
|
||||||
DisplayName = "Comfy Sidebar"
|
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"
|
||||||
Reference in New Issue
Block a user