live preview and progress polling now depend if page is visible

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-04-05 20:31:46 -04:00
parent 228da75a2e
commit 95d055c191
3 changed files with 23 additions and 20 deletions
+14 -10
View File
@@ -2,23 +2,27 @@
## Update for 2025-04-05
- **Features**
- **Features**
- Pipe: [SoftFill](https://github.com/zacheryvaughn/softfill-pipelines)
- **Caching**
- **Caching**
- add `TeaCache` support to *Flux, CogVideoX, Mochi, LTX*
- add `FasterCache` support to *WanAI, LTX* (other video models already supported)
- add `PyramidAttentionBroadcast` support to *WanAI, LTX* (other video models already supported)
- **Other**
- **UI**
- client polling speeds up and slows down depending if client page is visible or not
client polling does not ask for live preview if page is not visible
significantly reduces server load if you hide or minimize the page
- progress: use batch-count for progress
- grid: add of max-rows and max-columns in settings to control grid format
- gallery: add max-columns in settings for gradio gallery components
- **Other**
- ZLUDA: add more GPUs to recognized list
select in scripts, available for sdxl in inpaint model
- LoRA: add option to force-reload LoRA on every generate
- Grid: add of max-rows and max-columns in settings to control grid format
- Gallery: add max-columns in settings for gradio gallery components
- Diag: add get-server-status to UI generate context menu
- **Changes**
- Params: Reset default guidance-rescale from 0.7 to 0.0
- Progress: add additional fields to progress API
- Progress: use batch-count for progress
- diag: add get-server-status to UI generate context menu
- **Changes**
- params: Reset default guidance-rescale from 0.7 to 0.0
- progress: add additional fields to progress API
- **Fixes**
- Logging: logging cleanup
- Styles: resize and bring quick-ui to forward on hover
+3 -3
View File
@@ -133,9 +133,10 @@ function requestProgress(id_task, progressEl, galleryEl, atEnd = null, onProgres
const start = (id_task, id_live_preview) => { // eslint-disable-line no-shadow
if (!opts.live_previews_enable || opts.live_preview_refresh_period === 0 || opts.show_progress_every_n_steps === 0) return;
const request_id = document.hidden ? -1 : id_live_preview;
const onProgressHandler = (res) => {
if (res?.debug) debug('livePreview:', dateStart, res);
if (res?.debug) debug('livePreview:', dateStart, request_id, res);
lastState = res;
const elapsedFromStart = (new Date() - dateStart) / 1000;
hasStarted |= res.active;
@@ -163,8 +164,7 @@ function requestProgress(id_task, progressEl, galleryEl, atEnd = null, onProgres
done();
};
const request_id = document.hidden ? -1 : id_live_preview;
xhrPost('./internal/progress', { id_task, request_id }, onProgressHandler, onProgressErrorHandler, false, 30000);
xhrPost('./internal/progress', { id_task, id_live_preview: request_id }, onProgressHandler, onProgressErrorHandler, false, 30000);
};
debug('livePreview start:', dateStart);
start(id_task, 0);
+6 -7
View File
@@ -93,14 +93,13 @@ def api_progress(req: ProgressRequest):
debug_log(f'Preview: job={shared.state.job} active={active} progress={step}/{steps}/{progress} image={shared.state.current_image_sampling_step} request={id_live_preview} last={shared.state.id_live_preview} enabled={shared.opts.live_previews_enable} job={shared.state.preview_job} elapsed={elapsed:.3f}')
print('HERE1', req.id_live_preview, shared.state.id_live_preview)
if shared.opts.live_previews_enable and active and (req.id_live_preview != -1) (shared.state.id_live_preview != req.id_live_preview) and (shared.state.current_image is not None):
shared.state.set_current_image()
if shared.state.current_image is not None:
if shared.opts.live_previews_enable and active and (req.id_live_preview != -1):
have_image = shared.state.set_current_image()
if have_image and shared.state.current_image is not None:
buffered = io.BytesIO()
shared.state.current_image.save(buffered, format='jpeg')
live_preview = f'data:image/jpeg;base64,{base64.b64encode(buffered.getvalue()).decode("ascii")}'
shared.state.current_image.save(buffered, format='jpeg', quality=60)
b64 = base64.b64encode(buffered.getvalue())
live_preview = f'data:image/jpeg;base64,{b64.decode("ascii")}'
else:
live_preview = None