Skip to content

Commit ca0ebfe

Browse files
committed
fix prompt-visible toggle handling
1 parent d1dcdcb commit ca0ebfe

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/wwwroot/js/genpage/params.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,15 @@ function genInputs(delay_final = false) {
110110
let runnables = [];
111111
let groupsClose = [];
112112
let groupsEnable = [];
113-
for (let areaData of [['main_inputs_area', 'new_preset_modal_inputs', (p) => (p.visible || p.id == 'prompt') && !isParamAdvanced(p)],
114-
['main_inputs_area_advanced', 'new_preset_modal_advanced_inputs', (p) => p.visible && isParamAdvanced(p)],
115-
['main_inputs_area_hidden', 'new_preset_modal_hidden_inputs', (p) => (!p.visible && p.id != 'prompt')]]) {
113+
for (let areaData of [['main_inputs_area', 'new_preset_modal_inputs', (p) => (p.visible || p.id == 'prompt') && !isParamAdvanced(p), true],
114+
['main_inputs_area_advanced', 'new_preset_modal_advanced_inputs', (p) => p.visible && isParamAdvanced(p), false],
115+
['main_inputs_area_hidden', 'new_preset_modal_hidden_inputs', (p) => (!p.visible || p.id == 'prompt'), false]]) {
116116
let area = getRequiredElementById(areaData[0]);
117117
area.innerHTML = '';
118118
let presetArea = areaData[1] ? getRequiredElementById(areaData[1]) : null;
119119
let html = '', presetHtml = '';
120120
let lastGroup = null;
121+
let isMain = areaData[3];
121122
for (let param of gen_param_types.filter(areaData[2])) {
122123
let groupName = param.group ? param.group.name : null;
123124
if (groupName != lastGroup) {
@@ -147,23 +148,25 @@ function genInputs(delay_final = false) {
147148
}
148149
lastGroup = groupName;
149150
}
150-
if (param.id == 'prompt' && param.visible) {
151+
if (param.id == 'prompt' && param.visible && isMain) {
151152
html += `<button class="generate-button" id="generate_button" onclick="getRequiredElementById('alt_generate_button').click()">Generate Image</button>
152153
<br><span class="interrupt_line"><button class="interrupt-button interrupt-button-none" id="interrupt_button" onclick="getRequiredElementById('alt_interrupt_button').click()">Interrupt</button></span>`;
153154
}
154-
if (param.id == 'prompt' ? param.visible : true) {
155+
if (param.id == 'prompt' ? param.visible == isMain : true) {
155156
let newData = getHtmlForParam(param, "input_");
156157
html += newData.html;
157158
if (newData.runnable) {
158159
runnables.push(newData.runnable);
159160
}
160161
}
161-
let presetParam = JSON.parse(JSON.stringify(param));
162-
presetParam.toggleable = true;
163-
let presetData = getHtmlForParam(presetParam, "preset_input_");
164-
presetHtml += presetData.html;
165-
if (presetData.runnable) {
166-
runnables.push(presetData.runnable);
162+
if (param.id == 'prompt' ? isMain : true) {
163+
let presetParam = JSON.parse(JSON.stringify(param));
164+
presetParam.toggleable = true;
165+
let presetData = getHtmlForParam(presetParam, "preset_input_");
166+
presetHtml += presetData.html;
167+
if (presetData.runnable) {
168+
runnables.push(presetData.runnable);
169+
}
167170
}
168171
}
169172
area.innerHTML = html;

0 commit comments

Comments
 (0)