mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-10-01 01:26:03 -04:00
UI: Do not save unchanged settings to settings.yaml
This commit is contained in:
parent
038b4fc8af
commit
53dc1d8197
@ -1,4 +1,5 @@
|
|||||||
import argparse
|
import argparse
|
||||||
|
import copy
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
@ -65,6 +66,7 @@ settings = {
|
|||||||
'default_extensions': ['gallery'],
|
'default_extensions': ['gallery'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default_settings = copy.deepcopy(settings)
|
||||||
|
|
||||||
# Parser copied from https://github.com/vladmandic/automatic
|
# Parser copied from https://github.com/vladmandic/automatic
|
||||||
parser = argparse.ArgumentParser(description="Text generation web UI", conflict_handler='resolve', add_help=True, formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=55, indent_increment=2, width=200))
|
parser = argparse.ArgumentParser(description="Text generation web UI", conflict_handler='resolve', add_help=True, formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=55, indent_increment=2, width=200))
|
||||||
|
@ -234,6 +234,11 @@ def save_settings(state, preset, extensions_list, show_controls, theme_state):
|
|||||||
_id = f"{extension_name}-{param}"
|
_id = f"{extension_name}-{param}"
|
||||||
output[_id] = params[param]
|
output[_id] = params[param]
|
||||||
|
|
||||||
|
# Do not save unchanged settings
|
||||||
|
for key in list(output.keys()):
|
||||||
|
if key in shared.default_settings and output[key] == shared.default_settings[key]:
|
||||||
|
output.pop(key)
|
||||||
|
|
||||||
return yaml.dump(output, sort_keys=False, width=float("inf"))
|
return yaml.dump(output, sort_keys=False, width=float("inf"))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user