fix a bug of removing model

pull/266/head
butaixianran 2023-10-21 04:57:49 +08:00
parent dc76c0c688
commit ab8cac229d
4 changed files with 23 additions and 5 deletions

View File

@ -212,6 +212,9 @@ Since v1.5.5, we've already optimized the SHA256 function to the top. So the onl
# Change Log # Change Log
## v1.8.3
* fix a bug of removing model when model name has space in it.
## v1.8.2 ## v1.8.2
* fix downloading issue when connection failed * fix downloading issue when connection failed
* fix nsfw is not a bool issue * fix nsfw is not a bool issue

View File

@ -18,7 +18,8 @@ And its unified canvas system:
So, for Model Info Helper, I'm re-designing it into a stand alone model and workflow management system, which should work with most popular SD UI, not just for SD webui. So, for Model Info Helper, I'm re-designing it into a stand alone model and workflow management system, which should work with most popular SD UI, not just for SD webui.
And I'll take down all workflow management functions so this stand alone version can be release sooner. And I'll take down all workflow management functions so this stand alone version can be released sooner.
Since it won't be released as estimated, I have updated the old civitai helper 1.x to work with latest SD webui. Since it won't be released as estimated, I have updated the old civitai helper 1.x to work with latest SD webui.

View File

@ -122,7 +122,7 @@ def get_model_path_by_type_and_name(model_type:str, model_name:str) -> str:
# get model path by model type and search_term # get model path by model type and search_term
# parameter: model_type, search_term # parameter: model_type, search_term
# return: model_path # return: model_path
def get_model_path_by_search_term(model_type, search_term): def get_model_path_by_search_term(model_type:str, search_term:str):
util.printD(f"Search model of {search_term} in {model_type}") util.printD(f"Search model of {search_term} in {model_type}")
if model_type not in folders.keys(): if model_type not in folders.keys():
util.printD("unknow model type: " + model_type) util.printD("unknow model type: " + model_type)
@ -132,10 +132,24 @@ def get_model_path_by_search_term(model_type, search_term):
# for ckp: search_term = subfolderpath + model name + ext + " " + hash # for ckp: search_term = subfolderpath + model name + ext + " " + hash
# for ti: search_term = subfolderpath + model name + ext + " " + hash # for ti: search_term = subfolderpath + model name + ext + " " + hash
# for hyper: search_term = subfolderpath + model name # for hyper: search_term = subfolderpath + model name
has_hash = True
if model_type == "hyper":
has_hash = False
elif search_term.endswith(".pt") or search_term.endswith(".bin") or search_term.endswith(".safetensors") or search_term.endswith(".ckpt"):
has_hash = False
# remove hash
# model name may have multiple spaces
splited_path = search_term.split()
model_sub_path = splited_path[0]
if has_hash and len(splited_path) > 1:
model_sub_path = ""
for i in range(0, len(splited_path)-1):
model_sub_path += splited_path[i] + " "
model_sub_path = model_sub_path.strip()
model_sub_path = search_term.split()[0]
if model_sub_path[:1] == "/": if model_sub_path[:1] == "/":
model_sub_path = model_sub_path[1:] model_sub_path = model_sub_path[1:]

View File

@ -6,7 +6,7 @@ import requests
import shutil import shutil
version = "1.8.2" version = "1.8.3"
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'} 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'}