ljleb / prompt-fusion-extension

auto1111 webui extension for all sorts of prompt interpolations!
MIT License
264 stars 16 forks source link

disabling the extension doesn't unregister the hijacked code #18

Closed ljleb closed 1 year ago

ljleb commented 1 year ago

btw we tried hijacking the webui function that filters extensions thst is called when reloading the ui, but unfortunately the module where this function is located is reset when reloading the webui. with this approach, our hijack function only gets to be called once, whether the extension is to be disabled or not.

There could be a way to hijack this function on ui reload but to achieve this we have to go detective mode on more webui code I think.

ljleb commented 1 year ago

oh yeah I just found a solution. On extension reload we test if the function is hijacked and if it isn't, we hijack it again. Instead of hijacking in place with annotation, we could register functions to be hijacked and then call smth like do_hijack() at the bottom of the extension code.

ljleb commented 1 year ago

better even, there's a callback setup function on_script_unloaded from modules.script_callbacks. using this in general bug fix pr