fix a bug when using custom model path

pull/299/head
butaixianran 2024-04-17 14:39:38 +08:00
parent 8ee7e6d2a4
commit 6e9c228820
4 changed files with 26 additions and 14 deletions

View File

@ -244,7 +244,10 @@ Since v1.5.5, we've already optimized the SHA256 function to the top. So the onl
# Change Log3
# Change Log
## v1.10.4
* Fix a bug about model path parsing when using custom model folder
## v1.10.2
* Bring back this addon's green refresh button to SD webui v1.8.x

View File

@ -1166,6 +1166,7 @@ onUiLoaded(() => {
let sd_version = ch_sd_version();
console.log(`sd version is: ${sd_version}`);
if (compareVersions(sd_version, "1.8.0") >= 0){
console.log("get sd version v1.8.0+");
for (let prefix of tab_prefix_list) {
toolbar_id = prefix + "_lora_controls";
@ -1190,18 +1191,18 @@ onUiLoaded(() => {
// from sd v1.8.0, we add refresh function to official's refresh button
refresh_btn.onclick = function(event){
console.log("run refresh button on click");
//official's refresh function
//it will send msg to python to reload card list and won't wait for that.
extraNetworksControlRefreshOnClick(event, prefix, js_model_type);
// refresh_btn.onclick = function(event){
// console.log("run refresh button on click");
// //official's refresh function
// //it will send msg to python to reload card list and won't wait for that.
// extraNetworksControlRefreshOnClick(event, prefix, js_model_type);
//this will not get card list if cards need to be reloaded from python side.
//user need to click refresh button again, after card list is reloaded.
//which does not feel right by user.
//so, this addon's green refresh button is still needed.
update_card_for_civitai_with_sd1_8();
};
// //this will not get card list if cards need to be reloaded from python side.
// //user need to click refresh button again, after card list is reloaded.
// //which does not feel right by user.
// //so, this addon's green refresh button is still needed.
// update_card_for_civitai_with_sd1_8();
// };
// add refresh button to toolbar
let ch_refresh = document.createElement("button");

View File

@ -213,6 +213,7 @@ def load_model_info_by_search_term(model_type, search_term):
model_info_base = model_info_base[1:]
model_folder_name = "";
if model_type == "ti":
model_folder_name = "embeddings"
@ -223,6 +224,13 @@ def load_model_info_by_search_term(model_type, search_term):
else:
model_folder_name = "Lora"
# model folder path could be customized
model_folder = model.folders[model_type]
model_folder_name = os.path.basename(model_folder)
# check if model folder is already in search_term
if model_info_base.startswith(model_folder_name):
# this is sd webui v1.8.0+'s search_term
@ -237,7 +245,7 @@ def load_model_info_by_search_term(model_type, search_term):
# util.printD("final model_info_base: " + model_info_base)
model_folder = model.folders[model_type]
model_info_filename = model_info_base + suffix + model.info_ext
model_info_filepath = os.path.join(model_folder, model_info_filename)

View File

@ -6,7 +6,7 @@ import requests
import shutil
version = "1.10.3"
version = "1.10.4"
def_headers = {'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
"Authorization": ""}