fix(api): set compatibility options without crashing

clip_skip and the uni_pc_* opts live in opts.data without an OptionInfo in
data_labels (compatibility_opts). Options.set() read data_labels[key].onchange
unconditionally, so setting clip_skip via /sdapi/v1/options raised KeyError and
returned 500; the override_settings restore path had the same unguarded
data_labels[k] access for falsy-valued compat opts.

Guard the onchange lookup and read the stored value via getattr(opts, k), which
already falls back through data then data_labels.
This commit is contained in:
CalamitousFelicitousness
2026-06-25 02:18:45 +01:00
parent 3dd0cd590c
commit a6fe828aa2
2 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -153,11 +153,12 @@ def process_images(p: StableDiffusionProcessing) -> Processed | None:
for k, v in p.override_settings.copy().items():
if shared.opts.data.get(k, None) is None and shared.opts.data_labels.get(k, None) is None:
continue
orig = shared.opts.data.get(k, None) or shared.opts.data_labels[k].default
# getattr resolves the value via data then data_labels; compat opts (clip_skip) have no data_labels entry
orig = getattr(shared.opts, k, None)
if orig == v or (type(orig) == str and os.path.splitext(orig)[0] == v):
p.override_settings.pop(k, None)
for k in p.override_settings.keys():
stored_opts[k] = shared.opts.data.get(k, None) or shared.opts.data_labels[k].default
stored_opts[k] = getattr(shared.opts, k, None)
results = None
try:
# if no checkpoint override or the override checkpoint can't be found, remove override entry and load opts checkpoint