Update models_manager_v8.4.py
Browse files- models_manager_v8.4.py +23 -0
models_manager_v8.4.py
CHANGED
|
@@ -2141,6 +2141,7 @@ class ModelsManager(tk.Tk):
|
|
| 2141 |
return res
|
| 2142 |
|
| 2143 |
seen_loras = set()
|
|
|
|
| 2144 |
|
| 2145 |
# 1. 提取基础参数
|
| 2146 |
for nid, node in prompt_data.items():
|
|
@@ -2170,6 +2171,20 @@ class ModelsManager(tk.Tk):
|
|
| 2170 |
res["sampler"] = self._resolve_value(inputs.get("sampler_name"), prompt_data)
|
| 2171 |
res["scheduler"] = self._resolve_value(inputs.get("scheduler"), prompt_data)
|
| 2172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2173 |
# 2. 兜底找 seed
|
| 2174 |
if res["seed"] == "-" or res["seed"] == "":
|
| 2175 |
for nid, node in prompt_data.items():
|
|
@@ -2217,6 +2232,14 @@ class ModelsManager(tk.Tk):
|
|
| 2217 |
if neg_text and "negative_prompt_not_found" not in neg_text:
|
| 2218 |
if len(neg_text) > len(res["neg"]): res["neg"] = neg_text
|
| 2219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2220 |
if res["seed"] == "-" or res["seed"] == "":
|
| 2221 |
seed_match = re.search(r"Seed:\s*(\d+)", dasiwa_text, re.IGNORECASE)
|
| 2222 |
if seed_match:
|
|
|
|
| 2141 |
return res
|
| 2142 |
|
| 2143 |
seen_loras = set()
|
| 2144 |
+
all_text_for_lora = "" # 🌟 用来收集所有可能包含 <lora:xxx> 的文本
|
| 2145 |
|
| 2146 |
# 1. 提取基础参数
|
| 2147 |
for nid, node in prompt_data.items():
|
|
|
|
| 2171 |
res["sampler"] = self._resolve_value(inputs.get("sampler_name"), prompt_data)
|
| 2172 |
res["scheduler"] = self._resolve_value(inputs.get("scheduler"), prompt_data)
|
| 2173 |
|
| 2174 |
+
# 🌟 新增:把节点里所有的 text/string/positive 等文本字段收集起来
|
| 2175 |
+
for k, v in inputs.items():
|
| 2176 |
+
if isinstance(v, str) and ("<lora:" in v or "lora_name" in v):
|
| 2177 |
+
all_text_for_lora += "\n" + v
|
| 2178 |
+
|
| 2179 |
+
if all_text_for_lora:
|
| 2180 |
+
# 正则匹配 <lora: 后面直到 : 或 > 之间的内容
|
| 2181 |
+
found_tags = re.findall(r'<lora:([^:>]+)(?::[^>]+)?>', all_text_for_lora)
|
| 2182 |
+
for tag in found_tags:
|
| 2183 |
+
l_name = self._clean_showcase_name(tag)
|
| 2184 |
+
if l_name != "-" and l_name not in seen_loras:
|
| 2185 |
+
seen_loras.add(l_name)
|
| 2186 |
+
res["loras"].append(l_name)
|
| 2187 |
+
|
| 2188 |
# 2. 兜底找 seed
|
| 2189 |
if res["seed"] == "-" or res["seed"] == "":
|
| 2190 |
for nid, node in prompt_data.items():
|
|
|
|
| 2232 |
if neg_text and "negative_prompt_not_found" not in neg_text:
|
| 2233 |
if len(neg_text) > len(res["neg"]): res["neg"] = neg_text
|
| 2234 |
|
| 2235 |
+
# 🌟 顺手也从 dasiwa_text 里扫一遍 <lora:...>
|
| 2236 |
+
found_tags = re.findall(r'<lora:([^:>]+)(?::[^>]+)?>', dasiwa_text)
|
| 2237 |
+
for tag in found_tags:
|
| 2238 |
+
l_name = self._clean_showcase_name(tag)
|
| 2239 |
+
if l_name != "-" and l_name not in seen_loras:
|
| 2240 |
+
seen_loras.add(l_name)
|
| 2241 |
+
res["loras"].append(l_name)
|
| 2242 |
+
|
| 2243 |
if res["seed"] == "-" or res["seed"] == "":
|
| 2244 |
seed_match = re.search(r"Seed:\s*(\d+)", dasiwa_text, re.IGNORECASE)
|
| 2245 |
if seed_match:
|