outpaint orbit
This commit is contained in:
@@ -3413,7 +3413,7 @@
|
||||
if (job.status === 'done') {
|
||||
showToast('Pose generation done!', 'success');
|
||||
_followLatestGid = lbCurrentGid;
|
||||
refreshNow();
|
||||
refreshNow(true);
|
||||
} else {
|
||||
showToast('Pose generation failed: ' + (job.error || 'unknown'), 'error');
|
||||
}
|
||||
@@ -3885,7 +3885,7 @@
|
||||
|
||||
updateStudio();
|
||||
_followLatestGid = lbCurrentGid;
|
||||
setTimeout(refreshNow, 500); // give server time to write static JSON
|
||||
refreshNow(true);
|
||||
} else {
|
||||
showToast('Padded', 'success');
|
||||
lbUrls[lbIdx] = IMAGE_FOLDER + fname + '?t=' + Date.now();
|
||||
@@ -3936,7 +3936,7 @@
|
||||
|
||||
updateStudio();
|
||||
_followLatestGid = lbCurrentGid;
|
||||
setTimeout(refreshNow, 500);
|
||||
refreshNow(true);
|
||||
} else {
|
||||
showToast('Duplicate failed', 'error');
|
||||
}
|
||||
@@ -3955,7 +3955,7 @@
|
||||
showToast('Background removed', 'success');
|
||||
fileHasBg[fname] = false;
|
||||
_bustStudioImage(fname); // cache-busts viewer + calls updateStudio()
|
||||
refreshNow();
|
||||
refreshNow(true);
|
||||
} else {
|
||||
showToast(`Failed to remove background for ${fname}`, 'error');
|
||||
}
|
||||
@@ -3977,7 +3977,7 @@
|
||||
showToast('Transparency inverted', 'success');
|
||||
fileHasBg[fname] = false;
|
||||
_bustStudioImage(fname);
|
||||
refreshNow();
|
||||
refreshNow(true);
|
||||
} else {
|
||||
showToast('Invert failed: ' + await r.text(), 'error');
|
||||
}
|
||||
@@ -4006,7 +4006,7 @@
|
||||
const d = await r.json();
|
||||
showToast(`Video created: ${d.output}`, 'success');
|
||||
_followLatestGid = lbCurrentGid;
|
||||
refreshNow();
|
||||
refreshNow(true);
|
||||
} catch (e) { showToast('Video error: ' + e, 'error'); }
|
||||
if (btn) { btn.disabled = false; btn.textContent = 'Make video'; }
|
||||
}
|
||||
@@ -4659,7 +4659,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
async function loadImages() {
|
||||
async function loadImages(bypassStatic = false) {
|
||||
if (loadImages._inFlight) return;
|
||||
loadImages._inFlight = true;
|
||||
const gallery = document.getElementById('gallery');
|
||||
@@ -4671,6 +4671,7 @@
|
||||
|
||||
// Primary: pre-generated static JSON (fast, no DB round-trip per request)
|
||||
try {
|
||||
if (bypassStatic) throw new Error("Bypass static requested");
|
||||
const r = await fetch(`${API}/output/_data/images.json?t=${Date.now()}`, { signal: AbortSignal.timeout(4000) });
|
||||
if (r.ok) {
|
||||
const data = await r.json();
|
||||
@@ -4914,9 +4915,14 @@
|
||||
// Direct callers that need a response (pollJob completion, etc.) still use
|
||||
// loadImages() directly; everything else should go through refreshNow().
|
||||
let _refreshTimer = null;
|
||||
function refreshNow() {
|
||||
let _refreshBypassStatic = false;
|
||||
function refreshNow(bypass = false) {
|
||||
if (bypass) _refreshBypassStatic = true;
|
||||
clearTimeout(_refreshTimer);
|
||||
_refreshTimer = setTimeout(loadImages, 80);
|
||||
_refreshTimer = setTimeout(() => {
|
||||
loadImages(_refreshBypassStatic || !!_followLatestGid);
|
||||
_refreshBypassStatic = false;
|
||||
}, 80);
|
||||
}
|
||||
|
||||
const API = 'http://127.0.0.1:8500';
|
||||
@@ -6010,7 +6016,7 @@
|
||||
const poll = () => setTimeout(async () => {
|
||||
try {
|
||||
const s = await fetch(`${API}/batch/${job_id}`).then(r => r.json());
|
||||
if (s.status === 'done') { refreshNow(); }
|
||||
if (s.status === 'done') { refreshNow(true); }
|
||||
else if (s.status !== 'error' && s.status !== 'cancelled') poll();
|
||||
} catch(e) {}
|
||||
}, 2000);
|
||||
@@ -6168,7 +6174,7 @@
|
||||
if (job.done > prevDone) {
|
||||
prevDone = job.done;
|
||||
_followLatestGid = lbCurrentGid;
|
||||
refreshNow();
|
||||
refreshNow(true);
|
||||
}
|
||||
if (job.status === 'running') { pollGen(); return; }
|
||||
if (job.status === 'cancelled') {
|
||||
@@ -6188,7 +6194,7 @@
|
||||
_sbPoseEdits = {};
|
||||
_sbGenJobId = null;
|
||||
_followLatestGid = lbCurrentGid;
|
||||
refreshNow();
|
||||
refreshNow(true);
|
||||
renderSidebarGenerate();
|
||||
} else {
|
||||
textEl.textContent = `Error: ${job.error || 'unknown'}`;
|
||||
@@ -6445,7 +6451,7 @@
|
||||
if (btn) btn.textContent = 'Done ✓';
|
||||
showToast(`Faceswap complete: ${job.output || ''}`, 'success');
|
||||
_followLatestGid = lbCurrentGid;
|
||||
setTimeout(() => { refreshNow(); }, 1800);
|
||||
refreshNow(true);
|
||||
} else {
|
||||
if (textEl) textEl.textContent = `Error: ${job.error || 'unknown'}`;
|
||||
if (btn) { btn.disabled = false; btn.textContent = 'Retry'; }
|
||||
@@ -7068,6 +7074,7 @@
|
||||
const label = d.used_sam2 ? 'Done (SAM2)' : 'Done (rembg)';
|
||||
if (statusEl) statusEl.textContent = label;
|
||||
showToast('Background removed', 'success');
|
||||
refreshNow(true);
|
||||
// Build URL same way as all gallery images: IMAGE_FOLDER + filename
|
||||
const nobgUrl = IMAGE_FOLDER + d.nobg_filename + '?t=' + Date.now();
|
||||
_nobgSidecars.set(fname, nobgUrl);
|
||||
@@ -7116,6 +7123,7 @@
|
||||
const d = await r.json();
|
||||
if (statusEl) statusEl.textContent = 'Done (rembg)';
|
||||
showToast('Background removed (rembg)', 'success');
|
||||
refreshNow(true);
|
||||
const nobgUrl = IMAGE_FOLDER + d.nobg_filename + '?t=' + Date.now();
|
||||
_nobgSidecars.set(fname, nobgUrl);
|
||||
const preload = new Image();
|
||||
@@ -7152,6 +7160,7 @@
|
||||
lbNames = [fname, ...otherNames];
|
||||
lbIdx = 0;
|
||||
updateStudio();
|
||||
refreshNow(true);
|
||||
// Fire-and-forget face extraction for face-book
|
||||
fetch(`${API}/images/${encodeURIComponent(fname)}/extract-face`, { method: 'POST' })
|
||||
.then(r => r.ok ? r.json() : null)
|
||||
|
||||
Reference in New Issue
Block a user