TC: Fix being unable to restore null JSON schema

ac7076c832c9500accfe874ef8ace72617536b6f

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +6 -6Showing whitespace changes
public/scripts/textgen-settings.js+6 -6
@@ -1152,6 +1152,12 @@ function setSettingByName(setting, value, trigger) {
11521152 return;
11531153 }
11541154
1155+ if ('json_schema' === setting) {
1156+ settings.json_schema = value ?? null;
1157+ $('#tabby_json_schema').val(value ? JSON.stringify(settings.json_schema, null, 2) : '');
1158+ return;
1159+ }
1160+
11551161 if (value === null || value === undefined) {
11561162 return;
11571163 }
@@ -1192,12 +1198,6 @@ function setSettingByName(setting, value, trigger) {
11921198 return;
11931199 }
11941200
1195- if ('json_schema' === setting) {
1196- settings.json_schema = value ?? null;
1197- $('#tabby_json_schema').val(value ? JSON.stringify(settings.json_schema, null, 2) : '');
1198- return;
1199- }
1200-
12011201 const isCheckbox = $(`#${setting}_textgenerationwebui`).attr('type') == 'checkbox';
12021202 const isText = $(`#${setting}_textgenerationwebui`).attr('type') == 'text' || $(`#${setting}_textgenerationwebui`).is('textarea');
12031203 if (isCheckbox) {