SenshiSentou / sd-webui-state-manager

A state manager to quickly save and return to previous configs in A1111
MIT License
55 stars 6 forks source link

Extension no longer works on localhost? - "No previous state found" after the latest update #9

Open VL4DST3R opened 5 months ago

VL4DST3R commented 5 months ago

I think this is related to V2.0. After the update I got the notice about 2.0 not being backwards compatible and asking if it can delete the other states and start fresh, so I did.

All seemed to be fine on the tab I first ran the webui. However if i open it via http://127.0.0.1:7860/ I constantly get the below warning popup when I generate an image. Also the save/load buttons are no longer there so effectively the extension no longer works on localhost. Reinstalling the extension from scratch seems to not help in any way.

image

I get no errors or warnings in the console related to this extension as far as I can tell, so I don't know what could be causing it.

SenshiSentou commented 5 months ago

Interesting. I wonder if might be a conflicting extension that also hijacks the submit function, but doesn't passthrough. To verify, could you add a console.log or alert to the submit override (line 325 in statemanager.js? Of maybe run await stateManager.getCurrentState('txt2img'); in the console live and see if that correctly returns the current state?

VL4DST3R commented 5 months ago

I wonder if might be a conflicting extension

A conflict that only manifests on that particular url? All other extensions that I use seem to work fine across all tabs, plus I don't even use that many compared to others (I think). I will test what you suggest tomorrow and see if I can get something useful out of it. If you have any other suggestions or require other info about my system and setup do let me know.

Also for future context: I currently use 4 tabs in total so I can prepare instances for various prompt templates and settings: localhost, 127.0.0.1 (which is broken), my LAN IP i.e. 192.168.0.XX and a custom DNS address. 3/4 of them work just fine with each preserving its state as expected.

SenshiSentou commented 5 months ago

Oh, that's way more strange then! Especially since I also run from 127.0.0.1 and never encountered this issue. When you're testing, can you also please try visiting http://127.0.0.1:7860/statemanager/quicksettings and seeing if that returns the correct values? Thanks for helping me investigate! It's much appreciated

VL4DST3R commented 5 months ago

could you add a console.log or alert to the submit override (line 325 in statemanager.js? Of maybe run await stateManager.getCurrentState('txt2img'); in the console live and see if that correctly returns the current state?

I need you to be a bit more specific - how exactly do you want me to add it? simply adding a line with console.log("test"); within the function doesn't output anything to the console as far as I can tell.

maybe run await stateManager.getCurrentState('txt2img'); in the console live and see if that correctly returns the current state?

Running this for a working tab I get:

13:01:06.740 await stateManager.getCurrentState('txt2img');
13:01:06.902
Object { saveVersion: "2.0", type: "txt2img", defaults: "86d94ce16843500c35d565e3d8066925ddf38295cb636f9f74a9a6affc1e351e", quickSettings: {…}, componentSettings: {…}, preview: null }

but running it in the "broken" 127.0.0.1 tab I get:

13:00:58.132 await stateManager.getCurrentState('txt2img');
13:00:58.147 Uncaught (in promise) TypeError: sm.memoryStorage.currentDefault is null
    getCurrentState http://127.0.0.1:7860/file=extensions/sd-webui-state-manager/javascript/statemanager.js?1711189369.7209234:863
    <anonymous> debugger eval code:2
    <anonymous> debugger eval code:3

can you also please try visiting http://127.0.0.1:7860/statemanager/quicksettings and seeing if that returns the correct values

checking the page on all tabs (including the broken one) returns the same values, which seem correct

<html><body>
<!--StartFragment--><div id="content"><div class="tabs tabs-tall "><nav class="tabs-navigation"><ul class="tabs-menu" role="tablist"><li class="tabs-menu-item json is-active" role="presentation"><span class="devtools-tab-line"></span></li></ul></nav></div></div><span class="devtools-tab-line"></span><span class="devtools-tab-line"></span><div id="json-panel" style="visibility: visible; height: 100%;" class="tab-panel-box" role="tabpanel" aria-labelledby="json-tab"><div class="tab-panel json"><div class="jsonPanelBox tab-panel-inner"><div class="toolbar"></div></div></div></div><div id="json-panel" style="visibility: visible; height: 100%;" class="tab-panel-box" role="tabpanel" aria-labelledby="json-tab"><div class="tab-panel json"><div class="jsonPanelBox tab-panel-inner"><div class="toolbar"><div class="devtools-separator"></div><div class="devtools-searchbox"><input class="searchBox devtools-filterinput" placeholder="Filter JSON" value=""></div></div><div class="panelContent" id="json-scrolling-panel" tabindex="0">
  |  
-- | --
settings |  
sd_unet | "Automatic"
CLIP_stop_at_last_layers | 1
sd_model_checkpoint | "SD1.5\\Realistic (3D)\\icbinpICantBelieveIts_afterburn.safetensors [65cd001daf]"
sd_vae | "vae-ft-mse-840000-ema-pruned.safetensors"
live_previews_enable | true
sd_hypernetwork | "None"
eta_noise_seed_delta | 0

</div></div></div></div><!--EndFragment-->
</body>
</html>

I should also maybe mention I'm running this on a Firefox fork (Waterfox) if you think that matters.

VL4DST3R commented 5 months ago

I think I may have a lead, running this in a private window or on a different browser works just fine on 127, which leads me to believe there's something funny about a browser addon that may be causing this, but so far disabling the most obvious culprits (i.e. ublock, noscript and other privacy stuff) came up blank, will have to test more and report back if I figure it out.

EDIT: Or maybe a state saved badly for this? How can I manually clear the states for a particular url? Clearing browser storage and cookies for the domain doesn't seem to do do it.

SenshiSentou commented 5 months ago

Hmm, very strange.. So far I'm quite clueless. If you want to try clearing it you were close; you'll need to clear the Indexed DB. Just select the statemanger key and hit delete (I think? cmd+backspace on MacBook).

Screenshot 2024-03-24 at 13 35 07
VL4DST3R commented 5 months ago

Yep, manually deleting the whole idb folder and reloading the page seems to have fixed it for me! I don't have it anymore to show you, but my "s" folder had a single entry with a few values similar to the headers of a table. However now I'm experiencing exactly the issue reported by another user on issue #11 only affecting this tab.

Interesting how before clearing the storage properly this was working, albeit with the warning from my original post.