mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +01:00
UI: Do not save unchanged extension settings to settings.yaml
This commit is contained in:
parent
bb2c4707c4
commit
b3fc2cd887
@ -19,9 +19,8 @@ def apply_settings(extension, name):
|
||||
|
||||
for param in extension.params:
|
||||
_id = f"{name}-{param}"
|
||||
if _id not in shared.settings:
|
||||
continue
|
||||
|
||||
shared.default_settings[_id] = extension.params[param]
|
||||
if _id in shared.settings:
|
||||
extension.params[param] = shared.settings[_id]
|
||||
|
||||
|
||||
@ -40,11 +39,15 @@ def load_extensions():
|
||||
raise
|
||||
|
||||
extension = getattr(extensions, name).script
|
||||
|
||||
# Only run setup() and apply settings from settings.yaml once
|
||||
if extension not in setup_called:
|
||||
apply_settings(extension, name)
|
||||
if extension not in setup_called and hasattr(extension, "setup"):
|
||||
setup_called.add(extension)
|
||||
if hasattr(extension, "setup"):
|
||||
extension.setup()
|
||||
|
||||
setup_called.add(extension)
|
||||
|
||||
state[name] = [True, i]
|
||||
except:
|
||||
logger.error(f'Failed to load the extension "{name}".')
|
||||
|
@ -232,6 +232,8 @@ def save_settings(state, preset, extensions_list, show_controls, theme_state):
|
||||
params = getattr(extension, 'params')
|
||||
for param in params:
|
||||
_id = f"{extension_name}-{param}"
|
||||
# Only save if different from default value
|
||||
if param not in shared.default_settings or params[param] != shared.default_settings[param]:
|
||||
output[_id] = params[param]
|
||||
|
||||
# Do not save unchanged settings
|
||||
|
Loading…
Reference in New Issue
Block a user