Spaces:
Sleeping
Sleeping
LogicalTrue commited on
Commit ·
40e40c1
1
Parent(s): 4326f0e
Add continuous background job polling on PC for 2D and 3D generations
Browse files250 unmodified lines2512522532542552569 unmodified lines26626726826927027131 unmodified lines303304305306307308309310311312313314250 unmodified lines}let isPollingActiveJobPC = false;async function checkActiveUserJob() {if (isPollingActiveJobPC) return;try {9 unmodified lines}}function resumeActiveJobPollingPC(jobId, jobType) {const bgTaskBanner = document.getElementById('bgTaskBanner');const bgTaskText = document.getElementById('bgTaskText');31 unmodified linesif (jobType === '3d' && typeof statusOverlay !== 'undefined' && statusOverlay) {statusOverlay.classList.remove('active');}try { refreshGallery(); } catch (e) {}try { fetchUserInfo(); } catch (e) {}const resData = job.result;if (jobType === '3d' && resData && (resData.gltfUrl || resData.glbUrl)) {showCustomToast('¡Modelo 3D generado y cargado con éxito!', 'success');load3DModel(resData.gltfUrl, resData.glbUrl, resData.fbxUrl, resData.detectedCategory);}} else if (job.status === 'failed') {clearInterval(pollInterval);250 unmodified lines2512522532542552562572589 unmodified lines26826927027127227327427527627727827928028131 unmodified lines313314315316317318319320321322323324325326327328329330331332333334250 unmodified lines}let isPollingActiveJobPC = false;let bgJobCheckTimerPC = null;async function checkActiveUserJob() {if (isPollingActiveJobPC) return;try {9 unmodified lines}}if (!bgJobCheckTimerPC) {bgJobCheckTimerPC = setInterval(() => {if (!isPollingActiveJobPC) {checkActiveUserJob();}}, 3000);}function resumeActiveJobPollingPC(jobId, jobType) {const bgTaskBanner = document.getElementById('bgTaskBanner');const bgTaskText = document.getElementById('bgTaskText');31 unmodified linesif (jobType === '3d' && typeof statusOverlay !== 'undefined' && statusOverlay) {statusOverlay.classList.remove('active');}try { refreshLibraryThumbnails(); } catch (e) {}try { fetchUserInfo(); } catch (e) {}const resData = job.result;if (jobType === '3d' && resData && (resData.gltfUrl || resData.glbUrl)) {showCustomToast('¡Modelo 3D generado y cargado con éxito!', 'success');load3DModel(resData.gltfUrl, resData.glbUrl, resData.fbxUrl, resData.detectedCategory);} else if (jobType === '2d' && resData && resData.image) {showCustomToast('¡Imagen 2D generada con éxito!', 'success');fetch(resData.image).then(r => r.blob()).then(blob => {const file = new File([blob], "generated.png", { type: "image/png" });handleImageFile(file);const uploadTabBtn = document.querySelector('[data-tab="upload-tab"]');if (uploadTabBtn) uploadTabBtn.click();}).catch(e => console.error("Error loading generated 2D image:", e));}} else if (job.status === 'failed') {clearInterval(pollInterval);
frontend/app.js+21-1