fix: wrong value in clamping. feat: added an optional lora name append if empty result + updated readme

This commit is contained in:
Dijkstra
2023-11-01 18:42:13 +01:00
parent 89ad7f580f
commit e94f4bc2cd
4 changed files with 47 additions and 13 deletions

View File

@@ -205,9 +205,20 @@ def parse_selector(selector, tags_list):
if end < 0:
end = len(tags_list) + end
# clamp start and end values within list boundaries
start, end = min(start, len(tags_list)-1), min(end, len(tags_list)-1)
start, end = min(start, len(tags_list)), min(end, len(tags_list))
start, end = max(start, 0), max(end, 0)
# merge all
for i in range(start, end):
output[i] = tags_list[i]
return ", ".join(list(output.values()))
def append_lora_name_if_empty(tags_list, lora_path, enabled):
if not enabled or len(tags_list) > 0:
return tags_list
print("AAA : " + lora_path)
filename = os.path.splitext(lora_path)[0]
filename = os.path.basename(filename)
print("BBB : " + filename)
tags_list.append(filename)
return tags_list