Spaces:
Sleeping
Sleeping
LogicalTrue commited on
Commit ·
4326f0e
1
Parent(s): cbaed1a
Show modal loader and auto load 3D model on PC when job triggered from mobile
Browse files275 unmodified lines2762772782792802816 unmodified lines288289290291292293294295296297298299300301302303275 unmodified linesbgTaskBanner.style.display = 'flex';}const pollInterval = setInterval(async () => {try {const statusRes = await fetch(`${apiBase}/api/job-status?job_id=${jobId}`);6 unmodified linesbgTaskText.textContent = `Generando ${typeLabel}... ${progress}%`;bgTaskBanner.style.display = 'flex';}} else if (job.status === 'completed') {clearInterval(pollInterval);isPollingActiveJobPC = false;if (bgTaskBanner) bgTaskBanner.style.display = 'none';try { refreshGallery(); } catch (e) {}try { fetchUserInfo(); } catch (e) {}} else if (job.status === 'failed') {clearInterval(pollInterval);isPollingActiveJobPC = false;if (bgTaskBanner) bgTaskBanner.style.display = 'none';}} catch (e) {console.warn('[PC] Active job poll warning:', e);275 unmodified lines2762772782792802812822832842852866 unmodified lines293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322275 unmodified linesbgTaskBanner.style.display = 'flex';}if (jobType === '3d' && typeof statusOverlay !== 'undefined' && statusOverlay) {statusOverlay.classList.add('active');updateLoader(10, 'Procesando en segundo plano...', 'Generando modelo 3D desde tu dispositivo...');}const pollInterval = setInterval(async () => {try {const statusRes = await fetch(`${apiBase}/api/job-status?job_id=${jobId}`);6 unmodified linesbgTaskText.textContent = `Generando ${typeLabel}... ${progress}%`;bgTaskBanner.style.display = 'flex';}if (jobType === '3d' && typeof updateLoader === 'function') {updateLoader(progress, job.status === 'pending' ? 'En cola de espera...' : 'Procesando modelo 3D...', job.message || 'La IA está generando tu modelo 3D...');}} else if (job.status === 'completed') {clearInterval(pollInterval);isPollingActiveJobPC = false;if (bgTaskBanner) bgTaskBanner.style.display = 'none';if (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);isPollingActiveJobPC = false;if (bgTaskBanner) bgTaskBanner.style.display = 'none';if (jobType === '3d' && typeof statusOverlay !== 'undefined' && statusOverlay) {statusOverlay.classList.remove('active');}}} catch (e) {console.warn('[PC] Active job poll warning:', e);
frontend/app.js+19