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,10 +19,9 @@ def apply_settings(extension, name):
|
|||||||
|
|
||||||
for param in extension.params:
|
for param in extension.params:
|
||||||
_id = f"{name}-{param}"
|
_id = f"{name}-{param}"
|
||||||
if _id not in shared.settings:
|
shared.default_settings[_id] = extension.params[param]
|
||||||
continue
|
if _id in shared.settings:
|
||||||
|
extension.params[param] = shared.settings[_id]
|
||||||
extension.params[param] = shared.settings[_id]
|
|
||||||
|
|
||||||
|
|
||||||
def load_extensions():
|
def load_extensions():
|
||||||
@ -40,10 +39,14 @@ def load_extensions():
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
extension = getattr(extensions, name).script
|
extension = getattr(extensions, name).script
|
||||||
apply_settings(extension, name)
|
|
||||||
if extension not in setup_called and hasattr(extension, "setup"):
|
# Only run setup() and apply settings from settings.yaml once
|
||||||
|
if extension not in setup_called:
|
||||||
|
apply_settings(extension, name)
|
||||||
|
if hasattr(extension, "setup"):
|
||||||
|
extension.setup()
|
||||||
|
|
||||||
setup_called.add(extension)
|
setup_called.add(extension)
|
||||||
extension.setup()
|
|
||||||
|
|
||||||
state[name] = [True, i]
|
state[name] = [True, i]
|
||||||
except:
|
except:
|
||||||
|
@ -232,7 +232,9 @@ def save_settings(state, preset, extensions_list, show_controls, theme_state):
|
|||||||
params = getattr(extension, 'params')
|
params = getattr(extension, 'params')
|
||||||
for param in params:
|
for param in params:
|
||||||
_id = f"{extension_name}-{param}"
|
_id = f"{extension_name}-{param}"
|
||||||
output[_id] = params[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
|
# Do not save unchanged settings
|
||||||
for key in list(output.keys()):
|
for key in list(output.keys()):
|
||||||
|
Loading…
Reference in New Issue
Block a user