Skip to content

Commit b6f25e5

Browse files
author
legionfu
committed
cn数量读取问题修复,同时兼容新旧版本
output_log函数返回值不匹配的问题
1 parent e9b61fd commit b6f25e5

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

javascript/state.core.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ state.core = (function () {
104104
}
105105

106106
let img_elem_keys=[];
107+
108+
function get_imgs_elem_key(){
109+
return img_elem_keys;
110+
}
111+
107112
function init() {
108113

109114
//console.log(window.localization)
@@ -697,5 +702,5 @@ state.core = (function () {
697702
}
698703
};
699704

700-
return { init,actions };
705+
return { init, actions };
701706
}());

javascript/state.ext.general.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ function general_ext(tab_name, extension_name, root_container) {
170170
}
171171
}
172172
function handleSelects() {
173-
173+
174174
let root_selects = root_not_tabs.container.querySelectorAll('.gradio-dropdown');
175175
root_selects.forEach(function (root_select) {
176176
if(cnTabs.length == 0){
@@ -184,7 +184,7 @@ function general_ext(tab_name, extension_name, root_container) {
184184
break
185185
}
186186
}
187-
if(needsHandle){handleCheckbox(root_select, root_not_tabs.store)}
187+
if(needsHandle){handleSelect(root_select, root_not_tabs.store)}
188188
} // else
189189
});
190190

javascript/state.utils.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ state.utils = {
243243

244244
}
245245
} catch (error) {
246-
console.error('[state]: Error:', error);
246+
console.warn('[state]: Error:', error);
247247
}
248248
},
249249
// handleSelect: function handleSelect(select, id, store) {
@@ -282,7 +282,7 @@ state.utils = {
282282
// });
283283
// }, 150);
284284
// } catch (error) {
285-
// console.error('[state]: Error:', error);
285+
// console.warn('[state]: Error:', error);
286286
// }
287287
// },
288288

@@ -317,13 +317,14 @@ state.utils = {
317317
}, 150);
318318

319319
} catch (error) {
320-
console.error(`accordion:${accordion}, id:${id}`)
321-
console.error('[state]: Error:', error);
320+
console.warn(`accordion:${accordion}, id:${id}`)
321+
console.warn('[state]: Error:', error);
322322
}
323323

324324
},
325325
handleSelect: function handleSelect(select, id, store, force=false) {
326326
try {
327+
327328
let value = store.get(id);
328329
if (value ) { //&& value != 'None'
329330

@@ -442,7 +443,7 @@ state.utils = {
442443
});
443444
}, 150);
444445
} catch (error) {
445-
console.error('[state]: Error:', error);
446+
console.warn('[state]: Error:', error);
446447
}
447448
},
448449
handleMultipleSelect: function handleMultipleSelect(select, id, store) {
@@ -492,7 +493,7 @@ state.utils = {
492493
store.set(id, selected);
493494
});
494495
} catch (error) {
495-
console.error('[state]: Error:', error);
496+
console.warn('[state]: Error:', error);
496497
}
497498
},
498499
txtToId: function txtToId(txt) {

scripts/lightdiffusionflow_config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,18 @@ def init():
6161
json_str = f.read()
6262
webui_settings = json.loads(json_str)
6363

64-
Multi_ControlNet = webui_settings["control_net_max_models_num"]
64+
Multi_ControlNet = webui_settings.get("control_net_unit_count", None) # controlnet数量,新版名字
65+
if(Multi_ControlNet == None):
66+
Multi_ControlNet = webui_settings.get("control_net_max_models_num", 0)
67+
print(f"Multi_ControlNet = {Multi_ControlNet}")
6568
if(Multi_ControlNet == 1):
6669
Image_Components_Key.append(f"txt2img_controlnet_ControlNet_input_image")
6770
Image_Components_Key.append(f"img2img_controlnet_ControlNet_input_image")
6871
else:
6972
for i in range(Multi_ControlNet):
7073
Image_Components_Key.append(f"txt2img_controlnet_ControlNet-{i}_input_image")
7174
Image_Components_Key.append(f"img2img_controlnet_ControlNet-{i}_input_image")
75+
7276
except:
7377
pass
7478

scripts/state_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def on_after_component(component, **kwargs):
114114

115115
#State_Comps["test_button"].click(test_func,_js="state.utils.testFunction",inputs=[])
116116

117-
State_Comps["refresh_log"].click(add_output_log,inputs=[],outputs=State_Comps["outlog"])
117+
State_Comps["refresh_log"].click(add_output_log,inputs=[],outputs=[State_Comps["outlog"][0], State_Comps["outlog"][1]])
118118

119119
input_component = State_Comps["background_import"] #State_Comps["import"][0]
120120
State_Comps["set_file_button"].click(set_lightdiffusionflow_file,inputs=[],outputs=[input_component])

0 commit comments

Comments
 (0)