This commit is contained in:
Fill
2025-12-03 12:11:53 -08:00
parent 7128f930c3
commit 58326650aa
3 changed files with 52 additions and 11 deletions
+7 -1
View File
@@ -111,6 +111,9 @@ class FL_ImagePicker:
"images": images
}
print(f"[FL_ImagePicker] Session created: {session_id}")
print(f"[FL_ImagePicker] Active sessions after create: {list(pending_selections.keys())}")
# Send message to frontend to show selector
PromptServer.instance.send_sync("fl_image_picker_show", {
"session_id": session_id,
@@ -203,8 +206,11 @@ async def get_full_image(request):
session_id = request.match_info.get("session_id")
index = int(request.match_info.get("index"))
print(f"[FL_ImagePicker] Full image request: session={session_id}, index={index}")
print(f"[FL_ImagePicker] Active sessions: {list(pending_selections.keys())}")
if session_id not in pending_selections:
return web.json_response({"status": "error", "message": "Session not found"}, status=404)
return web.json_response({"status": "error", "message": f"Session not found. Active: {list(pending_selections.keys())}"}, status=404)
images = pending_selections[session_id].get("images")
if images is None:
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui_fill-nodes"
description = "Fill-Nodes is a versatile collection of custom nodes for ComfyUI that extends functionality across multiple domains. Features include advanced image processing (pixelation, slicing, masking), visual effects generation (glitch, halftone, pixel art), comprehensive file handling (PDF creation/extraction, Google Drive integration), AI model interfaces (GPT, DALL-E, Hugging Face), utility nodes for workflow enhancement, and specialized tools for video processing, captioning, and batch operations. The pack provides both practical workflow solutions and creative tools within a unified node collection."
version = "2.2.1"
version = "2.2.2"
license = "LICENSE"
dependencies = ["diffusers", "librosa", "sounddevice", "glitch_this", "PyOpenGL", "glfw", "scipy>=1.13.1", "requests", "aiohttp", "moviepy", "matplotlib", "reportlab", "openai", "PyPDF2", "pdf2image", "PyMuPDF", "reportlab", "PyPDF2", "ollama", "kornia", "opencv-python", "gdown", "open_clip_torch", "google-genai"]
+44 -9
View File
@@ -182,7 +182,7 @@ function showImagePickerModal(sessionId, images, batchSize, timeoutSeconds) {
header.appendChild(headerRight);
// Start countdown timer
countdownInterval = setInterval(() => {
countdownInterval = setInterval(async () => {
remainingSeconds--;
updateTimer();
@@ -190,7 +190,7 @@ function showImagePickerModal(sessionId, images, batchSize, timeoutSeconds) {
clearInterval(countdownInterval);
countdownInterval = null;
// Timeout - cancel the job instead of sending images through
sendSelection(sessionId, [], true);
await sendSelection(sessionId, [], true);
closeModal();
}
}, 1000);
@@ -464,16 +464,18 @@ function showImagePickerModal(sessionId, images, batchSize, timeoutSeconds) {
activeModal = overlay;
// Keyboard shortcuts (only when preview modal is NOT open)
const keyHandler = (e) => {
const keyHandler = async (e) => {
// Don't handle if preview modal is open - let the preview handler deal with it
if (previewModal) return;
if (e.key === 'Escape') {
sendSelection(sessionId, [], true);
e.preventDefault();
await sendSelection(sessionId, [], true);
closeModal();
} else if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
e.preventDefault();
const selection = Array.from(selectedIndices).sort((a, b) => a - b);
sendSelection(sessionId, selection, false);
await sendSelection(sessionId, selection, false);
closeModal();
}
};
@@ -529,6 +531,7 @@ function createButton(text, color, onClick, isPrimary = false) {
}
async function sendSelection(sessionId, selection, cancelled) {
console.log(`[FL_ImagePicker] Sending selection: session=${sessionId}, selection=${JSON.stringify(selection)}, cancelled=${cancelled}`);
try {
const response = await fetch('/fl_image_picker/select', {
method: 'POST',
@@ -542,9 +545,11 @@ async function sendSelection(sessionId, selection, cancelled) {
})
});
const result = await response.json();
console.log('[FL_ImagePicker] Selection sent:', result);
console.log('[FL_ImagePicker] Selection sent successfully:', result);
return result;
} catch (error) {
console.error('[FL_ImagePicker] Error sending selection:', error);
throw error;
}
}
@@ -790,32 +795,62 @@ async function loadFullResImage(index) {
const img = document.getElementById('preview-image');
const infoText = document.getElementById('preview-info');
if (!spinner || !img) return;
if (!spinner || !img) {
console.error('[FL_ImagePicker] Preview elements not found');
return;
}
if (!currentSessionId) {
console.error('[FL_ImagePicker] No active session for preview');
spinner.innerHTML = `<span style="color: #d9534f;">No active session</span>`;
return;
}
// Show loading state
spinner.style.display = 'flex';
spinner.innerHTML = `
<div style="
width: 40px;
height: 40px;
border: 3px solid #333;
border-top-color: #4ECDC4;
border-radius: 50%;
animation: spin 1s linear infinite;
"></div>
<span>Loading full resolution...</span>
`;
img.style.opacity = '0';
console.log(`[FL_ImagePicker] Loading full-res image: session=${currentSessionId}, index=${index}`);
try {
const response = await fetch(`/fl_image_picker/full_image/${currentSessionId}/${index}`);
const data = await response.json();
console.log(`[FL_ImagePicker] Full-res response:`, data.status, data.status === 'ok' ? `${data.width}x${data.height}` : data.message);
if (data.status === 'ok') {
img.src = data.data;
img.onload = () => {
spinner.style.display = 'none';
img.style.opacity = '1';
};
img.onerror = () => {
console.error('[FL_ImagePicker] Failed to load image data');
spinner.innerHTML = `<span style="color: #d9534f;">Failed to decode image</span>`;
spinner.style.display = 'flex';
};
if (infoText) {
infoText.textContent = `Image #${index + 1} of ${currentBatchSize} - ${data.width}x${data.height}`;
}
currentPreviewIndex = index;
} else {
spinner.innerHTML = `<span style="color: #d9534f;">Error loading image</span>`;
console.error('[FL_ImagePicker] Server error:', data.message);
spinner.innerHTML = `<span style="color: #d9534f;">Error: ${data.message || 'Unknown error'}</span>`;
}
} catch (error) {
console.error('[FL_ImagePicker] Error loading full-res image:', error);
spinner.innerHTML = `<span style="color: #d9534f;">Error loading image</span>`;
spinner.innerHTML = `<span style="color: #d9534f;">Network error loading image</span>`;
}
}