mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-29 10:59:32 +01:00
Apply the settings for extensions after import, but before setup() (#1484)
This commit is contained in:
parent
b0ce750d4e
commit
ebca3f86d5
@ -11,6 +11,18 @@ available_extensions = []
|
|||||||
setup_called = set()
|
setup_called = set()
|
||||||
|
|
||||||
|
|
||||||
|
def apply_settings(extension, name):
|
||||||
|
if not hasattr(extension, 'params'):
|
||||||
|
return
|
||||||
|
|
||||||
|
for param in extension.params:
|
||||||
|
_id = f"{name}-{param}"
|
||||||
|
if _id not in shared.settings:
|
||||||
|
continue
|
||||||
|
|
||||||
|
extension.params[param] = shared.settings[_id]
|
||||||
|
|
||||||
|
|
||||||
def load_extensions():
|
def load_extensions():
|
||||||
global state, setup_called
|
global state, setup_called
|
||||||
for i, name in enumerate(shared.args.extensions):
|
for i, name in enumerate(shared.args.extensions):
|
||||||
@ -22,6 +34,7 @@ def load_extensions():
|
|||||||
extension = getattr(extensions, name).script
|
extension = getattr(extensions, name).script
|
||||||
if extension not in setup_called and hasattr(extension, "setup"):
|
if extension not in setup_called and hasattr(extension, "setup"):
|
||||||
setup_called.add(extension)
|
setup_called.add(extension)
|
||||||
|
apply_settings(extension, name)
|
||||||
extension.setup()
|
extension.setup()
|
||||||
|
|
||||||
state[name] = [True, i]
|
state[name] = [True, i]
|
||||||
@ -105,18 +118,11 @@ def apply_extensions(typ, *args, **kwargs):
|
|||||||
def create_extensions_block():
|
def create_extensions_block():
|
||||||
global setup_called
|
global setup_called
|
||||||
|
|
||||||
# Updating the default values
|
|
||||||
for extension, name in iterator():
|
|
||||||
if hasattr(extension, 'params'):
|
|
||||||
for param in extension.params:
|
|
||||||
_id = f"{name}-{param}"
|
|
||||||
if _id in shared.settings:
|
|
||||||
extension.params[param] = shared.settings[_id]
|
|
||||||
|
|
||||||
should_display_ui = False
|
should_display_ui = False
|
||||||
for extension, name in iterator():
|
for extension, name in iterator():
|
||||||
if hasattr(extension, "ui"):
|
if hasattr(extension, "ui"):
|
||||||
should_display_ui = True
|
should_display_ui = True
|
||||||
|
break
|
||||||
|
|
||||||
# Creating the extension ui elements
|
# Creating the extension ui elements
|
||||||
if should_display_ui:
|
if should_display_ui:
|
||||||
|
Loading…
Reference in New Issue
Block a user